2022-04-24 19:45:07 +00:00
|
|
|
* Generic Tile Engine Macros
|
|
|
|
* by Lucas Scharenbroich
|
|
|
|
|
|
|
|
GTEToolNum equ $A0
|
|
|
|
|
|
|
|
_GTEBootInit MAC
|
2022-05-23 04:54:47 +00:00
|
|
|
UserTool $0100+GTEToolNum
|
2022-04-24 19:45:07 +00:00
|
|
|
<<<
|
|
|
|
_GTEStartUp MAC
|
2022-05-23 04:54:47 +00:00
|
|
|
UserTool $0200+GTEToolNum
|
2022-04-24 19:45:07 +00:00
|
|
|
<<<
|
|
|
|
_GTEShutDown MAC
|
2022-05-23 04:54:47 +00:00
|
|
|
UserTool $0300+GTEToolNum
|
2022-04-24 19:45:07 +00:00
|
|
|
<<<
|
|
|
|
_GTEVersion MAC
|
2022-05-23 04:54:47 +00:00
|
|
|
UserTool $0400+GTEToolNum
|
2022-04-24 19:45:07 +00:00
|
|
|
<<<
|
|
|
|
_GTEReset MAC
|
2022-05-23 04:54:47 +00:00
|
|
|
UserTool $0500+GTEToolNum
|
2022-04-24 19:45:07 +00:00
|
|
|
<<<
|
|
|
|
_GTEStatus MAC
|
2022-05-23 04:54:47 +00:00
|
|
|
UserTool $0600+GTEToolNum
|
2022-04-24 19:45:07 +00:00
|
|
|
<<<
|
|
|
|
_GTEReadControl MAC
|
2022-05-23 04:54:47 +00:00
|
|
|
UserTool $0900+GTEToolNum
|
2022-04-25 16:32:06 +00:00
|
|
|
<<<
|
|
|
|
_GTESetScreenMode MAC
|
2022-05-23 04:54:47 +00:00
|
|
|
UserTool $0A00+GTEToolNum
|
2022-04-29 17:38:04 +00:00
|
|
|
<<<
|
|
|
|
_GTESetTile MAC
|
2022-05-23 04:54:47 +00:00
|
|
|
UserTool $0B00+GTEToolNum
|
2022-04-29 17:38:04 +00:00
|
|
|
<<<
|
|
|
|
_GTESetBG0Origin MAC
|
2022-05-23 04:54:47 +00:00
|
|
|
UserTool $0C00+GTEToolNum
|
2022-04-29 17:38:04 +00:00
|
|
|
<<<
|
|
|
|
_GTERender MAC
|
2022-05-23 04:54:47 +00:00
|
|
|
UserTool $0D00+GTEToolNum
|
2022-04-29 17:38:04 +00:00
|
|
|
<<<
|
2022-05-18 05:34:25 +00:00
|
|
|
_GTELoadTileSet MAC
|
2022-05-23 04:54:47 +00:00
|
|
|
UserTool $0E00+GTEToolNum
|
2022-05-18 05:34:25 +00:00
|
|
|
<<<
|
2022-05-23 04:54:47 +00:00
|
|
|
_GTECreateSpriteStamp MAC
|
|
|
|
UserTool $0F00+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTEAddSprite MAC
|
|
|
|
UserTool $1000+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTEMoveSprite MAC
|
|
|
|
UserTool $1100+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTEUpdateSprite MAC
|
|
|
|
UserTool $1200+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTERemoveSprite MAC
|
|
|
|
UserTool $1300+GTEToolNum
|
2022-06-02 03:24:45 +00:00
|
|
|
<<<
|
|
|
|
_GTEGetSeconds MAC
|
|
|
|
UserTool $1400+GTEToolNum
|
2022-06-22 05:07:33 +00:00
|
|
|
<<<
|
|
|
|
_GTECopyTileToDynamic MAC
|
|
|
|
UserTool $1500+GTEToolNum
|
2022-06-25 16:17:50 +00:00
|
|
|
<<<
|
|
|
|
_GTESetPalette MAC
|
|
|
|
UserTool $1600+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTECopyPicToBG1 MAC
|
|
|
|
UserTool $1700+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTEBindSCBArray MAC
|
|
|
|
UserTool $1800+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTEGetBG0TileMapInfo MAC
|
|
|
|
UserTool $1900+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTEGetScreenInfo MAC
|
|
|
|
UserTool $1A00+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTESetBG1Origin MAC
|
|
|
|
UserTool $1B00+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTEGetTileAt MAC
|
|
|
|
UserTool $1C00+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTESetBG0TileMapInfo MAC
|
|
|
|
UserTool $1D00+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTESetBG1TileMapInfo MAC
|
|
|
|
UserTool $1E00+GTEToolNum
|
|
|
|
<<<
|
2022-06-27 03:08:42 +00:00
|
|
|
_GTEAddTimer MAC
|
|
|
|
UserTool $1F00+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTERemoveTimer MAC
|
|
|
|
UserTool $2000+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTEStartScript MAC
|
|
|
|
UserTool $2100+GTEToolNum
|
|
|
|
<<<
|
2022-06-27 16:25:25 +00:00
|
|
|
_GTESetOverlay MAC
|
|
|
|
UserTool $2200+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTEClearOverlay MAC
|
|
|
|
UserTool $2300+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTEGetTileDataAddr MAC
|
|
|
|
UserTool $2400+GTEToolNum
|
|
|
|
<<<
|
2022-06-27 22:15:27 +00:00
|
|
|
_GTEFillTileStore MAC
|
|
|
|
UserTool $2500+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTERefresh MAC
|
|
|
|
UserTool $2600+GTEToolNum
|
|
|
|
<<<
|
2022-07-06 13:53:50 +00:00
|
|
|
_GTERenderDirty MAC
|
|
|
|
UserTool $2700+GTEToolNum
|
|
|
|
<<<
|
2022-07-16 21:42:41 +00:00
|
|
|
_GTESetBG1Displacement MAC
|
|
|
|
UserTool $2800+GTEToolNum
|
2022-07-13 02:03:30 +00:00
|
|
|
<<<
|
2022-07-22 04:35:53 +00:00
|
|
|
_GTESetBG1Rotation MAC
|
|
|
|
UserTool $2900+GTEToolNum
|
2022-07-16 21:42:41 +00:00
|
|
|
<<<
|
2022-07-22 07:01:34 +00:00
|
|
|
_GTEClearBG1Buffer MAC
|
|
|
|
UserTool $2A00+GTEToolNum
|
|
|
|
<<<
|
|
|
|
_GTESetBG1Scale MAC
|
|
|
|
UserTool $2B00+GTEToolNum
|
|
|
|
<<<
|
2022-08-14 12:45:58 +00:00
|
|
|
_GTEGetAddress MAC
|
|
|
|
UserTool $2C00+GTEToolNum
|
|
|
|
<<<
|
2022-06-25 16:17:50 +00:00
|
|
|
|
|
|
|
; EngineMode definitions
|
|
|
|
; Script definition
|
|
|
|
YIELD equ $8000
|
|
|
|
JUMP equ $4000
|
|
|
|
|
|
|
|
SET_PALETTE_ENTRY equ $0002
|
|
|
|
SWAP_PALETTE_ENTRY equ $0004
|
|
|
|
SET_DYN_TILE equ $0006
|
|
|
|
CALLBACK equ $0010
|
|
|
|
|
|
|
|
; ReadControl return value bits
|
2022-07-06 19:55:27 +00:00
|
|
|
PAD_BUTTON_B equ $0100
|
|
|
|
PAD_BUTTON_A equ $0200
|
|
|
|
PAD_KEY_DOWN equ $0400
|
2022-07-07 22:57:05 +00:00
|
|
|
|
|
|
|
; EngineMode definitions
|
2022-06-25 16:17:50 +00:00
|
|
|
ENGINE_MODE_TWO_LAYER equ $0001
|
|
|
|
ENGINE_MODE_DYN_TILES equ $0002
|
|
|
|
ENGINE_MODE_BNK0_BUFF equ $0004
|
2022-08-02 03:00:54 +00:00
|
|
|
ENGINE_MODE_USER_TOOL equ $8000 ; Communicate if GTE is loaded as a system tool, or a user tool
|
2022-06-25 16:17:50 +00:00
|
|
|
|
2022-07-16 20:22:23 +00:00
|
|
|
; Render flags
|
|
|
|
RENDER_ALT_BG1 equ $0001
|
2022-07-16 21:42:41 +00:00
|
|
|
RENDER_BG1_HORZ_OFFSET equ $0002
|
|
|
|
RENDER_BG1_VERT_OFFSET equ $0004
|
2022-07-22 07:01:34 +00:00
|
|
|
RENDER_BG1_ROTATION equ $0008
|
2022-08-11 19:14:25 +00:00
|
|
|
RENDER_PER_SCANLINE equ $0010
|
|
|
|
|
2022-08-14 12:45:58 +00:00
|
|
|
; GetAddress table IDs
|
|
|
|
scanlineHorzOffset equ $0001
|
2022-07-16 20:22:23 +00:00
|
|
|
|
2022-06-25 16:17:50 +00:00
|
|
|
; Tile constants
|
|
|
|
; TILE_RESERVED_BIT equ $8000
|
|
|
|
TILE_PRIORITY_BIT equ $4000 ; Put tile on top of sprite
|
|
|
|
TILE_FRINGE_BIT equ $2000 ; Unused
|
|
|
|
TILE_SOLID_BIT equ $1000 ; Hint bit used in TWO_LAYER_MODE to optimize rendering
|
|
|
|
TILE_DYN_BIT equ $0800 ; Is this a Dynamic Tile?
|
|
|
|
TILE_VFLIP_BIT equ $0400
|
|
|
|
TILE_HFLIP_BIT equ $0200
|
|
|
|
TILE_ID_MASK equ $01FF
|
|
|
|
TILE_CTRL_MASK equ $FE00
|
|
|
|
|
|
|
|
|
|
|
|
; Sprite constants
|
|
|
|
SPRITE_HIDE equ $2000
|
|
|
|
SPRITE_16X16 equ $1800
|
|
|
|
SPRITE_16X8 equ $1000
|
|
|
|
SPRITE_8X16 equ $0800
|
|
|
|
SPRITE_8X8 equ $0000
|
|
|
|
SPRITE_VFLIP equ $0400
|
|
|
|
SPRITE_HFLIP equ $0200
|
|
|
|
|
|
|
|
; Stamp storage parameters
|
|
|
|
VBUFF_STRIDE_BYTES equ {12*4} ; Each line has 4 slots of 16 pixels + 8 buffer pixels
|
|
|
|
VBUFF_TILE_ROW_BYTES equ {8*VBUFF_STRIDE_BYTES} ; Each row is comprised of 8 lines
|
|
|
|
VBUFF_TILE_COL_BYTES equ 4
|
|
|
|
VBUFF_SPRITE_STEP equ {VBUFF_TILE_ROW_BYTES*3} ; Allocate space for 16 rows + 8 rows of buffer
|
|
|
|
VBUFF_SPRITE_START equ {VBUFF_TILE_ROW_BYTES+4} ; Start at an offset so $0000 can be used as an empty value
|
|
|
|
VBUFF_SLOT_COUNT equ 48 ; Have space for this many stamps
|