Create the following program in the LC-3 Assembly Language: All procedures are t
ID: 3903527 • Letter: C
Question
Create the following program in the LC-3 Assembly Language:
All procedures are to restore all used registers upon returning Your program should do the following: Print your class template Input characters from the keyboard (only echo printable characters) Keep track of the count of each group of characters inputted (do not count non-printable characters) There are 5 groups Print out the count of each group Any count over 9 will be represented by '>9' Only print printable characters Your screen should look something like this when the program runs: CS2810-### Student Name Project #4 Input a message to be analyzed: Help!0123456789 Group Numbers: Upper Case: Lower Case: Spaces: All others: Count > 9 s 3 1 Assemble your program properly and experiment with the simulator to confirm that your program is workingExplanation / Answer
.orig 0x3000
ONE .STRINGZ "One"
TWO .STRINGZ "Two"
THREE .STRINGZ "Three'
// take input in R2
GETC ;
ADD R3 , R0 , x0 ; Copy R0 into R3
ADD R3 , R3 , #?16 ; Subtract 48 , the ASCII value of 0
ADD R3 , R3 , #?16
ADD R3 , R3 , #?16 ; R3 now contains the actual value
ADD R2, R3, 0x; move original to R2
ADD R5, R5, #1
NOT R4, R5
ADD R4, R4, #1 ; R4 = -R5
ADD R5, R2, R4; R5 = R3 - 1
BRz print_one
ADD R5, R5, #2
NOT R4, R5
ADD R4, R4, #1 ; R4 = -R5
ADD R5, R2, R4; R5 = R3 - 1
BRz print_two
print_one LEA R0 , ONE ;
PUTS
print_two LEA R0 , TWO ;
PUTS
HALT
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.