Machine Problem 3, due October 10
Part of
the homework for 22C:60, Fall 2005
|
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:
+--+ | | +--+ |
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.
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:
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.