Assignment 2, due Jun 14

Part of the homework for CS:2630, Summer 2018
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 (Tuesday or Thursday). 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: Run the ~dwjones/2630install script as directed in the Getting Started handout. Create a text file on your computer holding the following and assemble it with the smal assembler:
            USE     "hawk.h"
            USE     "ascii.h"
    A:      ASCII   "This", NUL
    B:
            ALIGN   4
    C:      H       'T' + ('h' << 8)
            H       'a' + ('t' << 8)
            B       0
    .       =       . + 3        
    D:      W       A, B, C, D
            END
    

    a) What are the values of the symbolic labels A, B, C, and D. (You can get these from the assembly listing file) (0.4 points)

    b) What memory locations end up holding the values of the symbolic labels A, B, C, and D. (You can get these from the assembly listing too) (0.4 points)

    c) If the data starting at label C is interpreted as a null-terminated character string on a bigendian computer, what is the string? (0.4 points)

    d) If the data starting at label C is interpreted as a null-terminated character string on a littleendian computer, what is the string? (0.4 points)

    e) What is the value of the location counter at the end of the file. (0.3 points)

    f) Try deleting the reference to the header file ascii.h to see what becomes undefined when you assemble your file. Based on the result of this experiment, which symbol or symbols used in the above code came from ascii.h. (0.3 points)

    g) How many bytes in memory did the ALIGN directive skip over and leave uninitialized? (0.3 points)

    h) One line of this file assigns to the location counter. Give an equivalent ALIGN directive. (0.3 points)

    g) Which lines in the file did not assemble anything into memory. Give your answer as a list of line numbers from the source file. You can find these in the assembly listing. (0.2 points)