Question: Consider the LC - 3 assembly code below which defines the HALT service routine: . ORIG x 0 5 2 0 ; Where this routine

Consider the LC-3 assembly code below which defines the HALT service routine:
.ORIG x0520 ; Where this routine resides
ST R1, SaveR1 ; R1: a temp for MC register
ST R0, SaveR0 ; R0 is used as working space
;
; print message that machine is halting
;
LD R0, ASCIINewLine TRAP x21
LEA R0, Message TRAP x22
LD R0, ASCIINewLine TRAP x21
;
; clear bit 15 at xFFFE to stop the machine
;
LDI R1, MCR ; Load MC register into R1
LD R0, MASK ; R0= x7FFF
AND R0, R1, R0 ; Mask to clear the top bit
STI R0, MCR ; Store R0 into MC register
;
; return from HALT routine.
;
LD R1, SaveR1 ; Restore registers LD R0, SaveR0
RTI
;
; Some constants
;
ASCIINewLine .FILL x000A SaveR0.BLKW 1
SaveR1.BLKW 1
Message .STRINGZ "Halting the machine."
MCR .FILL xFFFE ; Address of MCR
MASK .FILL x7FFF ; Mask to clear the top bit
.END
a)(2.5 points) What starts the clock after the machine is HALTed? Hint: How can the HALT
service routine return after bit [15] of the Master Control Register is cleared?
b)(2.5 points) Which instruction actually halts the machine?
c)(2.5 points) What is the first instruction executed when the machine is started again?
d)(2.5 points) Where will the RET of the HALT routine return to?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!