’Cause all games were better on the GBC

You are not logged in.

#1 2014-11-07 21:22:21

New member
Registered: 2014-11-06
Post 1/1

Where are tile palettes?

The question comes at the end.
My current (possibly incorrect) understanding of tilesets is as follows.

block = 16 tiles (stored as array of tile numbers)
tile =  8x8 pixels (stored as indices into tile's color palette)

==Tileset Header==
3 bytes - graphics_ptr            // tileset graphics pointer
3 bytes - blocks_ptr              // pointer to array of tiles for each block
3 bytes - collision_ptr            // collision data for tileset
2 bytes - anim_ptr                // animated tiles pointer (bank 0x02)
2 bytes - unused
2 bytes - palette_indices_ptr // pointer to tile's palette indices

Tileset graphics pointer
graphics_ptr points to the compressed tileset pixels.
Uncompressed, the tileset graphics is 1536 bytes.
1536 = (96*64*2)/8 -- 96 tiles, 64 pixels per tile, 2 bits per pixel.
Each 2 bit pixel is actually an index into a 4 color palette where each color
is 2 bytes with:
byte 1 = [gggrrrrr]
byte 2 = [0bbbbbgg]

Block tiles pointer
blocks_ptr points to an array that tells you how the blocks for this tileset are composed.
An entry for a block consists of 4*4 = 16 bytes where each byte is a tile number from 0 to 95

Palette indices pointer
palette_indices_ptr points to an array of indices to palettes which is supposed to be indexed by a tile number.
This is so each tile can have a unique palette.

Question: Each tile has a corresponding palette index that indexes into an array of palettes.
Where is the array of pallettes located?
Do they correspond to Color Arrangements at address 0x8097? … rangements

Last edited by Marmoto (2014-11-07 21:28:15)


Board footer

Powered by FluxBB