Assignment 10, due Nov 10

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

Homework Due Nov 10

Do Chapter 11 Problems a, d, f, h, m, p.

Note, there will be no homework due Nov 17!

Machine Problem Due Nov 19

Consider an abstract class of objects called frames. A frame is a generalization of the screen interface offered by the Hawk monitor. In the Hawk monitor, we have one frame, the whole screen, with operations dspat(), dspch() and dspst that set coordinates, relative to the origin of the display screen, and that display data on the screen, relative to the current coordinates. For MP3, you extended this by making putch() handle control characters relative to the origin defined by the most recent call to putat().

The following methods should apply to objects of the class frame, where the variables f and f' are handles on frame objects:

frminit( f, f' x, y )
Initialize the frame f as having its origin at x and y relative to the existing (already initialized frame) f'. The next character displayed in f will be at the origin. If the handle f' is null (zero), the new frame will be created relative to the full display screen.

frmat( f, x, y )
Set the location in the frame f of the next character to be displayed in that frame; x and y are relative to the origin of that frame.

frmch( f, ch )
If the character ch is printable, display ch at the current location in the frame, and increment the x coordinate of the next character to display by one. If ch is CR, LF or HT, adjust the x and y coordinates appropriately. CR returns the x coordinate to the margin established by the origin of the current frame. LF advances the y coordinate of the current frame by one, and HT advances x to the next tab stop relative to the margin of the current frame.

frmst( f, s )
Call frmch( f, ch ) for the each successive character ch found in the string s, up to but not including the null marking the end of string.

Note that there is a strong connection between this frames package and MP3! Feel free to reuse code from your solution to MP3 or to borrow code from the posted solution! Also note that the notes on object oriented design in Chapter 10 are very important.

For maximum credit, do not use the Hawk monitor, but implement your frames directly on top of the Hawk display screen interface. In addition, you must include a main program that tests your frames package. As usual, honest disclosure of known bugs in your code will be worth more credit than undisclosed or undiscovered shortcomings!

Turn in a well commented assembly listing that makes appropriate use of titles, subtitles etc. This must be printed in landscape format, with the assembler's number of lines per page set to the number of lines that actually fit on a landscape-format page, and with the font and tabs set properly so that the listing is legible! Also turn in a screenshot of the result of your test!

The following demo shows how to assemble and print in landscape format from a Linux computer in room 301 MLH.

	smal -P 46 mp5.a
	lp -dp301 -o landscape mp5.a