Assignment 3, due Feb 11

Part of the homework for 22C:60, Spring 2005
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, and unless there is what insurance companies call "an act of God" - something outside your control; the only exceptions to this rule will be by advance arrangement.

  1. Suppose the Hawk memory contains the following sequence of halfwords:
    	001000: E465
    	001002: 4321
    	001004: D512
    	001006: 3645
    

    a) "Disassemble" this, that is, express the same program fragment in SMAL Hawk assembly language instead of in hexadecimal.

    b) If the Hawk computer begins executing code at location 100016 and is stopped after completing the execution of the above fragment, what values are now stored in each register?

  2. Suppose you wanted to increment R3 by a constant. What is the best choice of instruction or sequence of instructions to use for each of the following constants:

    a) 1
    b) 10
    c) 100
    d) 10000 -- express all of your answers in assembly language, not binary.
    e) 100000000

  3. Suppose you wanted to load a constant into R3 What is the best choice of instruction to use for each of the following constants:

    a) 1
    b) 10
    c) 100
    d) 10000 -- express all of your answers in assembly language, not binary.
    e) 100000000

  4. Write a macro called EXCHANGE that will exchange the contents of two registers. If you need an extra register, your macro can assume that R1 is available for use to hold intermediate results. If you wrote this, it would exchange R4 and R5.
    	EXCHANGE R4,R5