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 > Cycle tables
2020-04-01 21:43
crl

Registered: Mar 2020
Posts: 19
Cycle tables

I read about cycle tables in regard to one of Upfront’s demos can someone explain this concept to me?
2020-04-01 23:09
Compyx

Registered: Jan 2005
Posts: 631
The most obvious thing I can think of is tables that contain clockslide values for various situations, such as DYSP's, where the number of cycles to 'waste' on a given rasterline differs depending on what sprites cover that rasterline. That way you can do rastersplits/open the border.

Shameful plug: here's an article at codebase64 I wrote about using such a table to create an 8-sprite DYSP:
https://codebase64.org/doku.php?id=base:dysp_cycle_table

Upfront use some addition cleverness in that they do multiple smaller clockslides to get their rastersplits more stable.
2020-04-02 04:09
Martin Piper

Registered: Nov 2007
Posts: 634
Compyx nice explanation and good to see example code in github.
2020-04-02 13:26
Kruthers

Registered: Jul 2016
Posts: 21
Compyx, excellent article. One thing though, maybe my head is a little groggy but is this a mistake?

Quote:

Now we can waste anywhere between 0 (no sprites) and 17 cycles (all 8 sprites).


I would expect to waste more cycles with fewer sprites, etc...
2020-04-02 16:56
oziphantom

Registered: Oct 2014
Posts: 478
between means there are numbers in between so 0 cycles for 0 sprites and then 17 cycles for 8 sprites and so between 0 and 8 give between 0 and 17 cycles.
2020-04-02 17:12
chatGPZ

Registered: Dec 2001
Posts: 11116
what he means is that - to compensate - you have to waste more cycles when less sprites are active.
2020-04-02 18:20
Compyx

Registered: Jan 2005
Posts: 631
Yes, with less sprites on a given line, you'll need to waste more cycles. I'll update that sentence to make it more clear.
2020-04-02 20:03
Krill

Registered: Apr 2002
Posts: 2845
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: 631
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: 19
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: 631
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. =)
 
... 6 posts hidden. Click here to view all posts....
 
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
Guests online: 69
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Logo Graphicians
1 Sander  (10)
2 Facet  (9.7)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

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