![]() |
![]() |
#1 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
Yet another sprite disabling question
I'm getting myself in knots here. I've got a routine that is using some sprites and it's all good. When the routine moves into the next effect I've got a transition copperlist that makes sure sprite dma is turned off during vblank, and that's all fine.
For whatever reason, if I wanted to turn off sprite dma during the display of a sprite, what is the correct way of doing it so that you don't get garbage? As a test I've setup a full screen sprite and turn off the dma in the middle of display so I can see lovely corruption for testing. If I disable sprite dma, then write 0 to SPRxDATA and SPRxDATB then I get no corruption, but the HRM says that writing DATA has armed the sprite so I guess what is actually happening is that the sprite is still being shown as per the whatever is in the SPRxPOS register but I just can't see it as the sprite data is 0000. Seems to work but feels icky. Code:
move.w #DMAF_SPRITE,dmacon(a6) moveq #0,d0 move.l d0,spr0data(a6) ;SPRxDATA and SPRxDATB move.l d0,spr1data(a6) move.l d0,spr2data(a6) move.l d0,spr3data(a6) move.l d0,spr4data(a6) move.l d0,spr5data(a6) move.l d0,spr6data(a6) move.l d0,spr7data(a6) If instead I write 0 to SPRxCTL the HRM says that this disarms the sprite. This also seems to work and I get no corruption, but the DATA/B registers still have some remnants in them but nothing is displayed. Also feels icky. Code:
move.w #DMAF_SPRITE,dmacon(a6) moveq #0,d0 move.w d0,spr0ctl(a6) ;SPRxCTL move.w d0,spr1ctl(a6) move.w d0,spr2ctl(a6) move.w d0,spr3ctl(a6) move.w d0,spr4ctl(a6) move.w d0,spr5ctl(a6) move.w d0,spr6ctl(a6) move.w d0,spr7ctl(a6) Which is the least bad way of doing this "if you have to"? ![]() |
![]() |
![]() |
#2 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,513
|
Throws a coin
![]() Both methods are good and right. The canonical method would be to modify the SPRxCTL EV bits to right value in memory sprites structure during VB. EDIT: Having to choose, I would use your second method. In any case at next DMA DATA/B are overwritten.. Last edited by ross; 27 November 2019 at 16:41. |
![]() |
![]() |
#3 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
Thanks, I was leaning towards option 2 as well. I've added "ross approved" to my function notes ;p
|
![]() |
![]() |
#4 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,654
|
I'm pretty sure I always used the second method..
|
![]() |
![]() |
#5 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,377
|
If you don't know it's CTL or DAT you have to clear, to be 100% sure you can clear them both
![]() |
![]() |
![]() |
#6 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,752
|
Neither is correct in my book.
![]() As an experiment you could try to replace YSTOP from the initial CTL word with endline+1 (at endline in the Copper), then on the next copper line write 0 to both CTL words before hpos $24 or whatever it was - and see if it stops pixel-perfect. |
![]() |
![]() |
#7 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,087
|
I typically handle this by always using pairs of copper lists, similar to you, one for initialization/transition and the main one. The init one contains all the constant stuff (usually colors, $1fc, modulos, and similar) and there I also cram in all 8 sprite pointers pointing to a single 0 longword if needed, dma takes care of the rest automatically (and I can manually wipe out all the registers if needed). Once I'm done with precalc/init part of whatever is coming up next, I switch to the main copper list (and optionally wait a frame to make sure the entire init copper list is executed). This way I also save a few chipmem accesses every frame.
|
![]() |
![]() |
#8 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
Yeah that’s what I’m doing
![]() But during testing I’ve got a loop running outside the vbl checking for a right mouse to exit section immediately and it didn’t use the transition copper. I noticed it was messing up the sprites and was just interested in a function that I could throw in there to disable spites and not leave garbage no matter when it ran ![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sprite clipping question (OCS Amigas) | dirkwhoffmann | Amiga scene | 1 | 28 June 2019 19:10 |
The proper way of disabling a sprite? (Using DisplayLibrary) | earok | Coders. Blitz Basic | 6 | 05 June 2018 10:36 |
Sprite Channel Question | LuMan | Coders. Blitz Basic | 2 | 17 March 2016 16:51 |
AMOS Sprite Programming Question | ricky500 | support.Apps | 1 | 26 June 2012 16:10 |
32 and 64 bit sprite control words question | FrenchShark | Coders. General | 8 | 10 January 2008 02:32 |
|
|