06 August 2021, 10:38 | #1 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
Multiplexing sprites By changing pointers
I'm trying to change sprite pointers, after they are displayed on screen, in order to multiplex them and have more flexibility and waste less memory.
I'm doing something like this, but nothing is happening: Sprite1: (first sprite pointers) dc.w $0130,$0000 dc.w $0132,$0000 dc.w $0134,$0000 dc.w $0136,$0000 dc.w $cb01,$fffe ; copper wait Sprite2: (second sprite pointers) dc.w $0130,$0000 dc.w $0132,$0000 dc.w $0134,$0000 dc.w $0136,$0000 My "second '' sprite is placed at $cc y position, just right one line after copper wait. Should I take care of something else? |
06 August 2021, 11:25 | #2 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,514
|
Yes, you should take care of SPRxPOS/SPRxCTL SV and EV bits.
You are thinking of sprite pointers as if they were bitplane pointers. As for bitplanes there are DIW start/stop registers for the DMA, same for sprites are the SV and EV y-coordinates. So for the DMA to be active and the data to be fetched where you set the pointers, you must be inside the 'window' defined by those bits. |
06 August 2021, 15:12 | #3 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
So if I set the first two sprites as sprite1+sprite2 height, it should work? Now My sprites are 6 pixel Height, and they should be 12 pixel, isnt?
|
06 August 2021, 15:19 | #4 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,514
|
Yes, if the sprites are consecutive.
Of course if there is a gap between them you have to point to a zeroed memory area (during the gap, and increase the height), or disable the DMA for a this period. Also you have to set SPRxPOS and SPRxCTL registers before the first y sprite position (but this is obvious ) [the DMA does this automatically on PAL line $19] |
06 August 2021, 15:21 | #5 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
SPRxPoS and SPRxCTL must be set outside the sprite structure, so copper must do it: Do I get it right? I'm using two different sprites, not the same ones
|
06 August 2021, 15:27 | #6 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,514
|
Yes, you could set it manually by copper after line $19.
Basically SV should be first_line of first sprite, EV last_line+1 of second sprite. Remember to set the sprites DMA bit and to set the pointers of the unused sprites to a zeroed area. |
06 August 2021, 15:32 | #7 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,514
|
|
06 August 2021, 15:33 | #8 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
Somenthig like that:
Sprite1: (first sprite pointers) dc.w $0130,$0000 dc.w $0132,$0000 dc.w $0134,$0000 dc.w $0136,$0000 dc.w $0160 $0000 SPR4POS dc.w $0162 $0000 SPR4CTL dc.w $0168 $0000 SPR5POS dc.w $016A $0000 SPR5CTL dc.w $cb01,$fffe ; copper wait Sprite2: (second sprite pointers) dc.w $0130,$0000 dc.w $0132,$0000 dc.w $0134,$0000 dc.w $0136,$0000 dc.w $0160 $0000 SPR4POS dc.w $0162 $0000 SPR4CTL dc.w $0168 $0000 SPR5POS dc.w $016A $0000 SPR5CTL BTW, My sprites aren't consecutive |
06 August 2021, 15:34 | #9 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
Sorry, different shapes. I'm using two different shapes, so i thought That would not be necessary to change POS AND CTL INTO copper list
|
06 August 2021, 15:42 | #10 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,514
|
Follow the rules I told you and you will see that it will work
You just have to pay attention to the values present in EV because it is the line in which the DMA automatically retrieves the values for the new values of SPRxPOS/CTL (for the auto-y-multiplex). Then make sure that the sprites whose pointers you change are inside the SV/EV 'window'. |
06 August 2021, 15:52 | #11 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
Thanks ross.
I'm think about this: by setting SPRxPOS/CTL of the second sprites into the structure of the first sprites, and then let the sprites pointers pointo to the actuall dat of the second sprites, will work, like this: SpriteData1 $0000,0000 ;POS,CTL first sprite $ffff,$ffff ; sprite datas .....,...... $0000,0000 ; POS CTL of multiplexed sprites SpriteData2: $ffff,$ffff ; actual data ....,...... $0000,$0000 ; end sprites |
06 August 2021, 16:37 | #12 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,514
|
Yes, this is a good way, because DMA 'work for you' to fetch sprite positions
(and you don't waste DMA cycles because in idle mode between the two positions). |
06 August 2021, 21:04 | #13 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
Very good. Maybe I can multiplex it many times, since I need it. Is it better to set copper wait one line before, or the exact same line, as "new" sprites?
|
06 August 2021, 21:17 | #14 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
|
07 August 2021, 04:01 | #15 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
|
07 August 2021, 15:08 | #16 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
This is what I do in Planet Disco Balls end scene. It’s one big sprite list and then the sprite data is animated and blitted into the list. (Video and source in sig)
|
07 August 2021, 16:16 | #17 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
No blitting here. Just changing sprites' pointers
|
26 August 2021, 18:51 | #18 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,752
|
The Amiga sprite engine really is powerful, and there are probably more than half a dozen different ways of multiplexing sprites. They really aren't used much though, but soo nice to play with. And I think a used sprite is a happy sprite.
[ Show youtube player ]
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sprite multiplexing on Amiga | majikeyric | Coders. General | 51 | 27 April 2023 11:06 |
Copper changing sprite pointers | Muzza | Coders. General | 7 | 30 July 2021 13:58 |
Multiplexing Using Vsprites Code | Havie | Coders. Blitz Basic | 23 | 08 September 2019 21:37 |
Sprite multiplexing & copper bars? | E-Penguin | Coders. Blitz Basic | 6 | 22 December 2018 17:07 |
2 Mouse Pointers!!! | wandeep | support.WinUAE | 3 | 21 May 2008 13:44 |
|
|