So, my 6502 is a little rusty. Been a while since I was active.
I have a delay routine where I want to preserve A, X and Y. Using 65C02, here is what I have:
Code:
;------------------------------------------------------------------------------
; Name: DELAY1
; Desc: Slight delay (TODO, calculate and re-name)
; Destroys: Nothing
;------------------------------------------------------------------------------
DELAY1:
PHA ; Push A to stack
TXS ; Push X to stack
TYA ; Transfer Y to A (why no PUSH Y to stack??)
PHA ; Push A to stack (previous value of Y)
LDX #$00
LDY #$10
_DELAY1:
DEX
BNE _DELAY1
DEY
BNE _DELAY1
PLA
TAY ; Restore Y
TSX ; Restore X
PLA ; Restore A
RTS
I'm not at my 6502 computer at the moment...but does this seem to be correct?
Any shorter way to do this?
Thanks!