;Show used sprite slots, by GreenHammerBro. ;This debugger code will display what normal sprite slots are used and what are empty ;slots onto the HUD (by using the sprite status table: $7E:14C8), useful to tell how ;many remaining free slots to use and if the sprite is processing off screen or not. ;I recommend using the super status bar patch, because since there are 12 (decimal) ;slots, there will be 12 tiles (in rows) used on the HUD, especially if you are using ;sa-1, it has more slots. Use this on uberasm's "global_code.asm". ;How to read it during gameplay: ;0 = unoccupied slot ;1 = occupied slot ;As you read the rows of numbers on the HUD, each tile corrospond a slot, ;for example: ;000000010000 ;^slot 8 is occupied (this happens if you spawn sprites from the edge of the screen, ;directly spawning sprites (like from ? blocks) starts from the last slot and on each ;slot "backwards" towards the first). ;Note: you'll still have to convert the ram addresses in this code when using sa-1. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !HudPosOrScratch = $0EF9 ;^The position on the HUD this debugger appears, If you are using the super status bar ;patch, use scratch ram $0000 (because the tile bytes are reformatted). However if you ;are using sa-1, then pick one of the following (because $7E:0000 is 16 bytes long): ;-use freeram that have enough bytes (1-byte per slot). ;-use the old HUD ram if you are using the advanced status bar patch, since the game no ; longer uses them after patching. !sa1_slots = 12 ;^how many slots, 12 if you don't have sa-1 installed. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ STZ !HudPosOrScratch ;\show empty slots. (gets overrided/overwritten STZ !HudPosOrScratch+1 ;|by code below to display a "1" for occupied). STZ !HudPosOrScratch+2 ;|This needs additional lines if there are more slots. STZ !HudPosOrScratch+3 ;| STZ !HudPosOrScratch+4 ;| STZ !HudPosOrScratch+5 ;| STZ !HudPosOrScratch+6 ;| STZ !HudPosOrScratch+7 ;| STZ !HudPosOrScratch+8 ;| STZ !HudPosOrScratch+9 ;| STZ !HudPosOrScratch+10 ;| STZ !HudPosOrScratch+11 ;/ LDX #$00 ;>start at slot zero - LDA $14C8,x ;\check if sprite status is "existing" BEQ + ;/if not, then skip writing and go to next slot. LDA #$01 ;\write occupied slot information on HUD. STA !HudPosOrScratch,x ;/ + CPX #!sa1_slots-1 ;\if X = final slot.. (-1 because slot 0 is included) BCS + ;/then exit (check before going past the final slot). INX ;\otherwise go to the next slot and check it. BRA - ;/ + ;Remove the semicolons if using super status bar. Add additional lines if more slots. ;If you have changed the freeram of the patch (or want to move the debugger info), ;you'll need to change the STA $XXXXXX that stores it into the SSB ram (store it in ;even numbers of bytes; they are what tile to use). ;LDA !HudPosOrScratch : STA $7FA000 ;LDA !HudPosOrScratch+1 : STA $7FA002 ;LDA !HudPosOrScratch+2 : STA $7FA004 ;LDA !HudPosOrScratch+3 : STA $7FA006 ;LDA !HudPosOrScratch+4 : STA $7FA008 ;LDA !HudPosOrScratch+5 : STA $7FA00A ;LDA !HudPosOrScratch+6 : STA $7FA00C ;LDA !HudPosOrScratch+7 : STA $7FA00E ;LDA !HudPosOrScratch+8 : STA $7FA010 ;LDA !HudPosOrScratch+9 : STA $7FA012 ;LDA !HudPosOrScratch+10 : STA $7FA014 ;LDA !HudPosOrScratch+11 : STA $7FA016 RTS