I was reading through the tutorial on ASM hacking earlier. Midway through it gives an example of converting hex values like 0xFFB2 (this is the particular example I am trying to work the math on) to decimal. I understand that part, but I don't understand the process of converting it to a signed value. The unsigned values comes out to 65,458, and it says the signed value is -78. If anyone could help me understand the math behind this I would greatly appreciate it.
That's a good tutorial to start with, since barely anyone ASM hacks. I was looking through that about a month ago. I'm sure Zodiac could help, if you PM him. Also, senitalBlade is very good with this stuff.
"Welcome to ffhacktics, were all your dreams come true!"
The number is 0x8000+, so it will be negative.
subtract the whole number from 0x10000, which is basically the total number of values a half-word can hold
0x10000 - 0xFFB2 = 0x4E = 78
and since we know it's signed, -78.
Thank you for the replies. I'm still a bit lost though. I see how..
0xFFB2 =
0x0F = 16^3 * 15 = 61,440
0x0F = 16^2 * 15 = 3,840
0x0B = 16^1 * 11 = 176
0x02 = 16^0 * 2 = 2
61,440 + 3,840 + 176 + 2 = 65,458
I just don't understand the process of converting it to a signed number.