I have the following assembly code:
alpha: .space 64 @reserves 64 bytes
i: int 0
.text
.align2
.globalmain
.func main
main:
ldr r3,=i @r3 is address of i
mov r2,#0 @r2 is 0
str r2,[r3] @r2 is stored in r3
L1:
ldr r3,=i @r2 is address of i
ldr r2,[r3] @r2 is now address of i
cmp r2,#16
bge exit @if r2 > 16, then exit (but it is not)
ldr r3,=i @r3 is address of i
ldr r2,[r3] @r2 is address of i
add r1,r2,#0x200 @r1 is r2 + 0x200
ldr r3,=alpha @r3 is address of first element in array alpha (I think)
str r1,[r3,r2,asl#2]
...
I know its alot, but I only have trouble with one part. I commented the parts I do know, or at least I think I know.
The trouble I'm having is with str r1,[r3,r2,asl#2]
. I know asl#2
is a left shift, but that's all I really know. Where does r1 get stored, in r3? What would be the result of the str
command? Can someone explain it for me?