posted 23 years ago
You need to understand 2's complement and binary to decimal conversion. To get the value of a negative number, you need to get the 2's complement.
example:
To get the 2's complement of a binary number, flip all the bits and add one. So, the 2's complement of 0xFFFF (all one's) is 0x0000 + 1 = 0x0001 which is 1 in decimal. So, 0xFFFF = -1 in decimal.
Hope that was understandable. Maybe someone can explain it better.