26 November 2016, 01:08 | #1 |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
|
The proper way of disabling a sprite? (Using DisplayLibrary)
This is probably fairly obvious but I haven't discovered the proper way to handle it.
If you draw a sprite with the DisplaySprite command, eg Code:
DisplaySprite CopList#,Sprite#,X,Y,Sprite Channel But say if you no longer want to use that sprite channel at all? How do you simply turn it off? What I've been doing is simply moving the X value outside of the screen but surely that's not the right way to do it? |
26 November 2016, 18:08 | #2 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
To just remove it from the display, you can create a small transparent sprite and display that instead. To turn off the actual sprite display however is called "disarming" the sprite. I've never actually done it, but it seems writing 0 to the sprite control registers (SPR0CTL to SPR7CTL) disarms the sprites and disables their DMA, stopping their display and freeing that DMA slot up for other uses. Apparently this should only be done during a vertical blank however or you'll be left with vertical bars on your screen where the sprite used to be.
More info in the RKRMs here, and I'm sure plenty of people have more experience than I do with sprites - I've only ever done basic stuff with them. Edit: SPR7CTL is the top register, not SPR8CTL... Last edited by Daedalus; 27 November 2016 at 17:57. |
26 November 2016, 21:33 | #3 | |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
Quote:
It should be ok to write directly to SPRxDAT as some games manually load sprite registers with data to create backgrounds - usually done using the copperlist. |
|
27 November 2016, 08:09 | #4 |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
|
Cheers guys
|
04 June 2018, 23:55 | #5 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
Code:
;; Disable sprite channel ;; SPRxPOS = 0, move it away Poke.w $dff140 + (channel * 8), 0 ;; SPRxCTL = 0, disable the channel Poke.w $dff142 + (channel * 8), 0 |
05 June 2018, 09:12 | #6 | |
Registered User
Join Date: Oct 2008
Location: Finland
Posts: 643
|
Quote:
https://en.wikipedia.org/wiki/Logical_shift |
|
05 June 2018, 10:36 | #7 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
Yes, good point. I don't know about BB2 but the MULU instruction on 68000 is pretty slow. https://wiki.neogeodev.org/index.php...ctions_timings
I think switch/case wrapped up in a macro is probably the fastest way, using constants rather than calculating anything. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Disabling / hiding partitions | Turran | support.Hardware | 30 | 15 July 2015 20:58 |
Disabling Pop-up on EAB | stefcep | project.EAB | 5 | 07 May 2009 00:11 |
Disabling the Apollo A630 | frost242 | support.Hardware | 3 | 21 February 2009 13:57 |
WarpEngine disabling 68040 | alanh | support.Hardware | 4 | 11 October 2008 22:19 |
Disabling Cyberstorm MK I | THX1138 | support.Hardware | 7 | 04 May 2006 09:57 |
|
|