Assignment 10, due Nov 5

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

Always write your name legibly as it appears on your University ID and on the class list!

Homework

  1. Background: In the 1960's, some computer vendors came out with computers with a 24-bit word. Here is a typical floating point format for such a machine:
    |23|22_21_20_19_18_17_16|15_14_13_12_11_10__9__8__7__6__5__4__3__2__1__0|
    |__|____________________|_______________________________________________|
      s       exponent                          mantissa
    
    s
    The sign of the mantissa.
    exponent
    a 7-bit natural biased binary exponent.
    mantissa
    a 16-bit magnitude for the mantissa (which, as a whole, can be treated as a 17-bit signed-magnitude number, with the exponent between the sign and magnitude). The range of possible values represented by the mantissa m is 0<m<1.0. The range of values represented by normalized mantissas is 0.5<m<1.0.

    a) Give the representation for 1.0 in this number system. (0.5 points)

    b) Give the representatin and equivalent decimal value of the smallest normalized number in this number system. (0.5 points)

    c) Give the representatin and equivalent decimal value of the smallest non-normalized non-zero number in this number system. (0.5 points)

    d) Given a floating point number in the format from problem 1 in the least-significant 24 bits of R3, write a sequence of instructions (not a subroutine, just a sequence of instructions) that computes the 2's complement integer exponent in R4 and the 2's complement binary fraction in R3. The point for this fraction should be just to the right of the sign bit. Use R4 and R5 if you need to use extra registers. (0.5 points)

  2. Background A Centronics printer interface (the standard printer designed to plug into the old IBM PC parallel port) has the following wires. Wire numbers correspond to pin numbers on the 25 pin printer plug:

    1) Strobe
    Output, normally 1, set to 0 indicates data to print.
    2-9) Data
    Output, a character to print when Strobe=0, data must not change except when Strobe=1 and Ack=0.
    10) Ack
    Input, normally 0, set to 1 to indicate that the device has noticed the strobe, set back to zero to indicate that the device has successfully taken a copy of the data.
    11) Busy
    Input, normally 1, set to 0 to indicate that the device is busy and cannot accept output.
    12) Paper-Out
    Input, normally 0, set to 1 when there is no paper.
    13) Select
    Input, 0 when the printer is off, set to 1 when the printer is on.
    14) Linefeed
    Output, 1 normally, a 1 to 0 transition causes a paper advance.
    15) Error
    Input, 0 normally, 1 indicates something wrong with the printer.
    16) Reset
    Output, 0 normally, set to 1 to reset the printer.
    17) Select printer
    Output, 0 forces the printer to ignore everything, 1 enables the printer.

    Assume the following I/O registers on the HAWK parallel port, which is designed to be far more general than the old Centronics standard:

    FF100020
    Printer port data. Bit i of the data register is connected to pin i of the printer port socket. Each bit may be configured as an input or an output bit. Write operations to the data register change the output only if wires are configured as output. Read operations from the data register report the current values on all wires.

    FF100024
    Printer port control. Bit i of the control register determines whether bit i of the data register is an input bit or an output bit. Zero indicates input, one indicates output.

    a) When the Hawk system is powered up, the printer port control register is set to all zero, by the hardware. When the printer driver runs its initialization code, what values should it place in the printer port data and control registers assuming that you are trying to maintain compatibility with the old Centronics standard? (0.5 points)

    b) Write a subroutine to output one character to a Centronics compatible printer. It will need to wait for the printer (several inputs from the printer must have specific values before an output cycle begins), then put the data into specific bits of the data register, and then manipulate one or more additional output bits while observing the printer's response. (0.5 points)