CS 216 System Programming Languages

Assignment 2

Due Friday 16 February 2024

  1. Convert 1491 to binary, and to hexadecimal. (Hint: binary to hex is easier than decimal to hex)








  2. Here is a signed number. Is it negative? ______ Is it odd? ______
    Take its 2's complement, then tell me what the original number is (in decimal.)
    	0 x f f f f f e 7 d



  3. Add these pairs of signed numbers, then convert the answers to decimal. (Hint: should not be very large numbers.)

    	0 x f e 5 7 4 3 5 f			0 x 7 8 9 5 b c 9 5
    0 x 0 1 a 8 c 1 1 e 0 x 8 7 6 a 4 2 3 a


    (over)

  4. Here is a machine instruction involving the 3 registers $t1, $t5, $t7. Convert from hex to binary, then divide it into fields of 6,5,5,5,5, and 6 bits.  Please locate the 3 registers in the binary instruction.

    	0 x 0 1 a 9 7 8 2 2




  5. Using the tables on page 61, try to determine what instruction it is.  Hint: consider the two 6-bit fields.




  6. Again using page 61, convert this assembly instruction to binary, and then hex.
    Hints: $t6 is the "destination," rt. 24 will be represented as a 16-bit number.
    	lw $t6, 24($t0)