Assignment 2, due Sept 3

Part of the homework for 22C:60, Fall 2004
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. Repeat exercise k from chapter 2 for a total of 3 times. Show your work, including the conversion from decimal back to binary.

  2. Show each of your binary numbers from the previous problem in hexadecimal and in octal.

  3. Show the one's complement and two's complement of each of the binary numbers you used in the first problem.

  4. Explain why, if you use the following formula to evaluate the value of a number in an arbitrary base, using pencil and paper, you end up converting it to decimal, while if you write a computer program in a language such as C, C++ or Java, you end up converting the number to binary.
    i=digits(S)-1
    value(S) = v(S[i]) × ri (radix r)
    i = 0

  5. Once upon a time, several computer manufacturers built machines with 18-bit words. This was back in the era before two's complement arithmetic had become universally accepted for signed integer arithmetic, so some of these machines used one's complement arithmetic or signed magnitude representations. So for each signed number system mentioned above, what is the greatest positive integer and the most extreme negative integer.

    Give each answer to the above question in binary, unsigned octal, unsigned hexidecimal, and the conventional signed decimal representation.

  6. Give the 4 consecutive Hawk memory addresses starting at 0000,475B16, in hexadecimal, and identify which of these are legal byte addresses, legal halfword addresses, and legal word addresses.

  7. Give SMAL assembly code to assemble the null-terminated ASCII string "Several words of text" into the first locations of the Hawk RAM, with the next legal Hawk word in memory containing a count of the number of bytes in that string (including the terminating null byte).