In: Computer Science
| (16) Convert the following numbers into 8-bit hexadecimal values. | ||||
| Number | Binary | Complemented | Two's Complement | Hex |
| -102 | ||||
| -87 | ||||
| -31 | ||||
| (17) Add up the first two binary numbers from the previous problem in Two’s complement form. | ||||
| (17a) What is the sum in hex? | ||||
| (17b) What is the sign bit? | ||||
| (17c) Did overflow occur? | ||||
| (17d) Code this up in 68K and include a screenshot of the output here as well as your source & listing files. What happens? | ||||
Please show work!
If you can't do 17 d I understand, no worries!!!
| (16) Convert the following numbers into 8-bit hexadecimal values. | |||||
| Number | Binary | Complemented | Two's Complement | Hex | |
| -102 | -01100110 | 10011001 | 10011010 | -66 | |
| -87 | -01010111 | 10101000 | 10101001 | -57 | |
| -31 | -00011111 | 11100000 | 11100001 | -1F | |
|
(17) Add up the first two binary numbers from the previous problem in Two’s complement form. |
First Number: Second Number: Sum: |
|
|||
| (17a) What is the sum in hex? |
43 (In 2's complement) BD |
||||
| (17b) What is the sign bit? | 0 | ||||
| (17c) Did overflow occur? | Yes | ||||
Question 17:
Explanation:
The first Number in binary representation is: 01100110
The second Number in binary representation is: 01010111
After two's complement the numbers are:
First Number: 10011010
Second Number: 10101001
When we add two negative numbers and the carry will be generated from the sign bit will be discarded. The final sum will be the 2's complement of the magnitude bits fo the result in the binary format and sign will be negative.
Sum: 10011010 + 10101001 = 1 0100 0011
But this sum is in two's complement form.
Final sum is = - 01011 1101