*(Bnu only corrected it, but I have no other reference to name it)
That doc says about Relative addressing for branches that:
Code: Select all
The 1 byte number is treated as a signed number - i.e. if bit 7 is 1, the number
given byt bits 0-6 is negative; if bit 7 is 0, the number is positive. This
enables a branch displacement of up to 127 bytes in either direction.
eg bit no. 7 6 5 4 3 2 1 0 signed value unsigned value
value 1 0 1 0 0 1 1 1 -39 $A7
value 0 0 1 0 0 1 1 1 +39 $27The 6502 uses 2's complement for signed numbers, right?
I read other sources that only specify that the operand for relative addressing is treated as a signed number.
So how does Relative addressing actually work? as the doc says, or treating signed numbers as 2's complement?
Note to admins: If this has already been discussed, my apologies, I searched for Relative, Branch, BCC and didn't find this exact question.