Tilemap functions.

Tilemap format

map width(2 bytes) horizontal tile count
map height(2 bytes) vertical tile count
wrap mode(1 byte) Indicates if the horizontal or vertical coordinates should wrap around the origin.
map data(N bytes) Tile indices.

For a 8x8 tilemap, the tile indices are just the offset to a VRAM tile.  On the other hand, for a 16x16 tilemap, the tile indices are the offset to a bloc of 4 consecutive VRAM tiles that will make the 16x16 map tile.

The tiles palette array specify the index of the palette to use for a given tile.  For 16x16 tilemap, the palette index will be used for all 4 VRAM tile.

Summary
Tilemap functions.
Macros
map_setSet current map pointers and infos.
map_copyMap copy helper macro.
map_copy_1616x16 tilemap copy helper macro.
Functions
map_set_bat_boundsDefines the vertical bounds of the BAT map area.
map_loadLoad a portion of a 8x8 tilemap to VRAM.
map_load_16Load a portion of a 16x16 tilemap to VRAM.

Macros

map_set

Set current map pointers and infos.

Assembly call

map_set map, tile, colortab, w, h, m

Parameters

mapMap base address
tiletiles VRAM address
colortabtiles palette table address
wMap width
hMap height
mMap coordinate wrapping mode

map_copy

Map copy helper macro.

Assembly call

map_copy bx, by, mx, my, w, h

Parameters

bxBAT X position.
byBAT Y position.
mxMap X position.
myMap Y position.
wNumber of column to copy.
hNumber of line to copy.

map_copy_16

16x16 tilemap copy helper macro.

Assembly call

map_copy_16 bx, by, mx, my, w, h

Parameters

bxBAT X position.
byBAT Y position.
mxMap X position.
myMap Y position.
wNumber of column to copy.
hNumber of line to copy.

Functions

map_set_bat_bounds

Defines the vertical bounds of the BAT map area.  By default the upper and lower bounds are set to 0 and vdc_bat_height.

Note

This routine must be called whenever the BAT area size is modified.

Parameters

XVertical upper bound (top).
AVertical lower bound (bottom).

map_load

Load a portion of a 8x8 tilemap to VRAM.

Parameters

_alBAT X position.
_ahBAT Y position.
_clMap X position.
_chMap Y position.
_dlNumber of column to copy.
_dhNumber of row to copy.

map_load_16

Load a portion of a 16x16 tilemap to VRAM.

Parameters

_alBAT X position.
_ahBAT Y position.
_clMap X position.
_chMap Y position.
_dlNumber of column to copy.
_dhNumber of row to copy.
Close