This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Help with sorting dates from what I think is an array?

Hey guys, so I'm trying to take this given code:

AREA RESET, DATA, READONLY
EXPORT __Vectors
__Vectors
DCD 0x20001000
DCD Reset_Handler
ALIGN

AREA MYCODE, CODE, READONLY
EXPORT VAR0
VAR0 DCD 0x00
ENTRY
EXPORT Reset_Handler
Reset_Handler

numdates EQU 4 ;number of dates to search
AREA dates, DATA

ALIGN 4

date1 DCD 9, 20, 2019 ;month, day, year
date2 DCD 10, 1, 2019 ;month, day, year
date3 DCD 8, 21, 2019 ;month, day, year
date4 DCD 10, 1, 2020 ;month, day, year

(Create proper algorithm here)


END


END

and try to sort the dates. I've sat down and tried to come up with ideas but can't seem to wrap my head around the fact that I am dealing with commas here. I want to compare the years first and make a comparison or test statement to check which one is of less value. If one is less than the other, it would move on to compare it with the next available piece of data. If the comparisons end with two things being equal, it would then move on to the months and figure it out from there then to the days to finalize the result. 

My main question here is: how do I store these pieces of data into registers? I tried LDR, MOV, and STR and it didn't generate me anything successful. I think the solution revolves around ALIGN, but reading the manual's description about ALIGN didn't solve anything for me yet.

Suggestions?

Parents Reply Children
No data