Assignment 11, due November 11

Part of the homework for 22C:60, Fall 2005
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

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!

  1. Consider a machine with many character sequential input devices. One of these is the keyboard, as described in chapter 11 of the notes. The machine has serial ports at addresses FF10000016, FF10001016, FF10002016 and FF10003016. It also has many other types of devices, the details of which you don't need to know.

    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)

  2. From Chapter 11 of the notes, do exercises c), f), g), j) and r). (1/5 point each)