I am new to messing around with LC-3 and am stuck on a problem. I want to be able to input an entire string, such as "Hello, my name is Connor" and when I press enter, THEN it is echoed in the console. I have done a problem prior where I read a character and then echoed it continuously until space was pressed, But I am not too sure how I can accomplish a whole string and then echoing it on enter. Any help to get me started?
What I end up with would look like this (all .fill commands):
.ORIG x3000 ; specify the "origin"; i.e., where to load in memory
; machine instructions
.FILL x2006
.FILL x2206
.FILL x0403
.FILL xF021
.FILL X127F
.FILL x0FFC
.FILL xF025
.FILL x005A
.FILL x0064
.END
In your previous problem, you were able to call a trap for OUT after getting a character from the user. In order to read the entire string from the user until a new line, you need to store each character in memory until they enter a new line, then call a trap for PUTS.
I don't know if you're this far into your course yet, but first, I wrote the program in assembly, just to make sure I had the basic idea down.
Then, just go line by line and create the instructions manually in binary:
And then finally, convert those to hex and put them each in a .FILL