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

Unable to store my result back to the memory

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:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Could someone please point out where I am doing wrong.

Thanks!

0