Tile Formats

From NerdConsole
Jump to navigationJump to search

Graphics tile formats in NerdConsole were inspired by the layout used by the NES. Tiles are 8x8 pixels per layer and each subsequent layer represents the next bit of color data. Data is layed outline left to right as bits, and top to bottom as bytes.

Each layer's data is made up of 8 bytes and if there are multiple layers for a single tile (which is common) the data for each layer immediately follows the previous layer's data in memory. Various tile formats exist based on the currently selected graphics mode. The difference between these is just how many 8-byte layers of data are used for a single tile. More layers means more possible colors per tile. Selecting between them is done by selecting one of the Graphics Modes.

Format for each layer

The 8 bytes that make up each layer define a single bit for each pixel. This table shows how the bits are arranged in x, y space.

Bit 7 6 5 4 3 2 1 0
Byte 0 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0
Byte 1 0, 1 1, 1 2, 1 3, 1 4, 1 5, 1 6, 1 7, 1
Byte 2 0, 2 1, 2 2, 2 3, 2 4, 2 5, 2 6, 2 7, 2
Byte 3 0, 3 1, 3 2, 3 3, 3 4, 3 5, 3 6, 3 7, 3
Byte 4 0, 4 1, 4 2, 4 3, 4 4, 4 5, 4 6, 4 7, 4
Byte 5 0, 5 1, 5 2, 5 3, 5 4, 5 5, 5 6, 5 7, 5
Byte 6 0, 6 1, 6 2, 6 3, 6 4, 6 5, 6 6, 6 7, 6
Byte 7 0, 7 1, 7 2, 7 3, 7 4, 7 5, 7 6, 7 7, 7