The following values are given:
x db 128;a db -128 and for y will be the same value like x only dw, b the same like y only -128 and for z dd and c dd -128. Show which are the representations of x,a,y,b,z,c in base 2 and 16 (sign and unsigned). Explain why. And look about what I've done:
I have done this:
(128)in base 2 = 10000000(i have used . to view better)
(-128)in base 2 db = also with 10000000
dw: 128 in base 2 = 0000000001000000
128 is = 1111111111000000
dd : 128 in base 2 = 00000000000000000000000001000000
128 in base 2 = 11111111111111111111111111000000
It is good how I resolve? And here it comes to problem. I didn't know how to transform in base 16 all of numbers sign and unsigned, db, dw and dd. Some ideas?
That's not correct. The 16-bit number 128 would be
0000000010000000
. If you meant -128 then that would be1111111110000000
(note that there's one1
less than in your version).Just take your binary representations and map each group of four bits to a hexadecimal digit:
So for example,
10000000
equals0x80
,01111111
equals0x7F
, and so on.