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

Problem with storing data instruction STR (ASM)

I'm a really beginner with ARM. I write a very simple program to find the sum of three values Q,R,S and store it in the memory. However it doesn't works. Someone can show me what is my mistake. Thanks for your help.

AREA Example3, CODE, READONLY

    EXPORT SystemInit

    EXPORT    __main

    ENTRY

SystemInit   

__main

    LDR R1,Q      ;load r1 with Q

    LDR r2,R      ;load r2 with R

    LDR r3,S      ;load r3 with S

    ADD r0,r1,r2;add Q to R

    ADD r0,r3;add in S

    LDR    r4,=Q

    STR r0,[R4]      ;store result in Q

;Stop  B   Stop

P         SPACE 4 ;save one word of storage

Q         DCD 2         ;create variable Q with initial value 2

R        DCD 4

S        DCD 5

        END

0