MEGA65 / mega65-core

MEGA65 FPGA core
Other
240 stars 85 forks source link

Implement a pseudo 16bits indexing register to ease large arrays lookup #605

Open paich64 opened 2 years ago

paich64 commented 2 years ago

The current 8bits registers (X,Y,Z) limit Arrays lookup to 256 elements. Workarounds exist, of course, but they are tedious to implement. Having a pseudo 16bits indexing register would dramatically help in such situations..

Basically, this pseudo 16bits indexing register would be based on Y & Z registers

Y would hold the array 8bits LSB offset Z would hold the array 8bits MSB offset And the lookup would be done this way :

ldy offset_lsb ldz offset_msb lda array,yz

Of course this would also require YZ pseudo register to be usable for 32-bit ZP indirect indexing, and additional opcodes such as INCYZ, DECYZ would be great to have.