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 > Unexpected sprite behaviour
2018-09-22 00:30

Registered: Jan 2005
Posts: 403
Unexpected sprite behaviour

While trying to hack together a linecruncher I ran into a bit of an odd situation: sprites appear where they shouldn't.

My code currently doesn't actually line crunch, since I haven't got the timing correct yet, I implemented a stable raster and basically copied the line crunch code from an old demo part I once wrote.

The weird thing is that although I only poke #$32 at the sprite Y-positions, I get those sprites at raster position 0 as well. Y-stretched since I my line crunch routine uses a $d017 sideborder stretcher to allow for something a little more interesting than just a blank space.

I figured this was a bug in VICE, but it also happens on the real deal, and even x64 emulates this correctly. So there must be some logic to this.

Anyway, here's a link to the code: https://www.dropbox.com/s/ftu9jty6r32xj9a/linecrunch-fuckup.tar..
Just run linecrunch.prg or run make if you have 64tass installed.
... 2 posts hidden. Click here to view all posts....
2018-09-22 14:14
Rastah Bar

Registered: Oct 2012
Posts: 162
Interesting. Krill is probably right. Something I wanted to look into for some time: what happens if you put sprites at line $100, for example, and keep stretching them. Can you stretch them into the upper border (I mean keep stretching for more than $37 lines)? And what happens then with that copy the VIC normally draws in the upper border. Is that replaced by the stretched one? (I suppose so.)
2018-09-22 15:35

Registered: Apr 2002
Posts: 1095
Yes, you can stretch (and normally display) sprites across frame boundaries, such that they extend from lower border to upper border.

As long as a sprite is being drawn, it won't be restarted. Any value in its Y coordinate register that lies within the currently-drawn sprite is ignored. So yes, the stretched sprites in your example "replace" those that would be displayed without the stretching.
2018-09-22 19:11

Registered: Dec 2001
Posts: 8920
Pretty sure that's simply because both $32 and $132 (= 306) exist as valid rasterlines

damn. now that you say it, it seems totally obvious =D but mmmh.... does this also happen when not stretching the sprite then? never noticed it would :)
2018-09-22 19:24

Registered: Apr 2002
Posts: 1095
Sure it does. :) Might not be visible on your realthing setup or without VICE debug borders, but yeah.
2018-09-22 19:27

Registered: Dec 2001
Posts: 8920
guess i never noticed, because usually on a screen with opened upper/lower border, there is also multiplexing going on. funky :)
2018-09-22 19:37

Registered: Oct 2014
Posts: 240
yeah this "sprite" appears in two places when you have open borders has been causing me a fair amount of pain, I had to add extra interrupt splits to make sure the right sprites are turned off and on at the right points, and add extra logic to handle the correct cases for it..
2018-09-22 20:10

Registered: Mar 2005
Posts: 295
Schrodinger's sprite.
2018-09-22 20:10

Registered: Jan 2005
Posts: 403
The "no MSB for sprite-Y" sounds logical. I've seen this happen before on my real machine, long ago. But like groepaz said, usually when you open the top/bottom borders, there's some multiplexing so it doesn't show itself quite so clearly as in my shitty code.

I think I recently found an old demo part of mine that also suffered this 'problem', never noticed a few lines of the sprites sticking out of the upper border on my breadbox with my Philips CRT, but did notice them with VICE's full borders.

Too bad this can't be abused to get "free cycles" in the upper border with sprites, shoving rasterbars behind the sprites clearly indicates the sprite steal cycles in the normal way :(
2018-09-22 23:03

Registered: Jan 2018
Posts: 98
I made the same thread few months ago. Funny that people are still getting cought by this. And yes, they will wrap around from old to new frame if you stretch it. I tried sprite crunching and that usually makes the sprites very tall. All I had to do was to crunch it every 4-5 files to make it full screen. If your sprite data is filled with the same byte of graphics ($80,$80,$80 * 21) it doesn't even matter where you crunch it and it's perfect for straight lines (pseudo vertical rasterbars)
2018-09-24 22:05

Registered: Mar 2009
Posts: 538
There's tons of old demos with open top/bottom border and bottom sprite stuff happening unwanted in top border, too. Back in the CRT days we didn't notice/see.

When I first opened top/bottom I faced the same but simply solved the problem by setting new Y-pos just after bottom border action but before start of new frame. However, it took some time till I discovered full/debugging borders as you can see here hehehe Neotunes 2 Light [standalone] bottom stuff not happening in top but vice versa by switching Y-pos too early (apart from not really so stable rasters in side borders as I thought)

Since I've got a good real CRT (30 kg Sony Trinitron which can do full border in "overscan" mode and even NTSC), things are easier
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
Users Online
Kronos/Arsenic - FC
Guests online: 35
Top Demos
1 Uncensored  (9.7)
2 Comaland 100%  (9.7)
3 Unboxed  (9.7)
4 Edge of Disgrace  (9.7)
5 Coma Light 13  (9.6)
6 The Shores of Reflec..  (9.6)
7 Lunatico  (9.6)
8 Wonderland XII  (9.6)
9 Old Men in Used Cars  (9.6)
10 C=Bit 18  (9.5)
Top onefile Demos
1 Smile to the Sky  (10)
2 Arok 20 Invitation  (9.6)
3 Daah, Those Acid Pil..  (9.5)
4 FMX Music Demo  (9.5)
5 Crystal Gazer  (9.5)
6 Pandemoniac Part 2 o..  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rewind  (9.5)
9 Party Horse  (9.4)
10 Dawnfall  (9.4)
Top Groups
1 Oxyron  (9.4)
2 Booze Design  (9.4)
3 Censor Design  (9.4)
4 Finnish Gold  (9.3)
5 The Transfer Team  (9.3)
Top Mega Swappers
1 Aslive  (9.4)
2 R.C.S.  (9.3)
3 Dishy  (9.2)
4 Nightshade  (9.1)
5 Calypso  (9.0)

Home - Disclaimer
Copyright © No Name 2001-2018
Page generated in: 0.053 sec.