cpct_etm_setTileset2x4

Sets an internal pointer to the tileset that will be used when drawing tilemaps with etm-2x4 functions.

C Definition

void cpct_etm_setTileset2x4 (const void* ptileset) __z88dk_fastcall;

Input Parameters (5 bytes)

(2B HL) ptilesetPointer to the start of the tileset (array of pointers to tile definitions)

Assembly call (Input parameter on HL)

call cpct_etm_setTileset2x4_asm

Parameter Restrictions

  • ptileset could be any 16-bits value, representing the memory address where the tileset is stored.  This function expects the parameter to point to an array of pointers to tile definitions (2-bytes each) , but does not perform any kind of check.  If you provide a pointer to a different kind of data, the result will be undefined behaviour (typically nothing or rubbish will be drawn when tilemap drawing functions get called)

Important details

  • This function MUST be called at least once previous to the use of other EasyTilemap (etm) 2x4 drawing functions.  Otherwise, those functions will use NULL (0x0000) as pointer to the tileset, which will lead to undefined behaviour (typically nothing or rubbish will be drawn on screen).

Details

This function sets the internal pointer tileset that will be used by Easytilemap tile-drawing functions.  The function inserts the pointer value into the required functions’ code to make that functions load the pointer value by default and use it.  Concretely, it modifies the internal code of the cpct_etm_drawTileRow2x4 function.  This also implies that using this function will automatically include cpct_etm_drawTileRow2x4’s code in the created binary.

A tileset is an ordered array of pointers (2-bytes each) to tiles.  Tiles are expected to be defined as 2x4-bytes arrays with screen pixel data.

Destroyed Register values

none

Required memory

2 bytes

Time Measures

   Case     | microSecs (us) | CPU Cycles
-----------------------------------------
   Any      |      9         |    36
-----------------------------------------
Sets an internal pointer to the tileset that will be used when drawing tilemaps with etm-2x4 functions.
Draws a given number of consecutive 2x4-bytes tiles of a tilemap as a row.
Close