Assignment 11, due November 11
Part of
the homework for 22C:60, Fall 2005
|
Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! All assignments will be due at the start of class on the day indicated, and unless there is what insurance companies call "an act of God" - something outside your control; the only exceptions to this rule will be by advance arrangement.
Notice: Midterm II is Nov 16, 2005!
If d is a character sequential device, it supports the four methods illustrated here: d.put(ch), ch=d.get(), d.close(), and if(d.eof()). Calling an unimplemented method for some device will raise an exception (for example, you cannot put data out to the keyboard).
a) Write the code for sequential_device.h allowing assembly language access to these methods of our polymorphic sequential device class. Use an implementation that allows fast calls to methods of a device, even if this means that representation of device objects takes extra memory. (1/2 point)
b) Write code for serial_port.h giving the particulars of serial port devices, including a macro to statically initialize a serial device object. Your code should be compatible with your solution to part a. (1/2 point)
Hint The following macro call would create the default keyboard port:
KBD: SERIALPORT #FF100000
c) Write partial code for serial_port.a giving complete code for the get() method, compatable with your solution to parts a and b. Give all definitions on which this code depends. You may use the algorithm of KBDGET from the notes, modified as needed to support the object oriented framework. (1/2 point)