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 > Multiplexing sprites?
2016-06-02 19:02
Rudi
Account closed

Registered: May 2010
Posts: 125
Multiplexing sprites?

Hi,
Thanks for all the help ive gotten so far here on csdb.
Now I've runned into another problem.
How the *** does sprite multiplexing work?
I just need the basic idea. I tried to read Cadaver and other tuts, but they seemed too advanced for my taste in continuing.

What my goal is basically to display 64 sprites that stands still. So it will display a checkerboard, hence the sprites only need one of two colors. and they are filled with either of the color. The sprites are displayed beneath the characters so i can either have black and white chess-pieces (using $d800) this works fine with 8 sprites! but now i need to fill the entire checkerboard.
(edit: the entire board is in singlecolor, not multicolor btw)

I have not yet figured out how it works in theory? I just need to have interrupts on each row and display the sprites.
I have a feeling it would work something like this:

01234567
12345670
01234567
12345670
01234567
12345670
01234567
12345670

sprite 0 has darkgray, sprite 1 gray color, sprite 2 darkgray, ..etc.. so it will show a checkerboard in the end..
is it as simple as just setting an interrupt and move the sprite or do one need something else to take into consideration as well?
 
... 42 posts hidden. Click here to view all posts....
 
2016-06-02 19:30
chatGPZ

Registered: Dec 2001
Posts: 11127
i recommend to start exploring this using only ONE sprite. make some code that multiplexes it once by changing Y position mid screen. then try to place one sprite above the other (and learn how you can change Y position as soon as the first sprite started, and that sprites can not overlap). then multiplex it a few times, and change color/pointer/x-pos at various places and see what happens. then try doing it with more sprites...... starting with 8 sprites is a bit troublesome, because of the damned badlines that will come in the way sooner or later :)
2016-06-02 20:12
Rudi
Account closed

Registered: May 2010
Posts: 125
Yes okay, I will try experiment with this
2016-06-02 22:56
Hoogo

Registered: Jun 2002
Posts: 102
A friend stopped coding on C64 in '92 with something like this. He didn't know that he can't start a new instance of a sprite before the old instance has displayed its 21 rows of pixels. If your fields on the checkerboard have a height of 16 pixels, you can't simply move a sprite just 16 pixels, you have to move at least 21 and change their graphics.
2016-06-03 00:21
TWW

Registered: Jul 2009
Posts: 541
Hi

Might I suggest another approach;

Use Hires or chars to do the chessboard and also possibly the characters.

I've made 2 prototype chess-games

The first one was all doen in hires (allowing a spritepointer) and another in hires Board With pieces in sprites (all 64 multiplexed etc.) allowing some interesting textures (However not possible to use a spritepointer unless you shrink the Board and free up a sprite).

Enclosed a couple of screenshots of how it looks;



2016-06-03 05:36
Oswald

Registered: Apr 2002
Posts: 5022
y stretch would solve the 16 vs 21 pixel problem :) but I'd rather use X expanded sprites so you dont need all 8, otherwise sprite and character row dma will steal all your cycles on badlines.
2016-06-03 05:50
ChristopherJam

Registered: Aug 2004
Posts: 1380
Quoting Rudi
So it will display a checkerboard, hence the sprites only need one of two colors. and they are filled with either of the color.


If you are just using solid sprites for alternating background colours, why not set $d021 to dark grey, and just use sprites for the mid grey squares? You then only need half as many. If you X expand them as well you might need even fewer - what is your tile size?

sprite IDs for underlay for 16x16 chars:
00  00  11  11
00  00  11  11
  22  22  33  33
  22  22  33  33
44  44  55  55
44  44  55  55
  66  66  77  77
  66  66  77  77
00  00  11  11
00  00  11  11
  22  22  33  33
  22  22  33  33
44  44  55  55
44  44  55  55
  66  66  77  77
  66  66  77  77
2016-06-03 08:04
ready.

Registered: Feb 2003
Posts: 441
here you find an example of full screen sprite mux, with line drawing on sprites.
https://www.dropbox.com/sh/25xzs0qlao2zydt/AACKIGyd3FZQC18RBB0W..
2016-06-03 08:24
Krill

Registered: Apr 2002
Posts: 2850
Quoting Oswald
y stretch would solve the 16 vs 21 pixel problem :) but I'd rather use X expanded sprites so you dont need all 8, otherwise sprite and character row dma will steal all your cycles on badlines.
Not quite ALL cycles, if i'm not mistaken.

Out of the otherwise available 20+3 CPU cycles on a PAL badline, only 16 are taken by all sprite DMA.
There remain 3 CPU cycles in the right border (the first of those being the one to switch $d016 for open sideborders) before sprite 0 DMA begins and 4 CPU cycles in the left border, after sprite 7 DMA has finished.

Switching $d018 for new sprite patterns after a badline is possible using read-modify-write instructions to get into the 3-cycle gap.
2016-06-03 08:43
Krill

Registered: Apr 2002
Posts: 2850
Quoting Hoogo
A friend stopped coding on C64 in '92 with something like this. He didn't know that he can't start a new instance of a sprite before the old instance has displayed its 21 rows of pixels. If your fields on the checkerboard have a height of 16 pixels, you can't simply move a sprite just 16 pixels, you have to move at least 21 and change their graphics.
Actually, a chessboard suits 24x21 pixels sprites pretty well. There is no reason to have fields of only 2x2 chars. The board fits into 24x24 chars with 3x3 fields (24x24 pixels each), which leaves only one character row unused. Displaying the chess pieces on top of it using sprites leaves you 3 rasterlines (none of them a badline) to leasurely set sprite registers. It's not an end-boss seamless wall of sprites scenario. :)
2016-06-03 09:13
Fresh

Registered: Jan 2005
Posts: 101
Quote:

Out of the otherwise available 20+3 CPU cycles on a PAL badline, only 16 are taken by all sprite DMA.

Nope.
6510 is still in idle from the badline and before the first sprite fetch there are exactly 3 cycles: BA will be kept low and the CPU will have to wait for the whole sprite DMA to finish. On a PAL machine right after a badline you can't do anything before sprite 0 fetch, you'll lose 19 cycles.
Moreover, this means that you can't open side borders on a badline if sprite 0 is active.
Previous - 1 | 2 | 3 | 4 | 5 | 6 - 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
Kruthers
Six/G★P
Guests online: 114
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 Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 S!R  (9.7)
5 Faayd  (9.7)

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