I'm making a 6502 emulator (and after that I'll emulate the other NES components around it to have a fully functional NES emulator) and I came across the branch-on-condition instruction (relative). Now, what I'm wondering about is, is the byte considered to be saved as two's complement, or as a regular negative byte? Here's what I mean:
In one of the 6502 documents (unofficial of course) it gives this example:
BEQ $A7 ;Branch-on-equal with value 0xA7
$F0 $A7 ;Translation into hex
In the document, it says that 0xA7 should be taken as -39, and is represented like this:
1 0 1 0 0 1 1 1 ;-39 dec
If the 7th bith (starting from 0) would be a 0, it would just be 39:
0 0 1 0 0 1 1 1 ;39 dec
I'm wondering, is this document correct, or am I supposed to be using two's complement, meaning that:
1 0 1 0 0 1 1 1
would actually be -89?
I'm asking this because I'm programming the emulator in Java, and bytes are interpreted in two's complement, and I've been seeing it that way in a lot of instructions, and now I'm being struck with confusion.