问题描述
我不知道为什么After instruction LDR R3, R0, 2 is executed, the value stored in R3 is x370C.
在此指令中2代表什么?它看起来不像是一个崇高的价值.我知道此时R0包含x370C.有人可以帮忙吗?非常感谢!
I can't figure out why After instruction "LDR R3, R0, 2" is executed, the value stored in R3 is x370C.
what does 2 stands for in this instruction? It doesn't look like an immidiate value. I understand that R0 contains x370C at this point. Can someone please help? Many thanks!
.ORIG X3700
LEA R0, A
LDI R2, C
LDR R3, R0, 2
AND R1, R1, #0
IN
ST R0, D
JSR F
HALT
F LD R1, B
ADD R1, R1, #1
BRp F
RET
A .FILL X1234
B .FILL X370B
C .FILL X370C
D .BLKW 2
E .STRINGZ "ABCD"
G .FILL X1234
.END
推荐答案
第二个参数是将要加载的基址的偏移量.
The second parameter is the offset of the base address that will be loaded.
我开始在这里拍一些照片并作了很好的解释,但是我发现了一个有趣的演讲视频,该视频比文字讲得更好,并且可以节省很多时间.
I started to take some pictures to post here and make a good explanation but I found an interesting lecture video that will explain much better than words and will save a lot of time.
视频说明了LC3加载指令之间的差异,并着重说明了它们之间的差异.
The video is explaining the differences between the load instructions for the LC3, highlighting the differences between them.
在您的示例中:
您拥有自己的数据:
A .FILL X1234
B .FILL X370B
C .FILL X370C
运行代码:
LEA R0, A -- R0 has the address of A
LDI R2, C -- R2 has value of which address C has
LDR R3, R0, 2 -- R3 has the value of C
-- because R0 has the address of A + 2 positions = C
这篇关于lc3 LDR指令和存储的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!