We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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 VAR0VAR0 DCD 0x00 ENTRY EXPORT Reset_HandlerReset_Handler
numdates EQU 4 ;number of dates to search AREA dates, DATA ALIGN 4 date1 DCD 9, 20, 2019 ;month, day, yeardate2 DCD 10, 1, 2019 ;month, day, yeardate3 DCD 8, 21, 2019 ;month, day, yeardate4 DCD 10, 1, 2020 ;month, day, year
(Create proper algorithm here)
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?
Jimmy said:(Create proper algorithm here)
Is this a homework question?
Jimmy said:can't seem to wrap my head around the fact that I am dealing with commas here
Pardon?!
The syntax of the DCD directive is shown here:
http://www.keil.com/support/man/docs/armasm/armasm_dom1361290005934.htm
The commas simply separate the values!
Seems like you need to do some basic study on ARM assembler
http://www.keil.com/books/armbooks.asp
See also: community.arm.com/.../160087
Assembler is not the place to do algorithm design - assembler is about fine-detail implementation.
(there isn't an option for assembler - so probably omit step 3 and just leave it as 'text')
Does seem like a homework type question, don't you have a text books or teacher who can provide some foundation or direction here?
Perhaps find a book on ARM assembler, got to be some sorting examples published some where.
Perhaps an example on managing arrays of data, or indexed addressing?
Some grasp of data representation in memory?
date1 DCD 9, 20, 2019 ;month, day, year ldr r4, =date1 ; Load memory address pointer ldr r0, [r4, #0] ; r0 = month ldr r1, [r4, #4] ; r1 = day ldr r2, [r4, #8] ; r2 = year
Westonsupermare Pier said:Does seem like a homework type question
Certainly does!
Why would anyone want to do this in assembler?
For Lolz I guess... At ye olde secondary school we did it because it provided a really good level of insight into how micro-controllers actually work and how data and code exist within the machine.
Assume today that kidz are surrounded by a sea of incompetents, and liberal arts graduates, filling their heads with non-sense and pseudo-science. We perhaps should stop asking why, and provide some level of safe harbour, and explain how things actually work?
To be honest the world will likely come to an end in 12 years, not because the climate changed, but because some idiot freed all the electrons..
It is and I ended up figuring it out from running into a classmate and asking for advice. I didn't know about how I can call in parts of a given data by using addressing and shifting.
Thanks for the reply now I have some extra resources to study off of for my upcoming midterms.