Hi,
I am having trouble writing a sentinel controlled loop in LC-3 assembly language. I know that you must store the sentinel somewhere in memory and that when the sentinel is detected, then the loop is done. However, how do you actually write this in LC-3 code.
Lets say I have the following example where I want to get user input of integers until the user enters a '#' character. How would I write the sent controlled loop for this. I have the following:
/
.ORIG x3000
LD R1, PTR
LD R6, SENT
LEA R0, PROMPT
PUTS
FOR_LOOP_1
TRAP x20
STR R0,R1,#0
ADD R1,R1,#1
BR TEST ;; how do you write the TEST loop. I know what i have is wrong
TEST
LDR R3,R0,#0
AND R3,R3,#0
ADD R4,R3,R6
BR FOR_LOOP_1
HALT
SENT .FILL #35 ;;dec representation of '#'
PROMPT .STRINGZ "ENTER NUMBERS, # WHEN YOU WANT TO STOP"
PTR .FILL x4000
.END
/
PLEASE HELP ME. THANKS