English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 02 March 2024, 15:08   #1
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,197
multiplexing sprites not working

I'm using sprpt registers to set sprites at the top of the frame

I naively thought that setting those registers in the middle of the frame would work for lower sprites but it doesn't seem so.

My idea was to try to display 8 sprites on first half of screen using this method (classic) then set new sprpt registers in the middle of the screen (with lower coords) so 8 more sprites could be displayed

It appears that after some beam position, the sprites are no longer displayed if I don't write to sprpt soon enough.

Is it me or this is just not possible to multiplex sprites that way because DMA fetches sprite pointers once per frame and that's it? or is there something to fix that?

Last edited by jotd; 02 March 2024 at 15:14.
jotd is offline  
Old 02 March 2024, 15:27   #2
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
There are several ways to do what you want to do.

But first I have some questions:
1) don't you want to set the coordinates in the sprite list because you have the data 'scattered' in memory?
2) can you afford to modify the copper list to modify the sprite registers at will?
3) can you leave empty words at the head and tail of the sprites data in memory to allow you to have more control over the sprite list?

However, it's just a question of how you can manage the data and the copper list, what you want to do is doable and not to complex
ross is offline  
Old 02 March 2024, 15:33   #3
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,197
Quote:
Originally Posted by ross View Post
There are several ways to do what you want to do.

But first I have some questions:
1) don't you want to set the coordinates in the sprite list because you have the data 'scattered' in memory?
2) can you afford to modify the copper list to modify the sprite registers at will?
3) can you leave empty words at the head and tail of the sprites data in memory to allow you to have more control over the sprite list?

However, it's just a question of how you can manage the data and the copper list, what you want to do is doable and not to complex

1) yes each sprite has its control word, data, and I can display a random set of sprites so it won't be possible to move data around.

2) yes, doable but I suppose that means allocating a lot of free space for each line

3) same as 1 probably. Answer is no. I'm generating 8 copies of the sprite data (to allocate them to any slot I want) and that's it. Chaining would not be practical. But maybe for a Galaga-style game it could be nice as most aliens are animated exactly the same, there aren't a lot of combinations.
jotd is offline  
Old 02 March 2024, 15:45   #4
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Quote:
Originally Posted by jotd View Post
1) yes each sprite has its control word, data, and I can display a random set of sprites so it won't be possible to move data around.

2) yes, doable but I suppose that means allocating a lot of free space for each line

3) same as 1 probably. Answer is no. I'm generating 8 copies of the sprite data (to allocate them to any slot I want) and that's it. Chaining would not be practical. But maybe for a Galaga-style game it could be nice as most aliens are animated exactly the same, there aren't a lot of combinations.
Good.
Probably in this situation the best thing to do is to allocate a pair of leading and trailing control words for each copy of sprite data.

Basically what you have to do is set the sprptr at the beginning of the frame to the first sprite (y in higher screen position) and which contains as last (control) words the coordinates of the next multiplexed sprite (with y further down the screen).
Then with copper set sprptr for the '2nd' sprite, directly to the data part skipping the control words, when the beam is after the last line of sprite+2 (or even last+1+'something').

If I wasn't clear, just ask for clarification.

EDIT:
Another alternative, equally effective and which does not require to use empy (control) words at the end of each sprite data, is to modify the sprptr exactly after the fetch of the last line data of the first sprite on the screen (this is to allow the sprite DMA sytem to fetch the new coordinates from the new sprite data).
But in this case everything is timing sensitive, you cannot, as in the previous case, modify the sprprt freely, but in the exact line x-position.
So in the case of moving sprites you must also change the y coordinates in the copper list dynamically.

Last edited by ross; 02 March 2024 at 16:04.
ross is offline  
Old 02 March 2024, 16:33   #5
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,197
That seems not too far from what I tried to do.

What I did:

Each sprite trailing control word was 0, which probably ended the sprite data fetch for that sprite right? nothing more possible to do in that frame?

BUT when positionning the top sprites, you're proposing to set the trailing control word to the coords of the next sprite (at the bottom of the screen), and then do what I did earlier: in the middle of the screen change sprite pointers.

Am I getting that correctly?
jotd is offline  
Old 02 March 2024, 16:49   #6
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Quote:
Originally Posted by jotd View Post
That seems not too far from what I tried to do.

What I did:

Each sprite trailing control word was 0, which probably ended the sprite data fetch for that sprite right? nothing more possible to do in that frame?

BUT when positionning the top sprites, you're proposing to set the trailing control word to the coords of the next sprite (at the bottom of the screen), and then do what I did earlier: in the middle of the screen change sprite pointers.

Am I getting that correctly?
Correct
ross is offline  
Old 02 March 2024, 21:42   #7
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,197
aaaand it works perfectly! Now I can display more than 8 sprites now! thanks for the quick answer.

Last edited by jotd; 02 March 2024 at 22:36.
jotd is offline  
Old 16 March 2024, 20:00   #8
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,197
Been doing the multiplexing technique, it works but...

do you have an idea why the lower sprites would "blink" in cycle exact wheras it's fine in non-cycle exact.

I'm multiplexing blank sprites (on top) with non-blank sprites when it happens. If I remove multiplexing, the lower sprites stop blinking (If I remove cycle exact too)
jotd is offline  
Old 16 March 2024, 20:21   #9
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Quote:
Originally Posted by jotd View Post
Been doing the multiplexing technique, it works but...

do you have an idea why the lower sprites would "blink" in cycle exact wheras it's fine in non-cycle exact.

I'm multiplexing blank sprites (on top) with non-blank sprites when it happens. If I remove multiplexing, the lower sprites stop blinking (If I remove cycle exact too)
It seems like for some reason the pointers aren't updated in time or something (a race condition somewhere).
Anyway I would trust the CE version
You should do a minimum test exe and let me try it, I will be able to tell you the problem.
ross is offline  
Old 16 March 2024, 21:28   #10
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,197
yes, you're right. I was zeroing the "next" upper sprite control word, and was setting it afterwards. This small time lapse between clear and re-set triggered the blink. Thanks!
jotd is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiplexing Sprites Havie Coders. Blitz Basic 8 04 January 2024 18:12
Sprites Multiplexing problem sandruzzo Coders. Asm / Hardware 5 13 December 2021 22:56
Multiplexing sprites By changing pointers sandruzzo Coders. Asm / Hardware 17 26 August 2021 18:51
Multiplexing Using Vsprites Code Havie Coders. Blitz Basic 23 08 September 2019 21:37
I need 4 sprites for a new project I am working on. foody project.Amiga Game Factory 4 11 January 2006 18:09

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 00:39.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08938 seconds with 15 queries