Here's a primer on two's complement.Basically, there are many possible ways to represent negative numbers using only bits. Two's complement has a special property that the curcuits for adding and subtracting are the same for signed numbers and unsigned numbers, which makes things easier, so most computers use it.
If we to consider a hypothetical 4 bit two's complement system, which covers -8 to 7, the numbers would be represented like this:
0000: $0: 0
0001: $1: 1
0010: $2: 2
0011: $3: 3
0100: $4: 4
0101: $5: 5
0110: $6: 6
0111: $7: 7
1000: $8: -8
1001: $9: -7
1010: $A: -6
1011: $B: -5
1100: $C: -4
1101: $D: -3
1110: $D: -2
1111: $F: -1
Notice that at the half-way point, the numbers wrap from the highest possible (7) to the lowest possible (-8).
To prove that addition is the same, let's try adding 5 and -1, which should give us 4.
Here are the bit representations. You can add them just like in decimal, but remember if the number is 2 or 3, you need to carry the 1 to the next place.
Code:
0101
+ 1111
----------
(1)0100
Remember, these are 4 bit numbers, so we only keep the lower 4 bits. We're left with 0100, which, as we wanted, is equal to 4.
If we extend this to 8 bit numbers, as on the 6502, we get a similar table of values:
0000 0000: $00: 0
0000 0001: $01: 1
...
0111 1111: $7F: 127
1000 0000: $80: -128
1000 0001: $81: -127
...
1111 1110: $FE: -2
1111 1111: $FF: -1
Each group of 4 bits can be represented as a hex digit.