Machine Problem 3, due October 10

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

Assignment:

Write code for the SHOWITEM routine that you called in your solutionm to machine problem 2. Your program will now consist of a main program that calls SHOWITEM, plus the subroutine itself.

The SHOWITEM routine itself will have to read the X, Y, WIDTH, HEIGHT and TEXT fields of each item. The following routines will be useful in actually displaying the item:

PLOTROW plots one row of an item on the sceen
R3 -- the X coordinate of the start of the row
R4 -- the Y coordinate of the start of the row
R5 -- the length of the row
R6 -- the character used at each end of the row
R7 -- the character used to fill out the row

+--+
|  |
+--+
For example, to print the box to the right, You would make a call to plotrow(x,y,3,'+','-') for the top row, a call to plotrow(x,y,3,'|',' ') for the middle row, and a call to plotrow(x,y,3,'+','-') for the bottom row.

PLOTSTR plots one string on the sceen
R3 -- the X coordinate of the start of the string
R4 -- the Y coordinate of the start of the string
R5 -- pointer to the string, must not be NULL!

Calling plotstr(x,y,s) is like calling dspat(x,y) followed by dspst(s) except that the x coordinate establishes a margin for CR and LF is interpreted as moving down a line.

The file http://homepage.cs.uiowa.edu/~dwjones/assem/hw/mp3test.txt contains the Hawk object code for the above two routines. The file http://homepage.cs.uiowa.edu/~dwjones/assem/hw/mp3.txt contains SMAL Hawk source for a skeleton that minimally demonstrates calls to the above two routines. You will still need to link your object code to some solution to machine problem 1 to run it, and it only works for items that contain text because the skeleton doesn't test for a null pointer in the text field of an item.

Note: all routines use the standard Hawk linkage conventions; R1 contains the return address, R2 contains the stack pointer, R8 to R15 are unchanged, but R3 to R7 may be changed. You can assemble link and test things as you did for the previous machine problems.

Additional Requirements:

In addition to code that runs as assigned, you are responsible for producing readable code! Clean use of indenting, and appropriate comments that explain anything slightly subtle are required! Your solution must also conform to the following specific details:

  1. The file must be named mp3.a.
  2. It must begin with a TITLE directive saying MP3 followed by your name as it appears on your university ID card.

Use the submit command on the departmental linux cluster to submit your solution. Your complete submit dialogue will look just like the dialogue illustrated on the handout for machine problem 1, except that your choice will be mp3 and your file will be mp3.a.

Your program will be assembled and the result linked to our test data. If the output is right when we run it, you will get half credit. The other half of the credit will be assigned based on the quality of your source file. The listing file will be printed by the TA and marked up.