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 > Changing definitions of 8 sprites on badlines
2016-06-04 10:51
Fresh

Registered: Jan 2005
Posts: 101
Changing definitions of 8 sprites on badlines

This is based on something I've been talking about on http://csdb.dk/forums/?roomid=11&topicid=117493, I didn't want to flood that thread with stuff that wasn't strictly related to Rudi's question.
I've written a simple test program to show that a STx is enough to change charpage (and so sprite defs) after preceeding sprite DMA and before badline DMA: https://www.dropbox.com/s/llnjj9vfwtiifmt/sprtest.zip?dl=0
The program starts with the correct values but you can use your joy on port 2 to do the following:
- move the cycle with left/right
- change the affected i/o port ($d016/$18/$20/$21) with up/down

Edit: source to be assembled with kickass
2016-06-04 13:52
Oswald

Registered: Apr 2002
Posts: 5094
give binary too :) do you also have 8 sprites before and after STx ?
2016-06-04 14:18
Fresh

Registered: Jan 2005
Posts: 101
The attached file contains both the source and the binary.
Yes, I'm dealing with the second line of the 8 sprites.
2016-06-04 14:30
Oswald

Registered: Apr 2002
Posts: 5094
the line where the sprite shape changes is 1 line after the badline, so it either doesnt works, or I dont understand how this demonstrates that it does.
2016-06-04 14:47
Fresh

Registered: Jan 2005
Posts: 101
The sprites are displayed one line after their definitions are read so here the problem is changing line 2 (the one following BL) without affecting line 1.
It works like this:
ldx #newvalue
ldy #oldvalue
1: stx $d018   ; first 2 (R,R) cycles
=> fetch line 1 of sprites
1: stx $d018   ; last 2 (R,W) cycles
=> char DMA (Badline)
=> fetch line 2 of sprites
2: sty $d018   ; recover original defs

If instruction 1 is too early the change will affect both line 1 and 2; if instruction 1 is too late it won't affect any of them.
Changing line 1 or 3 is trivial, you don't even need a stable raster routine.
2016-06-04 15:08
Oswald

Registered: Apr 2002
Posts: 5094
Thanks, I get it now. I wonder why couldnt I do it back then.
2016-06-05 18:59
Smasher

Registered: Feb 2003
Posts: 520
very interesting. thanks!
2016-06-06 14:59
DKT

Registered: Aug 2004
Posts: 99
I've made a walk-around in Forever Lost for this problem. "Forever Lost" logo in intro is using 8 sprites in a row. There is hires scrolling background.
I was rewriting sprite content during sprite display.
I was copying last pixel row of next sprites row to the previous sprites row already displayed and was changing $d018 one line before bad line. I was displaying new sprite definitions (in last line) but it was still the old sprite.
It's not a clean solution and would be horrible for multiplexer but for a stable graphic just worked :).
2016-06-06 15:28
Fresh

Registered: Jan 2005
Posts: 101
That's basically what Groepaz called the "Overlapping data trick" in Rudi's thread.
Yes, it may be considered a bit less cleaner, but it's often a faster and safer solution in many situations.
2016-06-06 21:04
chatGPZ

Registered: Dec 2001
Posts: 11386
for a lot of situations its the perfect solution actually :)
2016-06-07 18:53
Frantic

Registered: Mar 2003
Posts: 1648
A short little codebase article on this, anyone?

http://codebase64.org/
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
Ben Breton/Absence o..
Freeze/Blazon
Peacemaker/CENSOR/Hi..
Marq/Fit^Lieves!Tuor..
Steffan/BOOM!
Guests online: 118
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Logo Graphicians
1 t0m3000  (10)
2 Sander  (9.8)
3 Mermaid  (9.5)
4 Facet  (9.4)
5 Shine  (9.4)

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