LC3 LEA指令和存储的值 [英] LC3 LEA instruction and the value stored
问题描述
我对这个问题感到困惑:什么是存储在寄存器0指令后的值LEA R0,A
执行为什么答案是x370C我?估计这应该是A的地址加载到R0?如果是这样,我们如何知道地址?是否有人可以帮忙吗?非常感谢!
.orig这样X3700
LEA R0,A
LDI R2,C R3 LDR,R0,2
与R 1,R 1,#0
在
ST R0,D
JSR˚F
停
˚FLD R1,B
ADD R1,R1,#1
BRP˚F
RET .fill伪一X1234
乙.fill伪X370B
.fill伪ÇX370C
ð.BLKW 2
Ë.STRINGZABCD
摹.fill伪X1234
。结束
在code的起源是 x3700
,你有12条指令,因此地址 A的
将 x3700 + X0C = x370C
。正如你猜到了, LEA R0,A
加载 A
的地址复制到 R0
,所以 R0
将包含 x370C
后第一个指令已被执行。
.orig这样X3700
3700 LEA R0,A
3701 LDI R2,C
3702 LDR R3,R0 2
...
370B RET370℃.fill伪X1234
...
I am confused by this question: What is the value stored in register 0 after instruction "LEA R0,A"
is executed? How come the answer is x370C ? I reckon it is supposed to load the address of A into R0? If so how do we know the address? 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 origin of the code is x3700
, and you have 12 instructions, so the address of A
will be x3700 + x0C = x370C
. As you guessed, LEA R0,A
loads the address of A
into R0
, so R0
will contain x370C
after that first instruction has been executed.
.ORIG X3700
3700 LEA R0, A
3701 LDI R2, C
3702 LDR R3, R0, 2
...
370b RET
370c A .FILL X1234
...
这篇关于LC3 LEA指令和存储的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!