Wed, 6 Nov 2013, 20:28

My students, 

One of my favorite student questions just arrived in my mailbox.
So, it is a pleasure to share it with you, and my initial response.

> Hello Dr. Patt,
> In chapter nine of the textbook, you explain in detail how the TRAP
> instructions are executed. Figure 9.6 shows the HALT service routine
> stopping the processor by clearing the high bit of the MCR. How is the LC3
> able to restore registers and return to the user program after the
> processor has halted?
> Thanks for your time,
> <name withheld to protect the student who wants to start the halted computer>

Great question!  How about this for an answer:  It executes the following
piece of code:

		 LDI   R0, MCR
		 LD    R1, Constant
		 ADD   R0,R0,R1
		 STI   R0, MCR
		 BRnzp NEXT
	Constant .FILL x8000

What do you think of this answer?  Hint: This is a trick question,
good for making you think, bad for putting on an exam.

See you in class on Monday.

Yale Patt