iigs-game-engine/src/GTE.s
Lucas Scharenbroich 95058fb969 Checkpoint for sprite rewrite
All of the sprite rendering has been deferred down to the level of
the tile drawing. Sprites are no longer drawn/erased, but instead
a sprite sheet is generated in AddSprite and referenced by the
renderer.

Because there is no longer a single off-screen buffer that holds
a copy of all the rendered sprites, the TileStore size must be
expanded to hold a reference to the sprite data address fo each
tile.  This increase in data structure size require the TileStore
to be put into its own bank and appropriate code restructuring.

The benefits to the rewrite are significant:

  1. Sprites are never drawn/erased off-screen.  They are only
     ever drawn directly to the screen or play field.
  2. The concept of "damaged" sprites is gone.  Every dirty tile
     automatically renders just to portion of a sprite that it
     intersects.

These two properties result in a substantial increase in throughput.
2022-02-18 12:12:32 -06:00

94 lines
2.6 KiB
ArmAsm

; 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
RenderTile EXT ; Y = address from GetTileStoreOffset
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