GaBuZoMeu:
In relation to this new addressing mode, would ((zp),X),Y be okay if X and Y are 16 bits, or BuGaGa bits, wide.
I certainly agree the factor of two is warranted if X and Y are both 8-bit index registers. When X or Y is a 16-bit register, then the addressing mode is better thought of as base + offset. The base is in the register and the offset is in the instruction. I assume from the answer above, if X is a 16-bit register, the factor of 2 is not required on the inner post-indexed (by X) indirect read.
I realized that extending the X and Y registers to 16-bits changed the effect of the index registers in the indexed addressing modes of the 6502/65C02. For example,
zp,X,
(zp,X),
abs,X, and
(abs,X) could be used to support base pointer relative addressing of variables on the stack. If X is assigned the value of the stack pointer immediately after entry into a subroutine, it functions as a base pointer providing easy access to the parameters passed to the subroutine with positive offsets, and the local variables of the subroutine with negative offsets. These offsets are fixed and easily calculated by a compiler or assembler. With a 16-bit index register, the pre-indexed (by X) addressing modes of the 6502/65C02 become quite powerful, and I expect, require significantly less programming effort to manage split stack push and pop operations as discussed by 6502/65C02 FORTH programmers to improve performance. Even the post-indexed by Y addressing modes are affected positively by extending the Y register to 16 bits.
For stack pointer relative addressing, the X and S registers (S is also extended to 16-bits) are swapped using a prefix instruction in my extended 65C02-compatible core. S could be copied to X using
TSX, and Y used as the base pointer, but given the dynamic nature of expression evaluation stacks for which built-in stack pointer relative addressing is almost required, I felt that it would be more natural to swap the S and X registers using a prefix instruction. (Note: Without the siz prefix instruction
TSX only transfers the least significant 8-bits of S to X. For transparent compatibility with 6502/65C02 code, an 8-bit transfer from X to S using
TXS automatically sets the system stack to page 1 where it normally resides. When the system stack is in page 1, the stack size is automatically limited to 256 bytes. If S is set outside of page 1 (or page 0) using a 16-bit transfer, the stack is limited only by available memory.)
The 6502 overcomes the limitations of its 8-bit index registers by providing more powerful addressing modes. The 16-bit index register of the 6800 processor provides that processor some advantage over the 6502/65C02, but having a limited number of addressing modes limits the utility of its 16-bit index register. The 6809 with two 16-bit index registers is a tough competitor. As Brad Rodriguez, Camel FORTH developer, demonstrated in his "Starting FORTH" series of articles. the 16-bit index registers of the 6809 enable a very efficient FORTH VM.