I\'ve already completed the symbol table I just need help with the questions on
ID: 3826928 • Letter: I
Question
I've already completed the symbol table I just need help with the questions on translations the LC3 machine code to binary and hex
ORIG AND R2, R2, #0 LD Symbol Address R3, ADDR LEA R1, CIAO HERE LDR. BRZ RO, R1, 80 3004 HERE QUIT JSRR R3 300 RO, R1, STR #0 ADD R2, R2, #1 BRNZP HERE. 30 or QUIT TRAP 2x33A0 FILL ADDR .STRINGZ "Good Bye!" CIAO END bol Table program shown above. 191 Give the Lc-3 machine code translation of the following instructions from this program. Write your answers in binary and then in hexadecimal. R3, ADDR Hex BRNZP HERE HEK Modify one of the program instructions so that it will cause a Pass 1 syntax error 121 Error instruction Modify one of the program instructions so that it will cause a Pass 2 syntax error 12] Error instruction
Explanation / Answer
Solution:
Symbol table is
HERE
x3003
QUIT
x3009
ADDR
x300A
CIAO
x300B
LD R3,ADDR
PCOffset = x300A-x3002 = 8
Binary : 0010 011 000001000
Hex: x2608
BRNZP HERE
PCOffset = x3003-x3009 = -6
-6 (2’s complement)= 000000110 = 111111001 +1 = 11111010
Binary : 0000 1 1 1 111111010
Hex: x0FFA
Pass1 Syntax Error
Modify LD to LD1
LD1 R3,ADDR
Pass2 Syntax Error
Modify HERE to HERE1
BRNZP HERE1
HERE
x3003
QUIT
x3009
ADDR
x300A
CIAO
x300B