Develop the program in LC3 assembly language in two steps: 1. The program prompt
ID: 3725629 • Letter: D
Question
Develop the program in LC3 assembly language in two steps: 1. The program prompts you for your name and accepts it as input. The program then displays your name back to you. Here is an example run of the program: Please enter your name: Fib O. Nachee Thank you, Fib O. Nachee! 2. Now add code to the program to convert the lowercase letters in the string to uppercase letters and display the result. Here is an example run of the program: Please enter your name: Fib O. Nachee Thank you, Fib O. Nachee! Your name in uppercase is FIB O. NACHEE
Explanation / Answer
.ORIG x3000
LEA r0, INPUT
LEA LN1, LN2
LEA R8, offset
LDR R7, R8, #0
LEA R7, offset ;
LDR R7, R7, #0
Test ADD R9, R8, R7
BRz Quit
ADD R5, R9, R7;
INCR ADD R1, R1, #1
BRnzp TEST
QUIT RET
LOWER ADD R9, R9, #1
___, __, __, __
BRnzp INCR
AND r2, r2, #0
AND r3, r3, #0
LEA r1, prompt1
PUTS
loop GETC
BRZ done
out
STR r1, r0, #0
ADD r0, r0, #1
LD r6, EOL
ADD r4, r2, r6
BRN loop
done
out
LEA r1, INPUT
onemoretime GETC
PUTS
HALT
prompt1 .STRINGZ "Please enter your name:"
BR onemoretime
INPUT .BLKW 30
LN1 .STRINGZ " Thank you, "
EOL .fill #-29
LN2 .STRINGZ " Your name in uppercase is "
OFFSET .FILL #-____
COMP .FILL #-____
DATA .FILL #116 ;'t'
.FILL #111 ;'o'
.FILL #109 ;'m'
.FILL 0
.end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.