Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user zorreun ! (Registered 2025-05-15) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > A new VIC 'effect' : spriteskip
2025-04-28 00:09
WVL

Registered: Mar 2002
Posts: 923
A new VIC 'effect' : spriteskip

I'm working on a new effect and noticed a bug in my routine that I couldn't track down at first. In the end I think it's not really a bug, but an (for me) unexpected behaviour of our good old friend VIC-II. I'm calling it 'spriteskip' for now. Let me explain what I think is going on.

In my effect I had to change a sprite coordinate in the rastercode. In this case it's $d00a. Now I noticed that on a single line in my effect, the sprite appeared blank. Upon further investigation it seems it's caused by me moving the sprite to the left at the wrong moment.

The X position on rasterline R is $d8 and sprite 5 is showing spriteline L. The unexpected behaviour happens when modifying this to $d7 on the next rasterline R+1 using a normal 4 cycle store, which starts on cycle 36.

In this case, no pixels for sprite 5 are drawn at all on that rasterline. I'm guessing the VIC is checking when it has to start drawing and at the worst time I'm moving it to the left so this line of the sprite never gets started. It's like opening the sideborders by modifying XSCROLL just when the border check happens.

What puzzles me mostly is where my sprite data is at. The next line VIC just continues like normal with the next line (L+2) and the data for L+1 never gets outputted somewhere.

I can't see a use in a demo effect, but someone out there might be more inventive than me. Also it doesn't seem to be mentioned in the VIC-II article.

My questions :

- is this a new behaviour/effect?
- could we somehow avoid it? (I really really really want to avoid it and my rastercode is really toight)
- is spriteSkip a good name?

Please notice I'm on vacation and doing night coding to relax. I don't have a real C64 next to me to check if it happens there too. (Now that would be funny if VICE had it wrong).
 
... 6 posts hidden. Click here to view all posts....
 
2025-04-28 09:59
Krill

Registered: Apr 2002
Posts: 3065
Quoting WVL
What would happen if you'd do a spriteskip on the last pixel line of a sprite jn the frame before? Would the mess be gone and the VIC display the data from the previous frame?
The rubbish shifted out in the "0-th" sprite line in the right border is not due to left-over shift register contents.
It's from some left-over bus state and $3fff idle byte pattern which get fed into the shift register before actual sprite DMA happens.
2025-04-28 13:14
Skate

Registered: Jul 2003
Posts: 505
I remember using this back in the 90s. I needed to mask some sprite lines for my effect. I first tried $d010. it worked in a range but at some point i messed up sprites' X coordinates just like you've mentioned to disable the sprite at that line and it worked fine. I think it's pretty much the expected behaviour.
2025-04-28 16:42
Monte Carlos

Registered: Jun 2004
Posts: 370
I guess you have msb set? If, then coordinates d8-ff belong to the positions where the Sprite softly moves out of the left border.
And this explains why the Sprite apparently skips when the coordinate is set to d7.
2025-04-28 17:06
WVL

Registered: Mar 2002
Posts: 923
No, msb is clear :-) but I think it's like Krill said. The same way you make the 9th sprite, except the sprite data is lost.
2025-04-28 17:29
Oswald

Registered: Apr 2002
Posts: 5118
Quote: Quoting WVL
- is this a new behaviour/effect?
Preventing a sprite's pattern shift register from clocking out its contents by changing the sprite's X position to left of the beam in the current line is the basis for 9-sprites-per-rasterline routines, where sprite 0 gets displayed twice.
Once with the pattern read in the previous line, then again in the same line with the new pattern read in the right but still visible border.

I don't think it's a new thing.

Quoting WVL
- is spriteSkip a good name?
I also don't think it needs a name. =)


I dont get this. You display sprite 0 twice by preventing it being displayed ?

for WVL, I vaguely knew about this effect, I knew that "changing sprite x pos at wrong time" may cancel displaying the sprite on that rasterline. (yes its wrong, just wanna say this is common knowledge, I was told by someone or smth)
2025-04-28 17:56
Krill

Registered: Apr 2002
Posts: 3065
Quoting Oswald
I dont get this. You display sprite 0 twice by preventing it being displayed ?
Prevent in one line, display twice in the other.

Gratuitous Alternative Fishbomb Intro around $6000 for an illustration. =)
2025-04-28 19:13
Oswald

Registered: Apr 2002
Posts: 5118
Quote: Quoting Oswald
I dont get this. You display sprite 0 twice by preventing it being displayed ?
Prevent in one line, display twice in the other.

Gratuitous Alternative Fishbomb Intro around $6000 for an illustration. =)


ah ok I had no idea its blanked like this I thought its sprite prority maybe behind $3fff or make sprite color same as background, but yeah ghost byte doesnt work for border. and maybe something else comes in the way for the color solution.
2025-04-28 19:50
tlr

Registered: Sep 2003
Posts: 1802
Quoting WVL
Also, I just had an idea where it might be possible to use this effect. It's like the 9 sprites thing, but different. Every coder has run into the 'sprite mess in the right sideborder thing' when opening the sideborder in the line just above where the first sprite would normally be drawn. What would happen if you'd do a spriteskip on the last pixel line of a sprite jn the frame before? Would the mess be gone and the VIC display the data from the previous frame?

How the first line fetch behaves was previously discussed here: Sprite data fetch in sideborder
2025-04-28 21:51
Copyfault

Registered: Dec 2001
Posts: 483
Thanks for the pointer@tlr... was about to bring this up, but no csdb-access at my workplace.

While the term "spriteskip" is good and describes what happens, I also don't think that it's a "new effect". It's basically like Krill already explained: the trigger condition for starting the pixel mixing of the VIC internal sprite pattern registers and the background gfx is circumvented by switching the sprite's x-position at the right moment.

I did some examinations quite some time ago, and if I'm not mistaken (taking your example, WVL) the VIC-internal sprite x-position counter is $d8 at cycle#39 (where the W-cycle of a STORE-command starting at cycle#36 will end up). So if you set it to $d7 in this very moment, the condition for mixing in the sprite pixels will fail. The content of the VIC-internal sprite pattern registers will most probably get overwritten when the DMA-sprite-fetch cycles happen later on that line, but this would've to be examined by some fancy gadgets like that BeamRacer (or maybe by setting the x-pos again so the condition'd match _before_ the next DMA-sprite fetch cycles happen).

As good as the mighty VIC article might be, I somehow think it lacks a bit of in-depth descriptions of what the VIC does internally, especially how the pixel sequencer works and how the output is connected to the half-cycles per rasterline. IF my interpretations are correct, the mixing of the pixel data happens 2 cycles before the actual output. Should create a 126 half-cycle sheet one day and try to assign all actions of the VIC to these, but then again, lft's sheet already comes close :D
2025-04-29 02:11
Martin Piper

Registered: Nov 2007
Posts: 739
It's more of a SpriteRowSkip rather than a SpriteSkip, which could be abbreviated to SRS instead of SS (*cough*).
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
Skleptoid
MWR/Visdom
FABS/HF
espskog
Slammer/Camelot
TheRyk/MYD!
iAN CooG/HVSC
Guests online: 124
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Codeboys & Endians  (9.7)
4 Coma Light 13  (9.6)
5 Mojo  (9.6)
6 Signal Carnival  (9.6)
7 Edge of Disgrace  (9.6)
8 Comaland 100%  (9.6)
9 Uncensored  (9.6)
10 The Trip  (9.6)
Top onefile Demos
1 Nine  (9.8)
2 Keine Termine und le..  (9.7)
3 Layers  (9.6)
4 Cubic Dream  (9.6)
5 Party Elk 2  (9.6)
6 Copper Booze  (9.5)
7 Charflasher  (9.5)
8 Onscreen 5k  (9.5)
9 Libertongo  (9.5)
10 Dawnfall V1.1  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Oxyron  (9.3)
3 Performers  (9.3)
4 Censor Design  (9.2)
5 Artline Designs  (9.2)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 MWS  (9.7)
4 Irata  (9.7)
5 hedning  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2025
Page generated in: 0.044 sec.