(LC3 Assembly) You are in the process of debugging a program you\'ve written. Yo
ID: 3713498 • Letter: #
Question
(LC3 Assembly)
You are in the process of debugging a program you've written. You decide to focus your debugging on the following segment of code by setting a breakpoint at xA400.
You run the code up to the breakpoint, clear the registers, and step through the code starting at that point.
0xA400: THIS1 LEA R0, THIS1
0xA401: THIS2 LD R1, THIS2
0xA402: THIS3 LDI R2, THIS5
0xA403: THIS4 LDR R3, R0, #2
0xA404: THIS5 .FILL xA400
What is the value in registers R1, R2, and R3 when .FILL at location 0xA404 is reached?
Explanation / Answer
R1 = 001000100000000
R2 = xA400
R3 = 101001000000010
Explanation :-
LEA R0,THIS1 => will load address of label THIS1 into R0 -> R0 = 0xA400
LD R1,THIS2 => will load value stored in THIS2 labelled address => R0 = machine code of LD R1,THIS2 = 001000100000000
LDI R2,THIS5 => will load value stored in THIS5 label -> R2 = xA400
LDR R3,R0,#2 => will load value stored in address xA402 => R3 = [R0 + 2] = [xA400 + 2] = [xA402] = 101001000000010
LD = machine code :- 0010 RD(3bits) PCOFFSET(8 bits)
LDI = machine code :- 1010 RD(3 bits) PCOFFSET(8 bits)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.