Machine Problem 4, due October 25

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

Submit the source file mp4.a for your solution using the submit command, documented at:
-- http://www.divms.uiowa.edu/help/msstart/submit.html

The Problem

The file mp4data.o defines the external symbol DATA. This symbol is the address of a single null-terminated character string. Consecutive characters in this string are commands to your program. Each command is one character long:

z -- home: x = y = 0 u -- move up one step: y = y - 1
d -- move down one step: y = y + 1
l -- move left one step: x = x - 1
r -- move right one step: x = x + 1
( -- save x and y on the stack.
) -- recover the saved values of x and y from the stack.
null -- stop.
all others -- print the character at screen location <x,y>.

Recall, of course, that the origin of the Hawk display, <0,0> is at the upper left corner of the screen, so moving down is done by incrementing y. Note, for this assignment, you are not required to use recursion, but there is a recursive implementation of the parenthesis commands that both makes sense and will help you in the next machine problem.

Write a program that interprets the above language and carries out the sequence of commands in the string. You will need to include the directive EXT DATA in your program and link your code to the data using link mp4.o mp4data.o as with the test program for Machine Problem 1, given in the solutions to Homework 6.

Grading Critereia