The Console class simulates the behavior of a character-oriented CRT device. The interrupt handler presumably checks if more characters are waiting to be output, invoking PutChar again if appropriate. The constructor creates an instance of a terminal console. When a character becomes available for reading, readAvail is invoked with an argument of callArg to notify the Nachos that a character is available. Upon return, it is assumed that the character has been retrieved and when the next one arrives, readAvail will be called again.
Writes character ch to the output device.
Once the console device has written the character to the device, it invokes the user-supplied procedure writeDone , passing it callArg as an argument. GetChar returns EOF if no new data is available. When the timer expires, the routine CheckCharAvail is invoked to see if any data is present. If so, CheckCharAvail reads that character and invokes the user-supplied input interrupt handler readAvail. It then schedules a new timer event so that the process repeats every 100 time units.