-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation
- Routines
-
RAM
- !dss_map
- !dss_list
- !dss_list_timer
- !dss_gfx_size
- !dss_list_usage
- !dss_list_queue_index
- !dss_list_gfx_loaded
- !dss_tile_buffer
- !dss_tile_buffer_complete
- !dss_ram_buffer_index
- !dss_maximum_tiles
- !dss_loaded_tiles
- !dss_gfx_queue
- !dss_gfx_queue_index_nmi
- !dss_gfx_queue_index_game
- !dss_vram_dest
- !dss_regular_sprite_copy
- !dss_custom_sprite_copy
- !dss_extended_sprite_copy
- !dss_cluster_sprite_copy
- !dss_bounce_sprite_copy
- Patch signature
This routine handles finding the tile number data of a given ExGFX ID OR queueing a ExGFX file to be uploaded to VRAM during the next frames. Also, the routine can predict whether the sprite ExGFX will be loaded during the next V-Blank period or not. If it predicts that the GFX will be ready, the graphics become instantly available to use and will be marked as ready.
For usage in custom sprites, use %FindAndQueueGFX()
instead of find_and_queue_gfx
.
Item | Size | Description |
---|---|---|
A | 8-bit | ExGFX ID in the range you want to use. By default it's D00-DFF .If it's $FF it will be considered as NULL and the routine will end prematurely. |
Item | Size | Description |
---|---|---|
Carry | 1 bit | Flag to determine if the sprite has its graphics on VRAM. Useful to know if the sprite ready to be drawn on screen.
|
!dss_tile_buffer |
1-32 bytes | This table will hold the tile numbers of the loaded ExGFX and is filled from first to last index (0-19). Do note that this table is never cleared between calls, as this allows the user rearrange the data to fit several ExGFXs tile data (see how Chucks were handled). |
$0D-$0F | 24 bit | Pointer to the tile number data in the !dss_tile_buffer_complete table. |
Item | Description |
---|---|
A | Will contain garbage. |
X/Y | They will retain their original values and sizes. |
DB | Preserved. |
DP | Unchanged. |
$00-$0F | Will contain garbage. |
$313A-$313F | Will contain garbage. |
When using this routine you'd most likely want to call it at the very start of your graphics routine, as it corrupts everything GetDrawInfo sets for you in $00 and $01, or you could preserve the data, your choice.
graphics_routine:
lda.b #<exgfx_id> ; here goes the ExGFX ID you want to find
%FindAndQueueGFX()
bcs .graphics_loaded
.graphics_not_loaded
; do whatever if the graphics haven't been loaded
; usually you want to abort drawing the graphics
rts
.graphics_loaded
; continue your graphics routine here
; !dss_tile_buffer will contain the tile numbers for the loaded ExGFX
rts
This routine handles uploading graphics to VRAM in small chunks to avoid overextending the V-Blank period. You can only call this routine within UberASM and should only be called under a nmi
label.
When a 16x16 tile gets uploaded, its corresponding VRAM value is set to zero, this is how the VRAM queue routine detects if there are any GFX pending to be uploaded. Also the queue index is increased by 4 for each uploaded tile.
N/A
N/A
Item | Description |
---|---|
A | Should be 8-bit. |
X/Y | Should be 8-bit. |
DB | Not modified. |
DP | Modified with $4300 , restored with $3000 . |
$00-$0F | Not used. |
As it was explained at the intro, this routine is meant to be used with UberASM under a nmi
label. The included files already take care of this, so you really don't have to call this at any other point.
nmi:
jml dynamic_spriteset_queue ; change it to JSL if you have more routines here
This routine takes care of initializing RAM used by the system to its required values.
N/A
N/A
Item | Description |
---|---|
A | Returned as 8-bit. |
X/Y | Returned as 8-bit. |
DB | Modified with $40. Returns with $00. |
DP | Not modified. |
$00-$0F | Not used. |
As it was explained at the intro, this routine is meant to be used with UberASM under a init
label. The included files already take care of this, so you really don't have to call this at any other point.
init:
jml dynamic_spriteset_init ; change it to JSL if you have more routines here
This patch leaves a small signature of data at $01DF78
. The first three bytes spell "DSS" and the last two bytes are used for the version number in XX.YY
format.