email to me at: cfk@cs.swarthmore.edu a message in text form (no word, html or any other format than plain text) that contains labeled solutions to the exercises below. Make the subject of the email: cs33lab5. Make sure it is posted to me before 11:59 pm on Thursday, 30 Sep. The solutions will just be annotated programs in LC3 Assembly Language.
Don't forget that you are encouraged to work with a partner on these labs.
In this lab, you will write well-commented assembly language programs for the LC-3, assemble them to object code for the LC-3 (lc3as), and then run them in the LC-3 simulator (lc3sim-tk).
Each .asm file should assemble without errors using the lc3as program.
For this lab assignment, you will write two LC-3 assembly language programs. Your programs should begin at x3000 and you should not make any assumptions about the initial state of registers or memory locations. Of course loading your program will put what you want in memory locations.
For example, here the user enters the decimal value "4304" which yields the binary result "0001000011010000". (The IN trap is used here but you can use GETC if you prefer.
Input a character> 4 Input a character> 3 Input a character> 0 Input a character> 4 Input a character> 0001000011010000
To avoid complicating issues, you should assume that the user always enters input from keyboard that consists only of the digits 0 through 9 and Enter -- there's no need to do any error checking. Also, you should assume -- again, don't error check -- that all values are positive, and that the user will not type a value larger than (215 - 1) = 32767.
Though this might sound quite complicated, if you break the problem into two halves, it's quite manageable. In the first half, you need to read digits from the keyboard and store the binary equivalent in a register. You don't have to actually convert it to binary -- simply by storing the "appropriate value" in the register, you're storing it in binary! In the second half, you need to print the contents of that register to the screen. That is send the ASCII code for a 0 or a 1 to the screen in the correct order for each bit in the register.