12/06/2006


A student writes:

        Dr. Patt,

        Your lecture on Monday did clear up some confusion, but I am stilled
        befuddled at some of the concepts I have to use to write the interrupt
        service routine.  Thus, I have not one, but several questions

        First, do we have to write the push and pop subroutines?

They are not push and pop subroutines.  They are control signals that
perform the push and pop operations.  

Let me ask you a question: In a LD R1, A, do you have to write the Add
instruction that adds the sign-extended offset to the incremented PC to
get the address A?  Do you have to write the Load instruction that loads 
the MAR with this address?  Answer: Of course not.  The control signals
in the instruction cycle do all that.  Similarly, the control signals in
the instruction cycle do all the pushes in initiating an interrupt and
all the pops in carrying out the RTI instruction. 

        Second, is there any possible instruction that can be written that can
        push the PC and the PSR on the stack, because I don't see any 
        actual code involving the PC and the PSI in the book?

Nope. No instruction will do it. 

        Third, can the pointer set by R6 for the stack actually be recognized by
        the interrupt service routine?

Sure.  Every register can be recognized by every instruction.  Thus, if I am
using R6 to keep track of the top of the stack, I can not use R6 for other
general purpose activity.  In a real machine, as I said in class, there would
be more than one R6, one for handling the system activity and one each for
each level of privilege.  In 306, we are sticking with a single R6, and using 
it with the system stack.  ...which means that if you want to create a stack
for your own application's use, you will need to allocate space (via .BLKW)
and use another register as the stack pointer for that stack.

        I would very much appreciate any clarification on this.

        Thank you.
        <<name withheld to protect the student with several questions>>

I hope the above helps.  If not, please try again or see one of the TAs.

Good luck with what is left.

Yale Patt