Dropping this here in case anyone is wondering about how the 65816 has no TAB or TBA instruction. I figured this was a good opportunity to learn how to create synthetic instructions/macros. This is what I came up with:
Code:
; TAB (13 cycles)
;nvmxdizc
SEP #%00100000
TAX
XBA
TXA
REP #%00100000
;Non index-clobbering TAB (16 cycles):
;nvmxdizc
SEP #%00100000
PHA
XBA
PLA
REP #%00100000
;TBA (16 cycles)
;nvmxdizc
SEP #%00100000
XBA
TAX
XBA
TXA
REP #%00100000
;Non index-clobbering TBA (19 cycles):
;nvmxdizc
SEP #%00100000
XBA
PHA
XBA
PLA
REP #%00100000
The index clobbering versions can easily be made to work with Y instead. Are these routines as fast as they can be?