; Collection of the EXTernal labels exported by GTE.  This is the closest thing
; we have to an API definition.

EngineStartUp      EXT
EngineShutDown     EXT

SetScreenMode      EXT
ReadControl        EXT

; Low-Level Functions
SetPalette         EXT
GetVBLTicks        EXT
GetVerticalCounter EXT
SetBorderColor     EXT

; Tilemap functions
SetBG0XPos         EXT
SetBG0YPos         EXT
SetBG1XPos         EXT
SetBG1YPos         EXT
CopyBG0Tile        EXT
CopyBG1Tile        EXT
CopyTileToDyn      EXT
Render             EXT

; SCB/Palette binding (high bit of array point indicates whether to bind to BG0 Y position (0)
; or BG1 Y position (1).
SetSCBArray        EXT
BltSCB             EXT

; Rotation
ApplyBG1XPosAngle  EXT
ApplyBG1YPosAngle  EXT

CopyPicToField     EXT
CopyBinToField     EXT
CopyPicToBG1       EXT
CopyBinToBG1       EXT

AddTimer           EXT
RemoveTimer        EXT
DoTimers           EXT

StartScript        EXT
StopScript         EXT

; Sprite functions
AddSprite          EXT
MoveSprite         EXT    ; Set an existing sprite's position
UpdateSprite       EXT    ; Change an existing sprite's flags
RemoveSprite       EXT

; Direct access to internals
DoScriptSeq        EXT
GetTileAddr        EXT

PushDirtyTile      EXT    ; A = address from GetTileStoreOffset, marks as dirty (will not mark the same tile more than once)
PopDirtyTile       EXT    ; No args, returns Y with tile store offset of the dirty tile
ApplyTiles         EXT    ; Drain the dirty tile queue and call RenderTile on each
GetTileStoreOffset EXT    ; X = column, Y = row
TileStore          EXT    ; Tile store internal data structure

RenderDirty        EXT    ; Render only dirty tiles + sprites directly to the SHR screen

; GetSpriteVBuffAddr EXT    ; X = x-coordinate (0 - 159), Y = y-coordinate (0 - 199). Return in Acc.

; Allocate a full 64K bank
AllocBank          EXT

; Data references
;
; Super Hires line address lookup table for convenience
ScreenAddr         EXT
OneSecondCounter   EXT
BlitBuff           EXT

;; Helper function to load the GTE User Toolset
;GTEInstall
;                   php
;                   ~InitialLoad userId;localToolPath;#0

;                   pea       $8000                ; User tool
;                   pea       $00A5                ; Tool 165
;                   PushLong  toolPtr
;                   _SetTSPtr
                   
;                   plp
;                   rtl

; Look for the tool set in the System Tools folder and then next to the application
;sysToolPath        strl       '*:System:Tools:ToolGTE'
;localToolPath      strl       '9:ToolGTE'
;toolPtr            adrl       0