• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
April 28, 2024, 02:47:13 am

News:

Please use .png instead of .bmp when uploading unfinished sprites to the forum!


Hexadecimal question

Started by Hood, October 12, 2010, 05:50:49 pm

Hood

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.

ffta707

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!"

Xifanie

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.
  • Modding version: PSX
Love what you're seeing? https://supportus.ffhacktics.com/ 💜 it's really appreciated

Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful

Hood

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.