Assignment 3, due Sept 17
Part of
the homework for 22C:60, Fall 2007
|
Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! All assignments will be due at the start of class on the day indicated (usually a Friday). The only exceptions to this rule will be by advance arrangement unless there is what insurance companies call "an act of God" - something outside your control. Homework must be turned in on paper and in class! Late work may be turned in to the teaching assistant's mailbox, but see the late work policy. Never push late work under someone's door!
To run a program through the SMAL assembler, you will have to edit the file .cshrc in your home directory on the lab machines. You can use any text editor on these machines. Change the file so it looks like this:
# KEEP THESE TWO LINES FIRST !! source /etc/CSHRC # Add personal Customizations here. alias smal ~dwjones/smalstuff/smal32.intel -U ~dwjones/hawk alias link ~dwjones/hawk/link alias hawk ~dwjones/hawk/hawk.intel
The last 3 lines above, starting with the word alias are the lines you will need to add. After doing this, log out and back in again in order to activate the smal, link and hawk commands.
To print SMAL assembly listing files in room 301 MLH, lp -o landscape FILENAME seems to work well, substituting the appropriate file name. There are a myriad of ways to copy files from the lab machines to a remote machine, and an even greater myriad of ways to print them remotely. In general, try for printing in a fixed font in landscape format.
A Problem: Login on a Division of Mathematical Sciences machine in room 301 or remotely at linux.cs.uiowa.edu, and then follow the directions above for activating the tools we will need in this course. Having done that, create a file called HW3.a containing the text of the meaningless example from the figure in Chapter 3 entitled Rewriting the example for improved readability. Make one change to this: Change the title from A meaningless example to your name.
Assemble your file HW3.a using the smal HW3.a command. This will produce a listing file called HW3.l. HW3.l is an unformatted text file. Print it out legibly and turn in the printout. (1 point)
a) What alignment problems does this cause? (1/2 point)
b) Insert the appropriate ALIGN directives to solve these alignment problems, assemble the result, and turn in the assembly listing as above. (1/2 point)