I am having a problem getting the next line to print after getting user input. the output should be:
5
54321END
; Description:
; This program displays a prompt to the user, "Enter count [1-9]: ", to request
; the number of times to loop and output to the screen. The number of times to
; loop will be limited to between 1 and 9.
.ORIG x3000 ; Start at memory location x3000
LEA R0, QUESTION ; Load Question into R0
PUTS ; print prompt to console
GETC
LEA R5, NEWLINE
OUT ; Take a character input from keyboard, then store in R0
LD R1, NEGASCII ; Load NegASCII into R1
ADD R2, R0, R1 ; Strip ASCII, store integer into R2
LD R3, ASCII ; Load Ascii into R3
LOOP ; initialize loop to write counter to console
ADD R0, R2, R3 ; make sure value is printabele to console
OUT ; Print to console
ADD R2, R2, #-1 ; subtract the loop counter by 1
BRnp LOOP ; Call the loop again
LEA R0, FINAL
PUTS
CLRIO
HALT
NEWLINE .FILL x0A
QUESTION .STRINGZ "Enter count[1-9]: " ; Create Question Prompt
NEGASCII .FILL xFFD0 ; give NEGASCII value of -x0030
ASCII .FILL x0030 ; Set ASCII value to 0
FINAL .STRINGZ "END\n" ; Create Final Prompt
.END
The output for the code above is
554321END with an empty line after it.