Spring 2005
Lab 14 - Interrupts


For this lab, you supply code for a simplified interrupt-driven output facility. This will help solidify your understanding of interrupts and clarify your current project.


Check out the code in ~cs61c/labs/lab14/interrupts.s. It is critical that you understand this code before proceeding. Here is basically what is going on. The first thing in the file is the usual __start routine. This routine is just an infinite loop that prints out a string of text. The interesting part of this lab is how the print routine works. All it does is transfer characters from the input string that was passed from the caller to the output buffer as long as there is space in the output buffer. If there is no space, the routine simply waits until space appears. This works because an interrupt will occur when the terminal's ready bit goes high and the interrupt service routine will clear space in the output buffer. The interrupt service routine is what you need to write. Programming interrupt service routines is more challenging then programming typical user programs. One reason for this is that the code is not executed in sequence; it is executed based on events. For some pointers on programming interrupt service routines, see the Pointers section below. Otherwise, here are the checkoffs for this week: