I wrote a simple code to add 3 numbers and store the result back in the memory. I tried to store the the 3 numbers in memory, retrieve it back using ADRL instruction and store it back. My code is working and I get the result but I am unable to store it to the desired location. The code below shows what I did:
AREA Addition,CODE,READONLY ENTRY EXPORT __main __main ADRL R4,Vals ;R4 points to Value area LDR R1,[R4,#Q] LDR R2,[R4,#R] LDR R3,[R4,#S] ADD R0,R1,R2 ADD R0,R0,R3 STR R0,[R4,#P] STOP B STOP P EQU 0 Q EQU 4 R EQU 8 S EQU 12 AREA Addition,DATA,READWRITE Vals SPACE 4 DCD 2 ;reserving 32bits in M/M and initializing it with 2 DCD 4 DCD 5 ALIGN END
Could someone please point out where I am doing wrong.
Thanks!