Two's Complement

Started by doomkaiber001, November 21, 2010, 09:05:33 PM

Previous topic - Next topic

dcx2

Bits are just bits.  By themselves, they have no meaning.  It is how you treat the bits that matters.

For instance, consider the 8-bit value 0x41.  In binary, this is 0100 0001.  If you treat this value as a signed integer, it is 65.  If you treat it as an unsigned integer, it is 65.  If you treat it as an ASCII character, it is the letter A.  It's as if 0x41 has multiple personalities!

Now consider the 8-bit value 0xFE.  In binary, this is 1111 1110.  If you treat it as a signed integer, it is -2.  If you treat it as unsigned, it is 254.  If you treat it as ASCII, you get garbage; ASCII only defines 0x00 through 0x7F.

doomkaiber001

Ok, what on earth is ASCII?

James0x57

It's one set (most common, I think..) of universal binary values for plain text characters. http://www.asciitable.com/
More info at google.


@dcx2
https://developer.mozilla.org/en/JavaScript_typed_arrays/ArrayBufferView
Sexy, right? JavaScript 2.0 ftw! haha


doomkaiber001

Are the symbols in red ASCII? Do I need to actually know about it to hack?

James0x57

No.

Unless you want to hack the text in the game.


doomkaiber001

Well, there's probably no use in that then... Ok, thanks for explaining everything to me!

benny3t3

Hacking the text in a game, that sounds cool. Maybe I'll look into that sometime...

megazig

Quote from: doomkaiber001 on November 22, 2010, 08:13:50 PM
Ok, I googled signed integers and found the following out;

10000000 could be a signed integer, because the bit on the far left (Sign Bit) is a one.

00000001 has to be a unsigned integer, because the sign bit is a zero.


So, how would you put a negative hex into a code using the Wiird GUI?

assuming binary notation
00000001 can be signed too, just that it's a positive signed char (+1)