Machine Problem 1, due September 24

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

Concept:

The Hawk machine has rather limited tools for graphics. It can only display text from the ISO-7 character set (ASCII) on the screen. We can, however, still construct graphics like this:

 |||||||||||||||||||||||||||||||||||||||||||||||||||||||  
-    +---------------+         +-----+   +              -
-    |               |         | X   | +---------+      -
-    |  +-------------------+  |  Y  |   |              -
-    +--| Words to live by? |  |   Z |   |    +         -
-       +-------------------+  +-----+   +              -
 ||||||||||||||||||||||||||||||||||||||||||||||||||||||| 

The above example contains 6 graphical objects, two of which contain text. One contains the string "Words to live by?", while another contains the string "X[CR][LF][SP]Y[CR][LF][SP][SP]Z" (where square brackets have been used to delimit names of nonprinting characters). The dashes given around the edge of the image are not part of the display, but are there to help you find the coordinates of the objects shown.

Each graphical object can be described by the coordinates of its upper left corner. In the example above, for example, the upper left box has its upper left corner in row 0 column 4. Each object has a height and a width. The three rightmost objects are degenerate, with either a height or width of zero (one of them has both height and width zero). The leftmost object has height 3 and width 16. When objects overlap, the last object displayed will blot out what was there before.

A screenful of these graphical objects can be represented as a linked list of records where each record has the following form:

NEXT
X
Y
WIDTH
HEIGHT
TEXT
pointer to next graphical object
X coordinate of upper left corner
Y coordinate of upper left corner
Width of this object
Height of this object
pointer to null-terminated string of text for this object

Each record is a contiguous block of memory 6 words long. Each record is must be word-aligned. Each record field should be represented as a 32-bit word. Records are displayed starting at the head of the list and continuing to the end, so the rightmost object in the example must not have been the first item in the list. If there is no text in the object, the TEXT pointer must be null. Null pointers are represented by zero. Non-null pointers hold the memory address of the first byte of the object that they point to.

The Assignment

Write a file of SMAL assembly code that builds this data structure for the example display screen shown above. Your file should conform to the following requirements:

  1. The file must be named mp1.a.

  2. It must begin with a TITLE directive saying MP1 followed by your name as it appears on your university ID card.

  3. The file must contain the line INT ITEM1 right after the title.

  4. The first item in your linked list must have the label ITEM1.

  5. The referent of each pointer must be labeled and the label should be used for the reference.

  6. Blank lines, indenting and appropriate comments should be used in order to maximize readability.

You will want to run the SMAL assembler to check that your file is syntactically correct and to see that the appropriate values go into memory in the appropriate way. Submission instructions will be given at a later date.

Grading

Your program will be assembled and the result linked to a program that traverses the data structure you have built and displays the requisite information on the screen. If the output is right, you will get half credit. The other half of the credit will be assigned based on the quality of your source file (see the list of requirements for the assignment).