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


Forums > C64 Coding > Cycle tables
2020-04-01 21:43
crl

Registered: Mar 2020
Posts: 15
Cycle tables

I read about cycle tables in regard to one of Upfront’s demos can someone explain this concept to me?
 
... 6 posts hidden. Click here to view all posts....
 
2020-04-02 20:03
Krill

Registered: Apr 2002
Posts: 1440
Quoting Compyx
Yes, with less sprites on a given line, you'll need to waste more cycles.
Unless you have gaps between the enabled sprites. =)
2020-04-02 20:26
Compyx

Registered: Jan 2005
Posts: 525
Yes, indeed.

You can see that reflected in my table. The first time I set up such table (by hand for all 256 possibilities), that was a bit of a WTF moment :)

The table is less 'linear' than you might expect.
2020-04-02 23:03
crl

Registered: Mar 2020
Posts: 15
Thanks. Makes sense. I guess the hard part muat have been how to determine the number of sprites on each rasterline and doing so sufficiently fast
2020-04-02 23:22
Compyx

Registered: Jan 2005
Posts: 525
I use a naive approach where I first fill a table with 0's and then use ORA for each sprite:

Basically for sprite 4 (so the fifth sprite):
    ldy sprite_ypos_4
    ldx #20
-   lda table,y
    ora #%00010000
    sta table,y
    iny
    dex
    bpl -


I do this for all 8 sprites and then use the table to index the cycle-table. This obviously eats a lot of cycles and can be improved a little by unrolling the loops. But if you have a fixed Y-movement you can pre-calculate a lot of that.

I do a similar thing for the DYSP that uses $d017 stretching.

But since these articles are supposed to explain stuff, I tried to keep stuff 'simple'.

There's also a way to use a CIA timer to determine how many cycles to waste, I think Kjer/Horizon was the first to do that. That way you handle the calculation of the clock slide inside the DYSP. But that leaves fewer cycles for raster splits.

But that's something for another article, I've never done that myself, should be interesting. =)
2020-04-04 05:38
Martin Piper

Registered: Nov 2007
Posts: 403
My really naive approach years ago was to hand tweak delays for each raster for each animation frame.
2020-04-04 11:53
Groepaz

Registered: Dec 2001
Posts: 9220
also see <shameless plug>Victimer</shameless plug>
2020-04-04 15:51
Oswald

Registered: Apr 2002
Posts: 4566
hmm maybe lft's collision register trick could be used here to find out what sprites are active per line ? so instead of d021 use d022 and multicolor charset filled with d022 'color'. (or whatever causes collision with sprites)

then just read out sprite-backgr collision register per line and look up cycle table with it.


edit:oh and ofcourse we need the 63 cycle stretch routine (linecrunch?) to have the d022 fill repeated without badlines
2020-04-05 02:13
Krill

Registered: Apr 2002
Posts: 1440
Hmm, what does that trick do originally?

Because afaik, the collision registers reflect collisions only after the fact, once a sprite has been drawn (and depend on the actual sprite bitmap pattern), and then update only once per scanline.

I guess this prevents offsetting variable sprite DMA early enough/in the correct places within a rasterline.
2020-04-05 10:32
Oswald

Registered: Apr 2002
Posts: 4566
you are right, the register must be only valid when the sprites have been drawn on that line, and thats too late.
2020-04-05 11:20
tlr

Registered: Sep 2003
Posts: 1286
Quote: Hmm, what does that trick do originally?

Because afaik, the collision registers reflect collisions only after the fact, once a sprite has been drawn (and depend on the actual sprite bitmap pattern), and then update only once per scanline.

I guess this prevents offsetting variable sprite DMA early enough/in the correct places within a rasterline.


The collisions do reflect collisions after the fact as you say. However the registers update "immediately" and can update more than one time on a scanline.
Previous - 1 | 2 - 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
Yogibear/Protovision
wil
Brittle/Necta!^Demozoo
Alakran_64
mkarcz
E$G/HoKuTo FOrCE
ELA/Antimon
Colt45RPM
Guests online: 54
Top Demos
1 Uncensored  (9.7)
2 Coma Light 13  (9.7)
3 Edge of Disgrace  (9.7)
4 Comaland 100%  (9.6)
5 Unboxed  (9.6)
6 The Shores of Reflec..  (9.6)
7 Remains  (9.6)
8 NGC 1277 100%  (9.5)
9 Lunatico  (9.5)
10 C=Bit 18  (9.5)
Top onefile Demos
1 Dawnfall V1.1  (9.6)
2 Crystal Gazer  (9.6)
3 Fluffer  (9.5)
4 Smile to the Sky  (9.5)
5 The Tuneful Eight [u..  (9.5)
6 Instinct  (9.5)
7 Rewind  (9.5)
8 Bad Boy  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Gumbo Revised  (9.4)
Top Groups
1 PriorArt  (9.6)
2 Oxyron  (9.4)
3 Booze Design  (9.4)
4 Censor Design  (9.4)
5 Performers  (9.4)
Top NTSC-Fixers
1 Pudwerx  (10)
2 Horizon  (9.9)
3 Stormbringer  (9.7)
4 The Shadow  (9.6)
5 Fungus  (9.6)

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