Assignment 5, due Sept. 25
Part of
the homework for 22C:60, Fall 2009
|
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!
A problem: Take the framework of an empty SMAL Hawk program and fill in code to make it plot an asterisk as close to the center of the available output area as you can. Turn in clean readable source code with appropriate comments. (1.2 points)
Note. You need not run the above code, and if it is correct and readable, you could get full credit for a handwritten submission. You may opt to use the computer to check your syntax and to see how your code works. If you do, note that you can resize the terminal window before you start the Hawk emulator, and it will work in that new size, but you should not resize the window while the emulator is running.
USE "hawk.macs" S START . = #10000 START: LEA R1,NEXT LOADS R2,R1 ADDSI R1,4 NEXT: STORES R2,R1 ADDSI R1,4
a) What value does this program load in R2 and what does this value represent? (0.4 points)
b) Where does the STORES instruction store this value? (0.4 points)
c) What does this program do? (0.4 points)
Hint: You can actually use the Hawk emulator to help you with this, but you will do better in the long run if you try to figure out the code using only manuals and then use the emulator to check your understanding.