iigs-game-engine/src/render
Lucas Scharenbroich 4ee67fb8be Add hook for VBL callback 2023-05-09 10:16:58 -05:00
..
Dirty.s Fix typo that caused sprite to render above a tile with priority set; only for dirty tiles 2022-07-08 12:37:06 -05:00
Dynamic.s Comment cleanup and minro refactoring 2023-04-28 00:13:05 -05:00
Fast.s Restore BG1 rotation code 2022-07-12 21:03:30 -05:00
README.txt Checkpoint of final tile proc reorg for generalize new infrastructure for different engine modes 2022-06-20 15:55:09 -05:00
Render.s Add hook for VBL callback 2023-05-09 10:16:58 -05:00
Slow.s Transition to fixed snippets 2023-03-02 23:24:03 -06:00
Sprite1.s Add in all the two-layer tile renderers; update complete. Just need to test 2022-06-23 11:31:42 -05:00
Sprite2.s Remove dead code and implement Slow tile renderers in terms of the Fast once to avoid code bloat 2022-06-21 13:33:17 -05:00
Sprite3.s Remove dead code and implement Slow tile renderers in terms of the Fast once to avoid code bloat 2022-06-21 13:33:17 -05:00
Sprite4.s Checkpoint of final tile proc reorg for generalize new infrastructure for different engine modes 2022-06-20 15:55:09 -05:00
TwoLayer.s Transition to fixed snippets 2023-03-02 23:24:03 -06:00

README.txt

This folder contains the rendering tuples for the different type of tile rendering modes
that are defined by both the engine mode and the specific tile attributes.  There are
a *lot* or variants, so they are cataloged here.

The top-level TileRender function in the main entry point that defined the overal tile render
flow as well as the register parameters and calling conventions for each of the modular 
components.

There are 5 pluggable functions that make up a rendering mode

1. K_TS_BASE_TILE_DISP

   An address to a function that will render a tile into the code field.  There are no
   sprites to handle in this case.

   Arguments:
     A: TileData/TileMask address
     B: code field bank
     Y: address of the tile in the code bank
     X: TileStore offset

   Return:
     None

   If additional TileStore properties are needed for the renderer, they can be read using the X
   register.

2. K_TS_SPRITE_TILE_DISP

   Selects the top-level handler for rendering a tile with a sprite.  Currently, this is used to
   select between rendering a sprite above the tile, or under the tile based on the value of the
   TILE_PRIORITY_BIT.

    Arguments:
     A: TileStore+TS_SPRITE_FLAG
     X: TileStore offset

    Return:
     Y: TileStore offset
     sprite_ptrX dirct page values set to the sprite VBuff addresses

   The handler routine is responsible for examining the TS_SPRITE_FLAG value and dispatching
   to an appropriate routine to handle the number of sprites intersecting the tile.

3. K_TS_ONE_SPRITE

   A specialized routine when K_TS_SPRITE_TILE_DISP determines there is only one sprite to render
   it MUST dispatch to this function.  The K_TS_ONE_SPRITE routine MAY make use of the K_TS_COPY_TILE_DATA
   and K_TS_APPLY_TILE_DATA functions, but is not required to do so.

4. K_TS_COPY_TILE_DATA & K_TS_APPLY_TILE_DATA

   A pair of function that copye tile data (and possible mask information) into a temporary
   direct page space and then render that workspace into the code field.

   These functions are used as building blocks by the generic Over/Under multi-sprite
   rendering code.

   K_TS_COPY_TILE_DATA
     Arguments:
      B: Set to the TileData bank
      Y: Set to the tile address
     Return:
      X: preserve the X register

   K_TS_APPLY_TILE_DATA
     Arguments:
        B: code field bank
        Y: address of the tile in the code bank
     Return:
        None



Generic Flow

  1. Is there a sprite?
     No -> Call K_TS_BASE_TILE_DISP to render a tile into the code field

     Yes -> Call K_TS_SPRITE_TILE_DISP

      Over  : Copy tile data + mask to DP, Copy sprite data + mask to DP, render tile to code field
      Under : Copy sprite data to DP,