Assignment 4, due Sept 21

Part of the homework for 22C:60, Fall 2007
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!

  1. Homework

  2. Background: Consider this sequence of values stored in memory:
    000000:  D101
    000002:  D202
    000004:  E300
    000006:  0003
    000008:  F4F1
    00000A:  14C3
    00000C:  F562
    00000E:  0003
    
    a) Convert the above code to well formed SMAL Hawk assembly code. Make sure that you set the assembly origin. You can check your result by assembling your code. The object code shown in the listing should match the above, but this is not a machine problem, a hand written solution, if correct and legible, will earn full credit. (1 point) b) What register does each instruciton above change, and what value does it put in that register. Include this information as comments in your assembly code given as an answer to part a. (1 point)

  3. Background: Consider this bit of SMAL code:
    	MACRO	CONFUSE =A, =B
    confuse	=	.
    .	=	.+4
    	W	A
    .	=	confuse
    	W	B
    .	=	.+4
    	ENDMAC
    
    .	=	#0100
    	CONFUSE	1,2
    	CONFUSE 3,4
    	END
    

    a) Show what this puts into consecutive words of memory locations starting at location 010016. Feel free to use the assembler to help you do this, but notice that the assembler output can be misleading! Look at the object code itself to see what the assembler actually did. (0.5 points)

    b) Explain what happened -- that is, how did the code manage to assemble data into memory out of its natural order. (0.5 points)