Part of
the homework for 22C:60, Fall 2010
by
Douglas W. Jones
THE UNIVERSITY
OF IOWA
Department of Computer Science
a) 10101011110011012 to base 16
ABCD
b) 323300014 to base 16
EF01
c) 215058 to base 16
2345
d) 2650510 to base 16
6789
e) A8CA16 to base 10
43210
Hint: Some patterns should emerge to help you judge your answers.
The problem: Consider the value -123 (a negative decimal number). (1 point)
a) Convert it to a 12-bit signed magnitude binary number.
1000 0111 1011
b) Convert it to a 12-bit one's complement binary number.
1111 1000 0100
c) Convert it to a 12-bit two's complement binary number.
1111 1000 0101
d) Convert it to a 12-bit natural-biased binary number.
0111 1000 0101
e) Convert it to a 4-digit 10's complement decimal number.
9877
H 17767
B "#"
B 1
W 32#24QNJFF
Hint: You can use the SMAL assembler to help you with this, but you will need to finish the job of packing the result into 32-bit words by yourself. Also, as in problem 1, when you get it right, the result should be obviously right.
Here is the assembler output:
+000000: 4567 1 H 17767
+000002: 23 2 B "#"
+000003: 01 3 B 1
+000004: 89ABCDEF 4 W 32#24QNJFF
The above, packed into a sequence of 32-bit words, is:
000000: 01234567
000004: 89ABCDEF