Assignment 3, due Feb 6

Part of the homework for CS:2630, Spring 2015
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (usually Friday). Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!

  1. Background: Here is some code that can be assembled, linked and run with mp1test to produce some output. In this case, it is written to help you explore what it is that the assembler does:
            TITLE   "hw3.a by Douglas W. Jones, Jan. 29, 2015"
    ; -- another demo of the MP1 data structure
    
    NULL    =       0               ; declare the value used for NULL pointers
            INT     ARRAY           ; make ARRAY visible to the test program
    
    ARRAY:  W       ITEM1           ; array[0] points to the record ITEM1
            W       ITEM2           ; array[1] points to the record ITEM1
            W       NULL            ; array[2], a null pointer
    
    ; -- the records:
    
    ITEM1:  W       TEXT1           ; pointer to text
            H       8, 1            ; X = 8, Y = 1
    
    ITEM2:  W       TEXT2
            H       2, 1            ; X = 2, Y = 1
    
    TEXT1:  ASCII   "world", 0
    TEXT2:  B       83              ; *
            H       #7075           ; *
            W       -#FFFF8D9B      ; *
    
            END
    

    a) What are the values of the identifiers defined by this code (NULL, ARRAY, ITEM1, ITEM2, TEXT1 and TEXT2)? (1 point)

    b) Rewrite the 3 lines of code that are commented with stars to use an equivalent ASCII directive. (For full credit, make sure this directive assembles the correct number of bytes into memory; the obvious answer may fall short.) (1 point)

    c) Are any of the byte, halfword or word directives used in the above code non-aligned? If so, which ones? (0.5 points)

  2. A Problem: If the Hawk CPU fetches the value FEDC16 into the instruction register, what does it do in response -- that is, what instruction is it and what changes does it make to memory or registers in response? (0.5 points)