Tiles

From C256 Foenix Wiki
Revision as of 19:27, 27 June 2021 by Grenouye (talk | contribs) (Created page with "Vicky II support 8 tilesets and 4 tilemaps. === Tiles === Tiles are tiny reusable bitmaps that are 16 pixels wide by 16 pixels high. === Tilesets === Tiles are combined in t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Vicky II support 8 tilesets and 4 tilemaps.

Tiles

Tiles are tiny reusable bitmaps that are 16 pixels wide by 16 pixels high.

Tilesets

Tiles are combined in tilesets. Tilesets usually contain only unique tiles to save memory. Tilesets can contain a maximum of 256 tiles. Each tile has a unique number in the tileset. Tilesets must be stored in video RAM for Vicky II to be able to render them.

Tilemaps

Tilemaps combine tiles from the tilesets to create a world map. Tilemaps can be up to 1024 tiles wide by 1024 tiles high. Tilemaps must be stored in video RAM in order for Vicky II to render them.


Tilemap Registers

Each Tilemap has registers composed of a total of 12 bytes for manipulation, starting at $AF:0200 and spanning through to $AF:022F.

The first set of sprite manipulation registers are shown below:

Attribute Address
TL0_CONTROL_REG = $AF:0200
TL0_START_ADDY_L = $AF:0201
TL0_START_ADDY_M = $AF:0202
TL0_START_ADDY_H = $AF:0203
TL0_TOTAL_X_SIZE_L = $AF:0204
TL0_TOTAL_X_SIZE_H = $AF:0205
TL0_TOTAL_Y_SIZE_L = $AF:0206
TL0_TOTAL_Y_SIZE_H = $AF:0207
TL0_WINDOW_X_POS_L = $AF:0208
TL0_WINDOW_X_POS_H = $AF:0209
TL0_WINDOW_Y_POS_L = $AF:020A
TL0_WINDOW_Y_POS_H = $AF:020B
TL1_CONTROL_REG $AF:020C
TL2_CONTROL_REG $AF:0218
TL3_CONTROL_REG $AF:0224

For each successive tilemap, add +12 to the address registers.

The tilemap control register (TLx_CONTROL_REG) is always the first byte of the 12 byte block. The register is configured as follows:

Attribute Bit
TILE_Enable = $01
TILE_Collision_On = $40

The Tilemap Total Size X and Y must be less than 1024.

The Tilemap Window Position X and Y are defined as follows:

Attribute Bit
Direction Bit 14 ($4000)
Scroll Bits 10-13 ($4xx to $3Cxx)
Position = 0 to $3FF

Tileset Registers