0

I am a little bit confused in converting -17 into hex. I know that 17 in hex is 11h but answer is in weird form. -17= 17=11h

Answer is 0ffefh. I don't understand how this is done. can anyone show me the steps thanks.

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
ngoche
  • 65
  • 2
  • 8

1 Answers1

0

I don't think the question has anything to do with masm. Just a little dealing with binary numbers.

Since, you've already arrived at 17 = 11H, let's proceed from there. Following 2's complement scheme/representation, 11H is 0001 0001B (just taking one byte). Since the first 8 bits are all 0s, they'll result in FF after we're done.

0001 0001B give you on complementing every bit -> 1110 1110B. Adding one to this result will yield: 1110 1111B which in hexadecimal is EF.

Thus, the 2 byte representation becomes 0xFFEFH

hjpotter92
  • 78,589
  • 36
  • 144
  • 183