Mini-challenge - fastest 24 bit countdown
Re: Mini-challenge - fastest 24 bit countdown
I guess the routine I posted fails in one respect. If the Accumulator is already at $FF, then gets incremented to $00, then the subtraction at the bottom of the routine will fail as the carry will be cleared in that case.
Re: Mini-challenge - fastest 24 bit countdown
* I just had to revisit this thread as I couldn’t get this out of my head,
* This should be up there for one of the smallest/fastest
* The smallest
INY
INX
INC $0
LOOP EQU * ; 5 cycles per loop
DEY
BNE LOOP
DEX
BNE LOOP
DEC $0
BNE LOOP
RETURN RTS
* The fastest
INY
INX
INC $0 ; or INC for 65c02
LP EQU *
DEY
BNE LP
BEQ DOX
LOOP EQU *
DEY
DEY
DEY
DEY
DEY
DEY
DEY
DEY
DEY
DEY
DOX EQU *
DEX
BNE LOOP
DEC $0 ; or just DEC for 65c02
BNE LOOP
RETURN RTS
* This should be up there for one of the smallest/fastest
* The smallest
INY
INX
INC $0
LOOP EQU * ; 5 cycles per loop
DEY
BNE LOOP
DEX
BNE LOOP
DEC $0
BNE LOOP
RETURN RTS
* The fastest
INY
INX
INC $0 ; or INC for 65c02
LP EQU *
DEY
BNE LP
BEQ DOX
LOOP EQU *
DEY
DEY
DEY
DEY
DEY
DEY
DEY
DEY
DEY
DEY
DOX EQU *
DEX
BNE LOOP
DEC $0 ; or just DEC for 65c02
BNE LOOP
RETURN RTS