本文介绍了理解 ARM 中的 str的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下汇编代码:
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.
我遇到的问题是 str r1,[r3,r2,asl#2]
.我知道 asl#2
是左移,但这就是我真正知道的.r1 在 r3 中存储在哪里?str
命令的结果是什么?有人可以为我解释一下吗?
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?
推荐答案
str r1,[r3,r2,asl#2]
r2 中的值是算术左移(立即数)2 并添加到 r3 的内容中,以获得将存储 r1 的内存地址.
value in r2 is arithematic left shifted by (immediate value) 2 and is added to the contents of r3 , to get the memory address at which r1 will be stored.
这篇关于理解 ARM 中的 str的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!