sgdk
vdp_tile.h File Reference

VDP General Tile / Tilemap operations. More...

#include "vdp.h"
#include "dma.h"

Go to the source code of this file.

Classes

struct  TileSet
 Tile set structure which contains tiles definition.
Use the unpackTileSet() method to unpack if compression is enabled. More...
struct  TileMap
 TileMap structure which contains tilemap background definition.
Use the unpackTileMap() method to unpack if compression is enabled. More...

Defines

#define TILE_ATTR_PRIORITY_SFT   15
 Bit shift for the tile priority attribute in tilemap data.
#define TILE_ATTR_PALETTE_SFT   13
 Bit shift for the tile palette attribute in tilemap data.
#define TILE_ATTR_VFLIP_SFT   12
 Bit shift for the tile V flip attribute in tilemap data.
#define TILE_ATTR_HFLIP_SFT   11
 Bit shift for the tile H flip attribute in tilemap data.
#define TILE_ATTR_PRIORITY_MASK   (1 << TILE_ATTR_PRIORITY_SFT)
 Mask for the tile priority attribute in tilemap data.
#define TILE_ATTR_PALETTE_MASK   (3 << TILE_ATTR_PALETTE_SFT)
 Mask for the tile palette attribute in tilemap data.
#define TILE_ATTR_VFLIP_MASK   (1 << TILE_ATTR_VFLIP_SFT)
 Mask for the tile V flip attribute in tilemap data.
#define TILE_ATTR_HFLIP_MASK   (1 << TILE_ATTR_HFLIP_SFT)
 Mask for the tile H flip attribute in tilemap data.
#define TILE_ATTR_MASK   (TILE_ATTR_PRIORITY_MASK | TILE_ATTR_PALETTE_MASK | TILE_ATTR_VFLIP_MASK | TILE_ATTR_HFLIP_MASK)
 Mask for the tile attributes (priority, palette and flip) in tilemap data.
#define TILE_ATTR(pal, prio, flipV, flipH)   (((flipH) << TILE_ATTR_HFLIP_SFT) + ((flipV) << TILE_ATTR_VFLIP_SFT) + ((pal) << TILE_ATTR_PALETTE_SFT) + ((prio) << TILE_ATTR_PRIORITY_SFT))
 Encode tile attributes for tilemap data.
#define TILE_ATTR_FULL(pal, prio, flipV, flipH, index)   (((flipH) << TILE_ATTR_HFLIP_SFT) + ((flipV) << TILE_ATTR_VFLIP_SFT) + ((pal) << TILE_ATTR_PALETTE_SFT) + ((prio) << TILE_ATTR_PRIORITY_SFT) + (index))
 Encode tile attributes for tilemap data.

Functions

u16 VDP_getPlaneAddress (VDPPlane plane, u16 x, u16 y)
 Return the VRAM tilemap address for the specified plane position.
void VDP_loadTileData (const u32 *data, u16 index, u16 num, TransferMethod tm)
 Load tile data (pattern) in VRAM.
u16 VDP_loadTileSet (const TileSet *tileset, u16 index, TransferMethod tm)
 Load tile data (pattern) in VRAM.
void VDP_loadFontData (const u32 *font, u16 length, TransferMethod tm)
 Load font tile data in VRAM.
Note that you should prefer the VDP_loadBMPFont(..) method to this one (easier to use).
u16 VDP_loadFont (const TileSet *font, TransferMethod tm)
 Load font from the specified TileSet structure.
void VDP_loadBMPTileData (const u32 *data, u16 index, u16 w, u16 h, u16 bmp_w)
 Load 4bpp bitmap tile data in VRAM.
void VDP_loadBMPTileDataEx (const u32 *data, u16 index, u16 x, u16 y, u16 w, u16 h, u16 bmp_w)
 Load 4bpp bitmap tile data in VRAM.
void VDP_fillTileData (u8 value, u16 index, u16 num, bool wait)
 Fill tile data in VRAM.
void VDP_clearTileMap (u16 planeAddr, u16 ind, u16 num, bool wait)
 Clear tilemap.
void VDP_fillTileMap (u16 planeAddr, u16 tile, u16 ind, u16 num)
 Fill tilemap.
void VDP_setTileMapData (u16 planeAddr, const u16 *data, u16 ind, u16 num, u16 vramStep, TransferMethod tm)
 Set tilemap data at specified index.
void VDP_setTileMapDataEx (u16 planeAddr, const u16 *data, u16 basetile, u16 ind, u16 num, u16 vramStep)
 Set tilemap data at specified index (extended version).
void VDP_setTileMapXY (VDPPlane plane, u16 tile, u16 x, u16 y)
 Set tilemap data (single position).
void VDP_clearTileMapRect (VDPPlane plane, u16 x, u16 y, u16 w, u16 h)
 Clear specified region of tilemap.
void VDP_fillTileMapRect (VDPPlane plane, u16 tile, u16 x, u16 y, u16 w, u16 h)
 Fill speficied region of tilemap.
void VDP_fillTileMapRectInc (VDPPlane plane, u16 basetile, u16 x, u16 y, u16 w, u16 h)
 Fill tilemap with index auto increment at specified region.
void VDP_setTileMapDataRect (VDPPlane plane, const u16 *data, u16 x, u16 y, u16 w, u16 h, u16 wm, TransferMethod tm)
 Set tilemap data for specified region.
void VDP_setTileMapDataRectEx (VDPPlane plane, const u16 *data, u16 basetile, u16 x, u16 y, u16 w, u16 h, u16 wm, TransferMethod tm)
 Set tilemap data for specified region (extended version).
void VDP_setTileMapDataRow (VDPPlane plane, const u16 *data, u16 row, u16 x, u16 w, TransferMethod tm)
 Set a row of tilemap data.
void VDP_setTileMapDataRowEx (VDPPlane plane, const u16 *data, u16 basetile, u16 row, u16 x, u16 w, TransferMethod tm)
 Set a row of tilemap data - extended version.
void VDP_setTileMapDataColumnFast (VDPPlane plane, u16 *data, u16 column, u16 y, u16 h, TransferMethod tm)
 Set a complete column of pre-arranged tilemap data (not supported when plane width is set to 128).
void VDP_setTileMapDataColumn (VDPPlane plane, const u16 *data, u16 column, u16 y, u16 h, u16 wm, TransferMethod tm)
 Set a column of tilemap data (not supported when plane width is set to 128).
void VDP_setTileMapDataColumnEx (VDPPlane plane, const u16 *data, u16 basetile, u16 column, u16 y, u16 h, u16 wm, TransferMethod tm)
 Set a column of tilemap data - extended version (not supported when plane width is set to 128).
bool VDP_setTileMap (VDPPlane plane, const TileMap *tilemap, u16 x, u16 y, u16 w, u16 h, TransferMethod tm)
 Load tilemap region.
bool VDP_setTileMapEx (VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 xp, u16 yp, u16 x, u16 y, u16 w, u16 h, TransferMethod tm)
 Load tilemap region at specified plane position.
bool VDP_setTileMapRow (VDPPlane plane, const TileMap *tilemap, u16 row, u16 x, u16 w, TransferMethod tm)
 Load tilemap row.
bool VDP_setTileMapRowEx (VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 row, u16 x, u16 y, u16 w, TransferMethod tm)
 Load tilemap row (extended version).
bool VDP_setTileMapColumn (VDPPlane plane, const TileMap *tilemap, u16 column, u16 y, u16 h, TransferMethod tm)
 Load tilemap column (not supported when plane width is set to 128).
bool VDP_setTileMapColumnEx (VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 column, u16 x, u16 y, u16 h, TransferMethod tm)
 Load tilemap column - extended version (not supported when plane width is set to 128).
bool VDP_setMap (VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 x, u16 y)
bool VDP_setMapEx (VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 x, u16 y, u16 xm, u16 ym, u16 wm, u16 hm)

Detailed Description

VDP General Tile / Tilemap operations.

Author:
Stephane Dallongeville
Date:
08/2011

This unit provides methods to manipulate VDP tiles and tilemap :

  • upload tiles to VDP memory
  • upload tiles to VDP memory from bitmap data
  • clear / fill / set tile map data

Define Documentation

#define TILE_ATTR (   pal,
  prio,
  flipV,
  flipH 
)    (((flipH) << TILE_ATTR_HFLIP_SFT) + ((flipV) << TILE_ATTR_VFLIP_SFT) + ((pal) << TILE_ATTR_PALETTE_SFT) + ((prio) << TILE_ATTR_PRIORITY_SFT))

Encode tile attributes for tilemap data.

Parameters:
palPalette index
prioTile priority
flipVVertical flip
flipHHorizontal flip
#define TILE_ATTR_FULL (   pal,
  prio,
  flipV,
  flipH,
  index 
)    (((flipH) << TILE_ATTR_HFLIP_SFT) + ((flipV) << TILE_ATTR_VFLIP_SFT) + ((pal) << TILE_ATTR_PALETTE_SFT) + ((prio) << TILE_ATTR_PRIORITY_SFT) + (index))

Encode tile attributes for tilemap data.

Parameters:
palPalette index
prioTile priority
flipVVertical flip
flipHHorizontal flip
indexTile index

Function Documentation

void VDP_clearTileMap ( u16  planeAddr,
u16  ind,
u16  num,
bool  wait 
)

Clear tilemap.

Parameters:
planeAddrPlane address where we want to clear tilemap.
Accepted values are:
  • VDP_BG_A
  • VDP_BG_B
  • VDP_WINDOW
indTile index where to start clear.
numNumber of tile to clear.
waitWait the operation to complete when set to TRUE otherwise it returns immediately but then you will require to wait for DMA completion (DMA_waitCompletion()) before accessing the VDP.
See also:
VDP_clearTileMapRect()
VDP_fillTileMap()
void VDP_clearTileMapRect ( VDPPlane  plane,
u16  x,
u16  y,
u16  w,
u16  h 
)

Clear specified region of tilemap.

Parameters:
planePlane where we want to clear tilemap region.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
xRegion X start position (in tile).
yRegion Y start position (in tile).
wRegion Width (in tile).
hRegion Heigh (in tile).
See also:
VDP_clearTileMap() (faster method)
void VDP_fillTileData ( u8  value,
u16  index,
u16  num,
bool  wait 
)

Fill tile data in VRAM.

Parameters:
valueValue (byte) used to fill VRAM tile data.
indexTile index where start tile data fill (use TILE_USERINDEX as base user index).
numNumber of tile to fill.
waitWait the operation to complete when set to TRUE otherwise it returns immediately but then you will require to wait for DMA completion (DMA_waitCompletion()) before accessing the VDP.

This function is generally used to clear tile data in VRAM.

void VDP_fillTileMap ( u16  planeAddr,
u16  tile,
u16  ind,
u16  num 
)

Fill tilemap.

Parameters:
planeAddrPlane address where we want to fill tilemap.
Accepted values are:
  • VDP_BG_A
  • VDP_BG_B
  • VDP_WINDOW
tileTile attributes (see TILE_ATTR_FULL() and TILE_ATTR() macros).
indtile index where to start fill.
numNumber of tile to fill.
See also:
VDP_fillTileMapRect()
void VDP_fillTileMapRect ( VDPPlane  plane,
u16  tile,
u16  x,
u16  y,
u16  w,
u16  h 
)

Fill speficied region of tilemap.

Parameters:
planePlane where we want to fill tilemap region.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
tiletile attributes (see TILE_ATTR_FULL() and TILE_ATTR() macros).
xRegion X start position (in tile).
yRegion Y start position (in tile).
wRegion Width (in tile).
hRegion Heigh (in tile).

Fill the specified tilemap region with specified tile attributes value.

See also:
VDP_fillTileMap() (faster method)
VDP_fillTileMapRectInc()
void VDP_fillTileMapRectInc ( VDPPlane  plane,
u16  basetile,
u16  x,
u16  y,
u16  w,
u16  h 
)

Fill tilemap with index auto increment at specified region.

Parameters:
planePlane where we want to fill tilemap region.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
basetileBase tile attributes (see TILE_ATTR_FULL() and TILE_ATTR() macros).
xRegion X start position (in tile).
yRegion Y start position (in tile).
wRegion Width (in tile).
hRegion Heigh (in tile).

Set the specified tilemap region with specified tile attributes value.
The function auto increments tile index in tile attributes like this:
tilemap line 0 : basetile, basetile+1, basetile+2, basetile+3, ...
tilemap line 1 : basetile+w, basetile+w+1, basetile+w+2, ...
...
So this function is convenient to display generated image or simulate a frame buffer.

See also:
also VDP_fillTileMapRect()
u16 VDP_getPlaneAddress ( VDPPlane  plane,
u16  x,
u16  y 
)

Return the VRAM tilemap address for the specified plane position.

Parameters:
planePlane we want to get the VRAM tilemap address for a given position.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
xX position (in tile).
yY position (in tile).
void VDP_loadBMPTileData ( const u32 data,
u16  index,
u16  w,
u16  h,
u16  bmp_w 
)

Load 4bpp bitmap tile data in VRAM.

Parameters:
dataPointer to 4bpp bitmap tile data.
indexTile index where start tile data load (use TILE_USERINDEX as base user index).
wWidth of bitmap region to load (in tile).
hHeigh of bitmap region to load (in tile).
bmp_wWidth of bitmap (in tile), it can differ from 'w' parameter.

This function does "on the fly" 4bpp bitmap conversion to tile data and transfert them to VRAM.
It's very helpful when you use bitmap images but the conversion eats sometime so you should use it only for static screen only.
For "in-game" condition you should use VDP_loadTileData() method with converted tile data.
See also VDP_loadBMPTileDataEx().

void VDP_loadBMPTileDataEx ( const u32 data,
u16  index,
u16  x,
u16  y,
u16  w,
u16  h,
u16  bmp_w 
)

Load 4bpp bitmap tile data in VRAM.

Parameters:
dataPointer to 4bpp bitmap tile data.
indexTile index where start tile data load (use TILE_USERINDEX as base user index).
xX start position of bitmap region to load (in tile).
yY start position of bitmap region to load (in tile).
wWidth of bitmap region to load (in tile).
hHeigh of bitmap region to load (in tile).
bmp_wWidth of bitmap (in tile), it can differ from 'w' parameter.

This function does "on the fly" 4bpp bitmap conversion to tile data and transfert them to VRAM.
It's very helpful when you use bitmap images but the conversion eats sometime so you should use it only for static screen only.
For "in-game" condition you should use VDP_loadTileData() method with converted tile data. See also VDP_loadBMPTileData()

u16 VDP_loadFont ( const TileSet font,
TransferMethod  tm 
)

Load font from the specified TileSet structure.

Parameters:
fontTileSet containing the font.
The TileSet is unpacked "on-the-fly" if needed (require some memory).
Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first.
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY
Returns:
FALSE if there is not enough memory to unpack the specified font (only if compression was enabled).

This fonction permits to replace system font by user font.
The font tile data are loaded to TILE_FONTINDEX and can contains FONT_LEN characters at max.
Each character should fit in one tile (8x8 pixels bloc).
See also VDP_loadFontData(..)

void VDP_loadFontData ( const u32 font,
u16  length,
TransferMethod  tm 
)

Load font tile data in VRAM.
Note that you should prefer the VDP_loadBMPFont(..) method to this one (easier to use).

Parameters:
fontPointer to font tile data.
lengthNumber of characters of the font (max = FONT_LEN).
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY

This fonction permits to replace system font by user font.
The font tile data are loaded to TILE_FONTINDEX and can contains FONT_LEN characters at max.
Each character should fit in one tile (8x8 pixels bloc).
See also VDP_loadFont(..) and VDP_loadTileData(..)

void VDP_loadTileData ( const u32 data,
u16  index,
u16  num,
TransferMethod  tm 
)

Load tile data (pattern) in VRAM.

Parameters:
dataPointer to tile data.
indexTile index where start tile data load (use TILE_USERINDEX as base user index).
numNumber of tile to load.
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY

Transfert rate:
~90 bytes per scanline in software (during blanking)
~190 bytes per scanline in hardware (during blanking)

u16 VDP_loadTileSet ( const TileSet tileset,
u16  index,
TransferMethod  tm 
)

Load tile data (pattern) in VRAM.

Parameters:
tilesetPointer to TileSet structure.
The TileSet is unpacked "on-the-fly" if needed (require some memory).
Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first.
indexTile index where start tile data load (use TILE_USERINDEX as base user index).
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY
Returns:
FALSE if there is not enough memory to unpack the specified TileSet (only if compression was enabled).

Transfert rate:
~90 bytes per scanline in software (during blanking)
~190 bytes per scanline in hardware (during blanking)

bool VDP_setMap ( VDPPlane  plane,
const TileMap tilemap,
u16  basetile,
u16  x,
u16  y 
)
bool VDP_setMapEx ( VDPPlane  plane,
const TileMap tilemap,
u16  basetile,
u16  x,
u16  y,
u16  xm,
u16  ym,
u16  wm,
u16  hm 
)
bool VDP_setTileMap ( VDPPlane  plane,
const TileMap tilemap,
u16  x,
u16  y,
u16  w,
u16  h,
TransferMethod  tm 
)

Load tilemap region.

Parameters:
planePlane where we want to load tilemap.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
tilemapSource tilemap to load.
The TileMap is unpacked "on-the-fly" if needed (require some memory).
Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first.
xRegion X start position (in tile).
yRegion Y start position (in tile).
wRegion Width (in tile).
hRegion Heigh (in tile).
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY

Load the specified tilemap region at equivalent plane position (tilemap wrapping supported).
You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapEx(..) which allow to override base tile attributes though the 'basetile' parameter.

See also:
VDP_setTileMapData()
VDP_setTileMapDataEx()
bool VDP_setTileMapColumn ( VDPPlane  plane,
const TileMap tilemap,
u16  column,
u16  y,
u16  h,
TransferMethod  tm 
)

Load tilemap column (not supported when plane width is set to 128).

Parameters:
planePlane where we want to load tilemap.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
tilemapSource tilemap to set column from.
The TileMap is unpacked "on-the-fly" if needed (require some memory).
Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first.
columnPlane column we want to set data
ySource tilemap Y start position (in tile).
hColumn height to update (in tile)
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY

Load a complete column of data from tilemap at equivalent plane position (wrapped around if needed).
You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapColumnEx(..) which allow to override base tile attributes though the 'basetile' parameter.
WARNING: this function doesn't work when plane width is set to 128 (see VDP_setPlaneSize(..) method)

See also:
VDP_setTileMapColumnEx()
VDP_setMapRow()
VDP_setTileMapDataColumn()
bool VDP_setTileMapColumnEx ( VDPPlane  plane,
const TileMap tilemap,
u16  basetile,
u16  column,
u16  x,
u16  y,
u16  h,
TransferMethod  tm 
)

Load tilemap column - extended version (not supported when plane width is set to 128).

Parameters:
planePlane where we want to load tilemap.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
tilemapSource tilemap to set column from.
The TileMap is unpacked "on-the-fly" if needed (require some memory).
Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first.
basetileBase index and flag for tile attributes (see TILE_ATTR_FULL() macro).
columnPlane column we want to set data
xSource tilemap X / column position (in tile), can be different than plane column if desired.
ySource tilemap Y start position (in tile).
hColumn height to update (in tile)
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY
    But i highly discourage of using DMA here as VDP_setTileMapColumnEx(..) requires to prepare data in a temporary buffer first
    to use DMA, resulting in a slower process than using CPU. However DMA_QUEUE is very useful as it wil prepare the data
    and transfer the data as fast as possible during VBlank.

Load a complete column of data from tilemap at equivalent plane position (wrapped around if needed).
Unlike VDP_setTileMapColumn(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMapColumn(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation.
WARNING: this function doesn't work when plane width is set to 128 (see VDP_setPlaneSize(..) method)

See also:
VDP_setTileMapColumn()
VDP_setMapRowEx()
VDP_setTileMapDataColumnEx()
void VDP_setTileMapData ( u16  planeAddr,
const u16 data,
u16  ind,
u16  num,
u16  vramStep,
TransferMethod  tm 
)

Set tilemap data at specified index.

Parameters:
planeAddrPlane address where we want to set tilemap data.
Accepted values are:
  • VDP_BG_A
  • VDP_BG_B
  • VDP_WINDOW
dataTile attributes data (see TILE_ATTR_FULL() and TILE_ATTR() macros).
indTile index where to start to set tilemap data.
numNumber of tile to set.
vramStepVRAM address increment after each write (default value = 2)
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY

Set the specified tilemap with specified tile attributes values.
You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapDataEx(..) which allow to override base tile attributes though the 'basetile' parameter.

See also:
VDP_setTileMapDataEx().
VDP_setTileMapDataRect().
void VDP_setTileMapDataColumn ( VDPPlane  plane,
const u16 data,
u16  column,
u16  y,
u16  h,
u16  wm,
TransferMethod  tm 
)

Set a column of tilemap data (not supported when plane width is set to 128).

Parameters:
planePlane where we want to set tilemap data.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
dataSource tilemap data containing tile attributes (see TILE_ATTR_FULL() macro).
columnPlane column we want to set data
yColumn Y start position (in tile)
hColumn height to update (in tile)
wmSource tilemap width (in tile).
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY

Set a column of tilemap data (tilemap wrapping supported) with given tile attributes values.
You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base tile attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapDataColumnEx(..) which allow to override base tile attributes though the 'basetile' parameter.
WARNING: this function doesn't work when plane width is set to 128 (see VDP_setPlaneSize(..) method)

See also:
VDP_setTileMapDataColumnPartEx()
VDP_setTileMapDataColumn()
void VDP_setTileMapDataColumnEx ( VDPPlane  plane,
const u16 data,
u16  basetile,
u16  column,
u16  y,
u16  h,
u16  wm,
TransferMethod  tm 
)

Set a column of tilemap data - extended version (not supported when plane width is set to 128).

Parameters:
planePlane where we want to set tilemap data.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
dataSource tilemap data containing tile attributes (see TILE_ATTR_FULL() macro).
basetileBase index and flag for tile attributes (see TILE_ATTR_FULL() macro).
columnPlane column we want to set data
yColumn Y start position (in tile)
hColumn height to update (in tile)
wmSource tilemap width (in tile).
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY
    But i highly discourage of using DMA here as VDP_setTileMapDataColumnEx(..) requires to prepare data in a temporary buffer first
    to use DMA, resulting in a slower process than using CPU. However DMA_QUEUE is very useful as it wil prepare the data
    and transfer the data as fast as possible during VBlank.

Set a column of tilemap data (tilemap wrapping supported) with given tile attributes values.
Unlike VDP_setTileMapDataColumn(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMapDataColumn(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation. WARNING: this function doesn't work when plane width is set to 128 (see VDP_setPlaneSize(..) method)

See also:
VDP_setTileMapDataColumnPart()
VDP_setTileMapDataColumnEx()
VDP_setTileMapData()
void VDP_setTileMapDataColumnFast ( VDPPlane  plane,
u16 data,
u16  column,
u16  y,
u16  h,
TransferMethod  tm 
)

Set a complete column of pre-arranged tilemap data (not supported when plane width is set to 128).

Parameters:
planePlane where we want to set tilemap data.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
dataPrepared tile attributes data (see TILE_ATTR_FULL() macro).
Column data are already arranged to be transferred as a single contiguous data block.
columnPlane column we want to set data
yColumn Y start position (in tile)
hColumn height to update (in tile)
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY

Set a complete column of tilemap data with given tile attributes values.
This method is faster than VDP_setTileMapDataColumn(..) or VDP_setTileMapDataColumnEx(..) as it assumes
that data buffer is properly prepared and arranged to be directly copied as it.
WARNING: this function doesn't work when plane width is set to 128 (see VDP_setPlaneSize(..) method).

See also:
VDP_setTileMapDataRowFast()
VDP_setTileMapDataColumn()
VDP_setTileMapData()
void VDP_setTileMapDataEx ( u16  planeAddr,
const u16 data,
u16  basetile,
u16  ind,
u16  num,
u16  vramStep 
)

Set tilemap data at specified index (extended version).

Parameters:
planeAddrPlane where we want to set tilemap data.
Accepted values are:
  • VDP_BG_A
  • VDP_BG_B
  • VDP_WINDOW
dataTile attributes data (see TILE_ATTR_FULL() and TILE_ATTR() macros).
basetileBase tile index and flag for tile attributes (see TILE_ATTR_FULL() macro).
indTile index where to start to set tilemap data.
numNumber of tile to set.
vramStepVRAM address increment after each write (default value = 2).

Set the specified tilemap with specified tile attributes values.
Unlike VDP_setTileMapData(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMapData(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation.

See also:
VDP_setTileMapData()
VDP_setTileMapDataRectEx()
void VDP_setTileMapDataRect ( VDPPlane  plane,
const u16 data,
u16  x,
u16  y,
u16  w,
u16  h,
u16  wm,
TransferMethod  tm 
)

Set tilemap data for specified region.

Parameters:
planePlane where we want to set tilemap data.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
dataSource tilemap data containing tile attributes (see TILE_ATTR_FULL() macro).
xRegion X start position (in tile).
yRegion Y start position (in tile).
wRegion Width (in tile).
hRegion Heigh (in tile).
wmSource tilemap width (in tile).
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY

Set the specified tilemap region (tilemap wrapping supported) with specified tile attributes values.
You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapDataRectEx(..) which allow to override base tile attributes though the 'basetile' parameter.

See also:
VDP_setTileMapDataRectEx().
VDP_setTileMapData().
void VDP_setTileMapDataRectEx ( VDPPlane  plane,
const u16 data,
u16  basetile,
u16  x,
u16  y,
u16  w,
u16  h,
u16  wm,
TransferMethod  tm 
)

Set tilemap data for specified region (extended version).

Parameters:
planePlane where we want to set tilemap data.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
dataSource tilemap data containing tile attributes (see TILE_ATTR_FULL() macro).
basetileBase index and flag for tile attributes (see TILE_ATTR_FULL() macro).
xRegion X start position (in tile).
yRegion Y start position (in tile).
wRegion Width (in tile).
hRegion Heigh (in tile).
wmSource tilemap width (in tile).
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY
    But i highly discourage of using DMA here as VDP_setTileMapDataRectEx(..) requires to prepare data in a temporary buffer first
    to use DMA, resulting in a slower process than using CPU. However DMA_QUEUE is very useful as it wil prepare the data
    and transfer the data as fast as possible during VBlank.

Set the specified tilemap region (tilemap wrapping supported) with specified tile attributes values.
Unlike VDP_setTileMapDataRect(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMapDataRect(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation.

See also:
VDP_setTileMapDataRect()
VDP_setTileMapDataEx()
void VDP_setTileMapDataRow ( VDPPlane  plane,
const u16 data,
u16  row,
u16  x,
u16  w,
TransferMethod  tm 
)

Set a row of tilemap data.

Parameters:
planePlane where we want to set tilemap data.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
dataSource tilemap data containing tile attributes (see TILE_ATTR_FULL() macro).
rowPlane row we want to set data
xRow X start position (in tile)
wRow width to update (in tile)
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY

Set a row of tilemap data (tilemap wrapping supported) with given tile attributes values. You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapDataRowEx(..) which allow to override base tile attributes though the 'basetile' parameter.

See also:
VDP_setTileMapDataRowPartEx()
VDP_setTileMapDataRow()
void VDP_setTileMapDataRowEx ( VDPPlane  plane,
const u16 data,
u16  basetile,
u16  row,
u16  x,
u16  w,
TransferMethod  tm 
)

Set a row of tilemap data - extended version.

Parameters:
planePlane where we want to set tilemap data.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
dataSource tilemap data containing tile attributes (see TILE_ATTR_FULL() macro).
basetileBase index and flag for tile attributes (see TILE_ATTR_FULL() macro).
rowPlane row we want to set data
xRow X start position (in tile)
wRow width to update (in tile)
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY
    But i highly discourage of using DMA here as VDP_setTileMapDataRowEx(..) requires to prepare data in a temporary buffer first
    to use DMA, resulting in a slower process than using CPU. However DMA_QUEUE is very useful as it wil prepare the data
    and transfer the data as fast as possible during VBlank.

Set a row of tilemap data (tilemap wrapping supported) with given tile attributes values.
Unlike VDP_setTileMapDataRow(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMapDataRow(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation.

See also:
VDP_setTileMapDataRowPart()
VDP_setTileMapDataRow()
bool VDP_setTileMapEx ( VDPPlane  plane,
const TileMap tilemap,
u16  basetile,
u16  xp,
u16  yp,
u16  x,
u16  y,
u16  w,
u16  h,
TransferMethod  tm 
)

Load tilemap region at specified plane position.

Parameters:
planePlane where we want to load tilemap.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
tilemapSource tilemap to load.
The TileMap is unpacked "on-the-fly" if needed (require some memory).
Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first.
basetileBase index and flag for tile attributes (see TILE_ATTR_FULL() macro).
xpPlane X destination position (in tile).
ypPlane Y destination position (in tile).
xRegion X start position (in tile).
yRegion Y start position (in tile).
wRegion Width (in tile).
hRegion Heigh (in tile).
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY
    But i highly discourage of using DMA here as VDP_setTileMapEx(..) requires to prepare data in a temporary buffer first
    to use DMA, resulting in a slower process than using CPU. However DMA_QUEUE is very useful as it wil prepare the data
    and transfer the data as fast as possible during VBlank.

Load the specified tilemap region at specified plane position (tilemap wrapping supported).
Unlike VDP_setTileMap(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMap(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation.

See also:
VDP_setTileMapDataRect()
VDP_setTileMapDataRectEx()
bool VDP_setTileMapRow ( VDPPlane  plane,
const TileMap tilemap,
u16  row,
u16  x,
u16  w,
TransferMethod  tm 
)

Load tilemap row.

Parameters:
planePlane where we want to load tilemap.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
tilemapSource tilemap to set row from.
The TileMap is unpacked "on-the-fly" if needed (require some memory).
Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first.
rowPlane row we want to set data
xSource tilemap X start position (in tile).
wRow width to update (in tile)
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY

Load a complete row of data from tilemap at equivalent plane position (wrapped around if needed).
You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapRowEx(..) which allow to override base tile attributes though the 'basetile' parameter.

See also:
VDP_setTileMapRowEx()
VDP_setMapColumn()
VDP_setTileMapDataRow()
bool VDP_setTileMapRowEx ( VDPPlane  plane,
const TileMap tilemap,
u16  basetile,
u16  row,
u16  x,
u16  y,
u16  w,
TransferMethod  tm 
)

Load tilemap row (extended version).

Parameters:
planePlane where we want to load tilemap.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
tilemapSource tilemap to set row from.
The TileMap is unpacked "on-the-fly" if needed (require some memory).
Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first.
basetileBase index and flag for tile attributes (see TILE_ATTR_FULL() macro).
rowPlane row we want to set data
xSource tilemap X start position (in tile)
ySource tilemap Y / row position (in tile), can be different that plane row if desired.
wRow width to update (in tile)
tmTransfer method.
Accepted values are:
  • CPU
  • DMA
  • DMA_QUEUE
  • DMA_QUEUE_COPY
    But i highly discourage of using DMA here as VDP_setTileMapRowEx(..) requires to prepare data in a temporary buffer first
    to use DMA, resulting in a slower process than using CPU. However DMA_QUEUE is very useful as it wil prepare the data
    and transfer the data as fast as possible during VBlank.

Load a complete row of data from tilemap at equivalent plane position (wrapped around if needed).
Unlike VDP_setTileMapRow(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMapRow(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation.

See also:
VDP_setTileMapRow()
VDP_setMapColumnEx()
VDP_setTileMapDataRowEx()
void VDP_setTileMapXY ( VDPPlane  plane,
u16  tile,
u16  x,
u16  y 
)

Set tilemap data (single position).

Parameters:
planePlane where we want to set tilemap data.
Accepted values are:
  • BG_A
  • BG_B
  • WINDOW
tiletile attributes (see TILE_ATTR_FULL() and TILE_ATTR() macros).
xX position (in tile).
yy position (in tile).

Set the specified tilemap position (tilemap wrapping supported) with given tile attributes.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines