Sat, 5th Dec 2015, 01:48 Re: Lab 5
A student writes. Actually, several students have written with questions about the screen shots. Since some of you still haven't finished lab 5, I decided to clear up some misconceptions. An example of the emails I have gotten is the following: > Hello Dr. Patt, > > I read the instructions and viewed the two snapshots but something is still > unclear to me. > > The instructions say that during the interrupt service routine, there > should be a new line printed, a prompt, and then a new line. > > On the first snapshot it appears that two new lines are printed after the > prompt instead of one. The prompt EE306: LC-3 is printed on a line of its > own followed by a blank line and then the prompt in the main program (ECE@UT) > is printed on a line of its own. Why is that? I don't know how to write my > code to do this unless the prompts EE306: LC-3 or EE319K: ARM are followed > by two new lines instead of one. > > I then looked at the second snapshot which shows that the main program got > interrupted before it could output a complete line. The prompt EE306: LC-3 > is printed on a line of its own but is not followed by a blank line. > > It appears to me that there might be a discrepancy between the two > snapshots but I think that I might be missing something instead. Although I > read in an email you sent that the second snapshot wouldn't occur, I am > confounded by the fact that EE306: LC-3 is not followed by a blank line. > > Thank you, > > <<name withheld to protect one who sees a discrepancy that does not exist>> There are two points to be made. First point. Actually, there is no discrepancy in the two screen shots. And if you write your code according to the instructions, you will do fine. To see why there is no discrepancy, look carefully at what the assignment is asking you to do with respect to printing to the screen. The user program: Print line A. Line feed Print line B. Line feed Print line A. Line feed Print line B. Line feed Print line A. ... The interrupt service routine: Line feed Print a line Line feed Suppose your program and interrupt routine do exactly that. Now look at the two screen shots. I have two questions for you to answer for each screen shot. In screen shot 1, what must have been the last ascii code sent to the monitor before the interrupt service routine took over? ...and what was the first ascii code sent to the monitor after the user routine got back control? In screen shot 2, what must have been the last ascii code sent to the monitor before the interrupt service routine took over? ...and what was the first ascii code sent to the monitor after the user routine got back control? Do you see that both screen shots follow the same process as described above with the 9 lines used to describe the user program and the 3 lines used to describe the service routine. Do you see that there is no discrepancy between the two snapshots. Second point. I never said the second snapshot never occurs. I said the second snapshot only occurs rarely. Recall the user program and the person hitting the key are operating asynchronously. If one examines where the user program is most of the time, one will see that the key stroke has to happen at just the right moment to get screen shot 2. Overwhelmingly, most of the time it does not happen. I thought of leaving out snapshot 2, but realized that if I did, I would get email from a student who happened to just luckily (or unluckily) produce snapshot 2. With hindsight, maybe I should have left it out, and only added it if a student produced snapshot 2 and asked me why. Good luck finishing Lab 5, and good luck on the final exam. Yale Patt