Tue, 3 Dec 2013, 18:35

My students,

I have received two emails regarding the two screen shots associated with
Program 5.  Both address the same problem.  One is reproduced below:

> Dr. Patt,
> Today in class, you mentioned using two STRINGZs for one line of the Texas
> checker board and the other. I'm wondering if we use STRINGZs for each line
> (instead of individually outputting the word "Texas" and the spaces), will
> our interrupt ever output the capital and lower case letters between the
> letters or words (much like the first and 2nd screenshots given)? For
> example,
> Texas      Texas       Texas
> AAAAAAAAAAaaaaaaaaaa
>      Texas
>        Texas       Texas       Texas
> I've tried multiple times on my program and it always seems to output the
> letters after a line (which you explained today is caused by probability).
> I am wondering whether or not to change the STRINGZs to individual words or
> letters.
> Thank you for your time

First, re: grading, we are setting up the grading program so that your grade
will not be affected by where you put the delay loop and how much delay you
put into the delay loop.

It is important to know, however, that the interrupt is asynchronous with 
the running program.  That is, the keyboard key is typed at some random point 
in the middle of execution of an INSTRUCTION.  That instruction could be in 
the middle of the trap routine or in the middle of the delay loop, or in the
middle of an instruction that is not part of the delay loop or the trap  
routine.  The computer does not initiate the interrupt until AFTER that 
one instruction completes execution.  After the interrupt service routine 
finishes, the program continues where it left off by executing the next 
instruction.  If that instruction is in the middle of the PUTS trap routine, 
then the computer returns to the PUTS trap routine at the next instruction.  
If that instruction is in the middle of the delay loop, the computer returns 
to that point in the delay loop and continues execution of the loop.  If 
that instruction is in the user code and not part of the PUTS routine or 
the delay loop, then the computer still starts where it left off when it
interrupted the user program.

One more thing that I said in class that I want to emphasize.  Since most 
of the time the computer is executing the delay loop, the probability is 
very high that the key is struck while the computer is executing the delay 
loop, which is why the screen shows up as the interrupt occuring at the end 
of a PUTS trap routine.  If you repeated the experiment enough times, 
you would occasionally (NOT often) see the interrupt happening in the 
middle of the line.

I hope the above helps.

Good luck finishing Program 5 this week.

Yale Patt