6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun May 12, 2024 1:38 pm

All times are UTC




Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Wed Sep 06, 2023 2:58 am 
Offline

Joined: Sun Apr 26, 2020 3:08 am
Posts: 357
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.


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 06, 2023 7:11 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
oh no!


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 15, 2023 10:51 pm 
Offline

Joined: Sun Apr 26, 2020 3:08 am
Posts: 357
* 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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3

All times are UTC


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: