Page 1 of 1

6502 Data Bus: Signed or Unsigned? That is the question...

Posted: Fri May 21, 2004 8:46 pm
by andrewem
This may sound like a really stupid question to diehard hardware buffs: is the Data Bus in the 6502 signed? or unsigned?

Initially, I thought it was unsigned (please... don't ask why), but now I'm pretty sure it's signed because of something I noticed with the Relative addressing mode and how can it be both right?

:oops:

Posted: Fri May 21, 2004 8:58 pm
by GARTHWILSON
Whether it's signed or not is mostly a matter of how the data are interpreted.

Relative addressing is indeed signed so that you can branch half a page in either direction, regardless of where you are relative to an actual page boundary.

In the case of indexing, the only time it goes backwards is if there's a wraparound at the end of zero page or at the end of memory. Otherwise indexing always goes forward only-- no negative numbers there.

In arithmetic, it can be signed or unsigned. The processor doesn't have to know which way you intend it, because it's all a matter of how you interpret the results.