Assignment 5, due Sept. 25

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

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!

Problems

  1. Background: The DSPINI Hawk monitor routine does more than initialize the display, it also returns the height and width of the available output area. DSPAT sets the output display coordinates of the next character to output. DSPCH can be used to output a single character. The instruction SR dst,1 divides an integer in the dst register by 2.

    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.

  2. Background: Consider this comment-free SMAL Hawk program:
    		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.

  3. A problem: Given an unknown signed integer value in R1 write SMAL Hawk code set R2 to the absolute value of whatever is in R1, given that the value in R1 should be interpreted as a signed integer. (0.6 points)