Mon, 28 Nov 2011, 01:58


More regarding Lab 5.

A student writes:

> Hey Professor Patt, I was reading the instructions for programming 
> assignment 5 and came across a sentence I was unsure about. When 
> describing how we should make up for the lack of an operating system, 
> the instructions say "Since there is no operating system, please 
> initialize R6 to x3000, indicating an empty stack." I don't see why this 
> is necessary considering that this would be done under user privilege 
> meaning that R6 is the USP and would have nothing to do with the system 
> stack which would be loaded into R6 from Saved_SSP in state 45. Is this 
> not correct?
>
> Thanks,
> <<name withheld to protect the student who got it ...almost!>>

First, very good!  Yes, when the interrupt is initated, R6 would be loaded
from the contents of Saved_SSP, assuming the program being interrupted is
running in user mode.

Question: How did the value in Saved_SSP get there?

Answer: When the operating system was loaded ("boot" is the term we use
for "load" the operating system), it initializes the system stack pointer
to x3000.  Since in our case there is no operating system, we are asking you
to take care of that task, which would have been taken care of had there been
an operating system managing the activity of the LC-3.

Good luck finishing the program. this week.

Yale Patt