我的这个 LC-3 程序有问题,我无法从if
/else
语句中获取要显示的字符串。我不知道我的语句是否错误,或者我是否显示错误的字符串。目标是让它在用户输入时显示 ,并IF
在用户输入时显示(停止程序)。0
else
1
.ORIG x3000
START:
; clear registers
AND R0, R0, 0
AND R1, R0, 0
AND R2, R0, 0
AND R3, R0, 0
AND R4, R0, 0
; print greeting
LEA R0, GREETING
PUTS
; get user-input
; echo it back
GETC
PUTC
; store entered string
ST R0, USERINPUT
;FIRST IF STATEMENT
OUTPUT LD R2, USERINPUT
BRz ENDIF
LEA R3, GREETING
;ELSE
ENDIF
LD R2, USERINPUT
HALT
DONE
; stop the processor
HALT
GREETING: .STRINGZ "\nWelcome to the game.\nDo you want to play?\n0:Yes 1:No\n: "
GREETINGTWO: .STRINGZ "\nTest if statement: "
; variables
USERINPUT: .FILL 0
; end of code
.END