Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Improved clock-slide
2017-02-28 07:21
lft

Registered: Jul 2007
Posts: 369
Improved clock-slide

If you use timer-based jitter correction, or just VSP, here's a way to shave off one cycle:

http://codebase64.org/doku.php?id=base:improved_clockslide
2017-02-28 07:40
oziphantom

Registered: Oct 2014
Posts: 478
There is a special satisfaction for when one makes a thorn into a rose... the French probably have a word for it... but that is what I felt when I read that.
2017-02-28 09:50
Trash

Registered: Jan 2002
Posts: 122
Not only a cycle, a byte also...
2017-02-28 09:51
chatGPZ

Registered: Dec 2001
Posts: 11088
that optimization is so obvious... i feel silly now :(
2017-02-28 09:56
JackAsser

Registered: Jun 2002
Posts: 1987
Now put that bpl at $00ff to shave off another byte and cycle and do the jitter-compensation and IRQ-handling on $01xx.
2017-02-28 10:13
lft

Registered: Jul 2007
Posts: 369
I'm afraid that would leave the page-boundary in the wrong place.
2017-02-28 10:47
Martin Piper

Registered: Nov 2007
Posts: 629
Nicely done. Bravo.
2017-02-28 13:49
JackAsser

Registered: Jun 2002
Posts: 1987
Quote: I'm afraid that would leave the page-boundary in the wrong place.

True. at $00fx then. But this of course applies to the standard method aswell.
2017-02-28 14:58
Copyfault

Registered: Dec 2001
Posts: 466
So simple, so beautiful ;)

Now that I come to think of this, it should be possible to shave off another byte by utilising that other additional branch cycle (in case of a taken branch).

Assuming that the accu holds the no. of bytes to skip (which is common for this approach) we could do the following:
;-----------------------------
;A=0..n-1=no.of bytes to skip
;must have been calculated
;directly before to ensure
;correct setting of the z-flag
;-----------------------------
     sta bra+1
bra  bne *
     nop       ;2 cycles
     lda #$a9  ;2
     lda #$a9  ;2
     lda #$a9  ;2
     lda $ea   ;3
;-----------------------------
;page break here
;-----------------------------
code ...

If A=0, the branch is not taken; thus the total sum of cycles will be 11. In case of a non-vanishing A, the NOP-instruction is skipped (-2 cycles) but the additional "branch taken"-cycle comes in. Mind that if you want to slide down to 2 cycle-delay the page break is mandatory! A one-cycle delay is not possible but this is the same with the "BPL"-instruction which always comes with that additional cycle.
2017-02-28 15:07
Frantic

Registered: Mar 2003
Posts: 1626
I think the best part is that LFT wrote a Codebase article about it *before* I had to ask him about it.
2017-02-28 19:56
lft

Registered: Jul 2007
Posts: 369
Copyfault, that is an excellent improvement!
 
... 16 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
TheRyk/MYD!
hedning/G★P
Mike
Mason/Unicess
Hairdog/BOOM!^Dream
the mad-zap/Royal Cr..
Brittle/Dentifrice^(?)
kbs/Pht/Lxt
Mojzesh/TGR🇬🇧
anonym/padua
encore
t0m3000/ibex-crew
jmin
Guests online: 370
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 No Bounds  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 Party Elk 2  (9.7)
2 Cubic Dream  (9.6)
3 Copper Booze  (9.5)
4 Rainbow Connection  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Onscreen 5k  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Nostalgia  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Webmasters
1 Slaygon  (9.7)
2 Perff  (9.6)
3 Morpheus  (9.5)
4 Sabbi  (9.5)
5 CreaMD  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.042 sec.