I'm trying to gain a better understanding for the input and output or "read/echo" in LC-3 assembly language. I was looking at some examples in the back of my book to try and understand it better, however i've just ended up confused. What i'm trying to do is prompt a user to enter a two digit number, i know that i can do something like,
PROMPT .STRINGZ "Enter a two digit number>"
but im unsure as to how i would go about calling it. Eventually i want to understand how to convert that number the user types in, into a hexadecimal. any helps or tips or pushes in the right direction would be great.
this is what i have so far..
.ORIG x3000
READ LDI R0, KBSR; loads character from keyboard data
BRzp READ ; determines if it's a new character
LDI R0, KBDR; reads the character
ADD R2, R0, #-9 ; subtracts 9 to see if numbers
BRnz NUMBER;
NUMBER ; this is wehre i want my loop to be to convert to hex
ECHO LDI R1, DSR ; loads the ready bit character
BRzp ECHO ; determines if the screen is ready
STI R0, DDR ; stores the output data to the screen
KBSR .FILL xF300
KBDR .FILL xFE02
DSR .FILL xFE04
DDR .FILL xFE06
PROMPT .STRINGZ "Please enter a two digit number:> "
HALT .END