Assignment 2, due Sept. 4

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!

Note, because the text may not yet be available at Zephyr photocopies, you will have to rely on the Internet version of the class notes for this assignment:
-- http://homepage.cs.uiowa.edu/~dwjones/assem/notes/

Problems

  1. Assume your printing device uses the SO and SI control characters to switch from black ink to red. Give the SMAL code to assemble the following text into memory:
        This is a Red Letter day!
    where the words "Red Letter" are printed in red and the string is terminated by a CR followed by an LF. (0.5 points)

  2. Flip a coin 24 times or use any other random process to produce 24 consecutive random bits. Write them down from left to right in two groups of 12 bits.

    a) Treat each group as a 12 bit integer and convert it to decimal. (you should check your work by conversion back to binary.) (0.4 points)

    b) Show each binary number you created for the above problem in octal and in hexadecimal. (0.4 points)

    c) Add the two 12-bit binary numbers you created, showing your work. (you should convert the sum to decimal so you can check the result.) (0.4 points)

    d) Take the two 12-bit binary numbers you created and interpret them as numbers in the 12-bit two's complement number system. Because they are random, each has a 50-50 chance of being negative. Give the signed decimal interpretation of each number, then take their two's complements and give the signed decimal interpretation of their complements. (0.4 points)

  3. Assemble the following SMAL code as it would be loaded into the Hawk memory:
              W       #E3882088
              B       #14, #51
              H       #4444
              H       #8A3E, #4442
              W       #E3810441
    
    Write down the results as 4 consecutive words in binary, with both rows and columns of bits neatly aligned in tabular form. If you get it right, a pattern will emerge that spells a message. (0.8 point)

  4. Get the SMAL assembler to process the above example, print out the assembly listing, and turn it in. This counts as preparation for the first real machine problem. (0.1 point)