The answer to problem 1a is already given. Please help me answer partb, corispon
ID: 665645 • Letter: T
Question
The answer to problem 1a is already given. Please help me answer partb, corisponding to the already given code.
1.
; 6.12 a. Write an LC-3 machine language routine that echoes the last character
; typed at the keyboard. If the user types an R, the program then
; immediately outputs an R on the screen.
; b. Expand the routine from part a such that it echoes a line at a time. For
; example, if the user types:
; The quick brown fox jumps over the lazy dog.
; then the program waits for the user to press the Enter key (the ASCII
; code for which is xOA) and then outputs the same line.
.ORIG x3000
LOOP LDI R0, KBSR ; Load the value of the KBSR into R0
BRzp LOOP ; If KBSR[15] = 0, no key has been pressed
LDI R0, KBDR ; Copy the waiting character from the KBDR to R0
LOOP2 LDI R1, DSR ; Load the value of the DSR into R1
BRzp LOOP2 ; If DSR[15] = 0, the display is not ready
STI R0, DDR ; Copy the character in R0 to the DDR
BRnzp LOOP
2. The following operations are performed n the stack. At which numbered operation does the stack have the most elements. Show your work.
push 5
push 3
push 2
pop
push 7
push 8
pop
pop
push 6
Explanation / Answer
2)
When we push 8 to the stack at that point it will have maximum elements in the stack.
The count will be 4.
push5
push 3
push 2
3 elements will be there in stack.
pop
2 will be removed from stack
then again there are 2 push operations.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.