Runic_Rain wrote:
I'm digesting this, haven't used PEA yet and my callbacks are 16-bit I think, although I may have done that part wrong...
Hmm, it's also possible I've misunderstood your overall intent. But focusing just on the
JML (JumpTable, X) instruction you wanted, here are some suggested replacements. They require that each entry in the table will point to (desired destination)-1.
This version destroys A ...
Code:
LDA JumpTable+1, X ;get the mid and high bytes of the 24-bit address.
PHA ;push the mid and high bytes to stack
LDA JumpTable, X ;get the low byte and re-get the mid byte
PHK ;this push is only to subtract 1 from S
STA 1,S ;write the low byte and re-write the mid byte
RTL ;"Return" instruction used as a Jump
... but to preserve A you can precede the above with a PHA and require that each of the code sequences jumped to via the table must do its own PLA.
This way preserves A somewhat more slowly, but omits the need for a PLA at every jump target.
Code:
PHK ;this push is only to subtract 1 from S
PHA ;this push is only to subtract 2 from S
PHA ;this push is for actually saving A
LDA JumpTable+1, X ;get the mid and high bytes of the 24-bit address
STA 4,S ;write the mid and high bytes to stack
LDA JumpTable, X ;get the low byte and re-get the mid byte
STA 3,S ;write the low byte and re-write the mid byte
PLA ;restore A
RTL ;"Return" instruction used as a Jump
_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html