-
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
- Code examples
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.
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-20 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. |
Example of usage
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 section includes several ways that you have to work with this system. More will be added later.
This is basically what I like to call the "standard" way of interacting with a recently found ExGFX via find_and_queue_gfx
. This is only valid for 16x16 tiles.
If you want to use a single tile, you can use the following approach:
lda !dss_tile_buffer+$00 ; this will draw the first tile from the ExGFX file
sta $6302,y
lda !dss_tile_buffer+$06 ; this will draw the seventh tile from the ExGFX file
sta $6306,y
lda !dss_tile_buffer+$0F ; this will draw the fifteenth tile from the ExGFX file
sta $630A,y
If you're drawing tiles with a loop you could opt for this other approach:
phx ; remember to preserve X if you're using it for other things!
lda tile_indices,x ; use a table which holds the index for each tile you want from the buffer
tax ; transfer it to X, X is preferred because it supports long addressing
lda !dss_tile_buffer,x ; load the tile data from !dss_tile_buffer
plx ; get back your previous X
WIP
WIP
WIP