I just fell in love with this particular microcontroller, 68hc11 has an amazing architecture.
I'm not an expert but i want to improve, assembly is kinda hard but i want to program this microcontroller.
This assembly code will execute from $100, will allocate a 200-byte array at $800, and will initialize that array with the values 200, 199, … 1. (descending order).
Vreset equ $FFFE
RAM equ $800
ROM equ $100
ARRAY_SIZE equ 200
org RAM
array rmb ARRAY_SIZE
org ROM
Start ldx #array
ldaa #ARRAY_SIZE
Loop staa ,x
inx
deca
bne Loop
bra *
org Vreset
dw Start
I want to get the two highest values from a given array.. i mean, i want to create an array, give 10 values (stored inside an array) and finally obtain the two highest values:
Example:
the array may contain these values:
5 7 9 96 57 58 1 5 6 9
I would like to obtain this output:
96 58
Can help me to do this? I'm kinda lost :/
The 68HC11 is a classic MCU architecture that was (and possibly still is, to some extent) taught in many universities.
Officially, it is end-of-life. But, due to momentum, many people are still actively using it either by IP equivalents loaded in FPGAs, or clones from companies such as Tekmos.
To create the array, use code similar to what you showed. My example uses constant array in ROM.
As to your question finding the two highest values, there are many possible solutions. Here's just one to get you started: