sgdk: vdp_tile.h File Reference

sgdk

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

Classes | Defines | Functions
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:

  pal | Palette index
  prio | Tile priority
  flipV | Vertical flip
  flipH | Horizontal 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:

  pal | Palette index
  prio | Tile priority
  flipV | Vertical flip
  flipH | Horizontal flip
  index | Tile index

## Function Documentation

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

Clear tilemap.

Parameters:

  planeAddr

  Plane address where we want to clear tilemap.
  Accepted values are:
  - VDP_BG_A
  - VDP_BG_B
  - VDP_WINDOW

  ind | Tile index where to start clear.
  num | Number of tile to clear.
  wait | Wait 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:

  plane

  Plane where we want to clear tilemap region.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  x | Region X start position (in tile).
  y | Region Y start position (in tile).
  w | Region Width (in tile).
  h | Region 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:

  value | Value (byte) used to fill VRAM tile data.
  index | Tile index where start tile data fill (use TILE_USERINDEX as base user index).
  num | Number of tile to fill.
  wait | Wait 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:

  planeAddr

  Plane address where we want to fill tilemap.
  Accepted values are:
  - VDP_BG_A
  - VDP_BG_B
  - VDP_WINDOW

  tile | Tile attributes (see TILE_ATTR_FULL() and TILE_ATTR() macros).
  ind | tile index where to start fill.
  num | Number 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:

  plane

  Plane where we want to fill tilemap region.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  tile | tile attributes (see TILE_ATTR_FULL() and TILE_ATTR() macros).
  x | Region X start position (in tile).
  y | Region Y start position (in tile).
  w | Region Width (in tile).
  h | Region 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:

  plane

  Plane where we want to fill tilemap region.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  basetile | Base tile attributes (see TILE_ATTR_FULL() and TILE_ATTR() macros).
  x | Region X start position (in tile).
  y | Region Y start position (in tile).
  w | Region Width (in tile).
  h | Region 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:

  plane

  Plane we want to get the VRAM tilemap address for a given position.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  x | X position (in tile).
  y | Y 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:

  data | Pointer to 4bpp bitmap tile data.
  index | Tile index where start tile data load (use TILE_USERINDEX as base user index).
  w | Width of bitmap region to load (in tile).
  h | Heigh of bitmap region to load (in tile).
  bmp_w | Width 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:

  data | Pointer to 4bpp bitmap tile data.
  index | Tile index where start tile data load (use TILE_USERINDEX as base user index).
  x | X start position of bitmap region to load (in tile).
  y | Y start position of bitmap region to load (in tile).
  w | Width of bitmap region to load (in tile).
  h | Heigh of bitmap region to load (in tile).
  bmp_w | Width 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:

  font | TileSet 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.

  tm

  Transfer 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:

  font | Pointer to font tile data.
  length | Number of characters of the font (max = FONT_LEN).

  tm

  Transfer 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:

  data | Pointer to tile data.
  index | Tile index where start tile data load (use TILE_USERINDEX as base user index).
  num | Number of tile to load.

  tm

  Transfer 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:

  tileset | Pointer 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.
  index | Tile index where start tile data load (use TILE_USERINDEX as base user index).

  tm

  Transfer 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
| ) |  |

Deprecated:
  Use VDP_setTileMap() instead.

bool VDP_setMapEx | ( | VDPPlane | plane,
|  | const TileMap * | tilemap,
|  | u16 | basetile,
|  | u16 | x,
|  | u16 | y,
|  | u16 | xm,
|  | u16 | ym,
|  | u16 | wm,
|  | u16 | hm
| ) |  |

Deprecated:
  Use VDP_setTileMapEx() instead.

bool VDP_setTileMap | ( | VDPPlane | plane,
|  | const TileMap * | tilemap,
|  | u16 | x,
|  | u16 | y,
|  | u16 | w,
|  | u16 | h,
|  | TransferMethod | tm
| ) |  |

Load tilemap region.

Parameters:

  plane

  Plane where we want to load tilemap.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  tilemap | Source 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.
  x | Region X start position (in tile).
  y | Region Y start position (in tile).
  w | Region Width (in tile).
  h | Region Heigh (in tile).

  tm

  Transfer 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:

  plane

  Plane where we want to load tilemap.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  tilemap | Source 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.
  column | Plane column we want to set data
  y | Source tilemap Y start position (in tile).
  h | Column height to update (in tile)

  tm

  Transfer 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:

  plane

  Plane where we want to load tilemap.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  tilemap | Source 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.
  basetile | Base index and flag for tile attributes (see TILE_ATTR_FULL() macro).
  column | Plane column we want to set data
  x | Source tilemap X / column position (in tile), can be different than plane column if desired.
  y | Source tilemap Y start position (in tile).
  h | Column height to update (in tile)

  tm

  Transfer 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:

  planeAddr

  Plane address where we want to set tilemap data.
  Accepted values are:
  - VDP_BG_A
  - VDP_BG_B
  - VDP_WINDOW

  data | Tile attributes data (see TILE_ATTR_FULL() and TILE_ATTR() macros).
  ind | Tile index where to start to set tilemap data.
  num | Number of tile to set.
  vramStep | VRAM address increment after each write (default value = 2)

  tm

  Transfer 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:

  plane

  Plane where we want to set tilemap data.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  data | Source tilemap data containing tile attributes (see TILE_ATTR_FULL() macro).
  column | Plane column we want to set data
  y | Column Y start position (in tile)
  h | Column height to update (in tile)
  wm | Source tilemap width (in tile).

  tm

  Transfer 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:

  plane

  Plane where we want to set tilemap data.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  data | Source tilemap data containing tile attributes (see TILE_ATTR_FULL() macro).
  basetile | Base index and flag for tile attributes (see TILE_ATTR_FULL() macro).
  column | Plane column we want to set data
  y | Column Y start position (in tile)
  h | Column height to update (in tile)
  wm | Source tilemap width (in tile).

  tm

  Transfer 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:

  plane

  Plane where we want to set tilemap data.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  data | Prepared tile attributes data (see TILE_ATTR_FULL() macro). Column data are already arranged to be transferred as a single contiguous data block.
  column | Plane column we want to set data
  y | Column Y start position (in tile)
  h | Column height to update (in tile)

  tm

  Transfer 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:

  planeAddr

  Plane where we want to set tilemap data.
  Accepted values are:
  - VDP_BG_A
  - VDP_BG_B
  - VDP_WINDOW

  data | Tile attributes data (see TILE_ATTR_FULL() and TILE_ATTR() macros).
  basetile | Base tile index and flag for tile attributes (see TILE_ATTR_FULL() macro).
  ind | Tile index where to start to set tilemap data.
  num | Number of tile to set.
  vramStep | VRAM 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:

  plane

  Plane where we want to set tilemap data.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  data | Source tilemap data containing tile attributes (see TILE_ATTR_FULL() macro).
  x | Region X start position (in tile).
  y | Region Y start position (in tile).
  w | Region Width (in tile).
  h | Region Heigh (in tile).
  wm | Source tilemap width (in tile).

  tm

  Transfer 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:

  plane

  Plane where we want to set tilemap data.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  data | Source tilemap data containing tile attributes (see TILE_ATTR_FULL() macro).
  basetile | Base index and flag for tile attributes (see TILE_ATTR_FULL() macro).
  x | Region X start position (in tile).
  y | Region Y start position (in tile).
  w | Region Width (in tile).
  h | Region Heigh (in tile).
  wm | Source tilemap width (in tile).

  tm

  Transfer 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:

  plane

  Plane where we want to set tilemap data.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  data | Source tilemap data containing tile attributes (see TILE_ATTR_FULL() macro).
  row | Plane row we want to set data
  x | Row X start position (in tile)
  w | Row width to update (in tile)

  tm

  Transfer 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:

  plane

  Plane where we want to set tilemap data.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  data | Source tilemap data containing tile attributes (see TILE_ATTR_FULL() macro).
  basetile | Base index and flag for tile attributes (see TILE_ATTR_FULL() macro).
  row | Plane row we want to set data
  x | Row X start position (in tile)
  w | Row width to update (in tile)

  tm

  Transfer 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:

  plane

  Plane where we want to load tilemap.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  tilemap | Source 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.
  basetile | Base index and flag for tile attributes (see TILE_ATTR_FULL() macro).
  xp | Plane X destination position (in tile).
  yp | Plane Y destination position (in tile).
  x | Region X start position (in tile).
  y | Region Y start position (in tile).
  w | Region Width (in tile).
  h | Region Heigh (in tile).

  tm

  Transfer 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:

  plane

  Plane where we want to load tilemap.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  tilemap | Source 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.
  row | Plane row we want to set data
  x | Source tilemap X start position (in tile).
  w | Row width to update (in tile)

  tm

  Transfer 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:

  plane

  Plane where we want to load tilemap.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  tilemap | Source 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.
  basetile | Base index and flag for tile attributes (see TILE_ATTR_FULL() macro).
  row | Plane row we want to set data
  x | Source tilemap X start position (in tile)
  y | Source tilemap Y / row position (in tile), can be different that plane row if desired.
  w | Row width to update (in tile)

  tm

  Transfer 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:

  plane

  Plane where we want to set tilemap data.
  Accepted values are:
  - BG_A
  - BG_B
  - WINDOW

  tile | tile attributes (see TILE_ATTR_FULL() and TILE_ATTR() macros).
  x | X position (in tile).
  y | y position (in tile).

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

All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines