Hi,
the NES uses a derivate of the popular MOS6502 processor. I have two questions concerning this CPU in general:
1. Sometimes an instruction needs more cycles, when a page is crossed (the 16 bit argument goes over 0xff). By example instruction 0x59 (EOR, Absolute Y addressing mode) is such an instruction. Could you explain the reason of this to me?
2. Why are the zero page addressing modes useful?
Merry Christmas,
mrhyde
I am no expert, but I guess the first one is because there is only one 8 bit ALU, and therefore all additions have to pass through that ALU. If the sum of the lower byte of the base address and the index is $100 or larger, then it sums one (the carry) to the upper byte. If it is smaller, it skips that addition, speeding up the execution.
The second one is pretty obvious: there are two reasons: smaller code and faster execution, as instructions whose target is the zero page don't store the upper byte of the address; and because some addressing modes (like indirect indexed, ie "LDA ($00),y") expect a pair of bytes in page zero.
1. It only has an 8-bit adder for address calculations, so it adds the low byte to the index first and then does the operation for that address. Then if there was a carry and it needs to adjust the high byte, it does so and does the operation again. In many cases there isn't a carry so no second step is needed.
2. Zero-page addressing modes support more indirection, reading a two-byte address from zero-page and optionally indexing off that to find the byte somewhere in memory. The simpler zero-page modes are faster than absolute, another reason they're used.
People sometimes describe the 6502 as a CPU which you have to program in microcode but with 259 registers. The zero-page locations are not just an abbreviated form of full addressing.