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


Forums > C64 Coding > Sprite Multiplexing
2017-06-18 12:57
pmprog
Account closed

Registered: Nov 2005
Posts: 54
Sprite Multiplexing

Might seem a dumb question, but do you have to use an IRQ to multiplex sprites?

I've written a small multiplexor, but it's part of the game loop, checking D011/D012; but it only displays one lot of sprites, and to get the other set to show, I have to comment out the code for the first lot.

I don't think there's a reason I can't use an IRQ, but more curious on why my multiplexor doesn't work.
2017-06-18 13:11
oziphantom

Registered: Oct 2014
Posts: 478
If you want to just check D012 , sure. just you have to make sure you can actually hit the value.

LDA #150
- CMP D012
BNE -

will only work if the code runs in the 63 clocks that 150 is valid.

You also need to be sure that another wait loop doesn't hit
$1XX where XX is the value you are comparing, as that will break your chain.

Put some lda #1,2...7 sta $d020 where your sprite code happens and make sure they fire where you think they do.
2017-06-18 13:27
Mixer

Registered: Apr 2008
Posts: 421
You can write unrolled code, use delay loops or variable delay-routines, poll $d012 or use raster irq or timers to wait for a suitable moment to change sprite y positions.
2017-06-18 13:42
pmprog
Account closed

Registered: Nov 2005
Posts: 54
I know my code is hitting, because I also set the border colour when the multiplexor is active, and you can see them trigger. I might post some code when I get home. Maybe I've just overlooked something.
2017-06-18 14:01
Oswald

Registered: Apr 2002
Posts: 5017
guess you need to reset the first lot of sprites after the 2nd lot was displayed.

so

wait raster1
setup lot1 to show

lot1

wait raster2
setup lot2 to show

lot2

and no you dont need an irq to multiplex. at the end of the day the irq does the same thing, just in a more flexible way.
2017-06-18 16:00
ChristopherJam

Registered: Aug 2004
Posts: 1370
Forgive me if this is obvious, but you know the sprites have to be set up for the part of the screen currently being drawn, right?

Might be an idea to (eg) set $d021 to green after you set up the first set of sprites, then set it to red when you set up the second set of sprites.

If you don't have a green background for the area that should contain the first set of sprites, and a red background for the area that should contain the second set of sprites, then there's your problem.
2017-06-18 16:57
pmprog
Account closed

Registered: Nov 2005
Posts: 54
Right, okay, my question wasn't dumb, however, I was/am!

It turns out in my infinite wisdom, to forget the jmp at the end of my "config player sprites" code, so it was then rolling into the "config tiger sprites" code... Hence why I didn't see the player sprites.

So all fixed now. Thanks for everyones help :)
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
Didi/Laxity
cba
MCM/ONSLAUGHT
The Syndrom/TIA/Pret..
krissz
chesser/Nigaz
manganoid/Hokuto Force
mankeli/Extend
Guests online: 128
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 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.9)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 Wafer Demo  (9.5)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Onscreen 5k  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Webmasters
1 Slaygon  (9.7)
2 Perff  (9.6)
3 Morpheus  (9.5)
4 Sabbi  (9.5)
5 CreaMD  (9.1)

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