6 Give the 16bit 2s complement form of the following 8bit 2s
6. Give the 16-bit 2\'s complement form of the following 8-bit 2\'s complement numbers:
(a) OX94
(b) OXFF
(c) OX23
(d) OXBC
My understanding of this:
oxFF where F=15 and 15 = 1111 so 15 15 is 1111 1111 and then i thought that the 16 bit extension would either be 0000 0000 1111 1111 or 1111 1111 1111 1111 but I am not sure. Can you clarify this for me? Thank you.
Solution
In 2\'s complement form, MSB represents sign bit. If MSB is 0 then number is +ve and if MSB is 1 then number is -ve.
While changing number from 8 bit to 16-bit, if MSB is 1 then the all new 8 bits are 1 and if MSB is 0 then all new bits will be 0.
Now,
a.) 0x94 = 1001 0100
since MSB is 1 therefore the all new 8 bits are 1, now number is 1111 1111 1001 0100 which is 0xFF94.
b.) 0xFF = 1111 1111
since MSB is 1 therefore the all new 8 bits are 1, now number is 1111 1111 1111 1111 which is 0xFFFF.
c.) 0x23 = 0010 0011
since MSB is 0 therefore the all new 8 bits are 0, now number is 0000 0000 0010 0011 which is 0x0023
d.) 0xBC = 1011 1100
since MSB is 1 then the all new 8 bits are 1, now number is 1111 1111 1011 1100 which is 0xFFBC.
Hope it helps, do give your response.

