Tilemaps Memory
- In text mode: 80x40 characters. Each character is 8x12px big. In 40x20 text mode, only 1/4 of them will be shown at once, hardware scrolling can be used to decide which part to show.
- In both graphics modes: 80x40 background tiles in graphics mode. Each byte represents an entry, a tile, from the tileset memory (0-255). Note that not all of them will be visible at the same time, hardware scrolling can be used to decide which part to show.
Right after the palette is the Layer1, which is also write-only and represents:
- In text mode: 80x40 characters color attributes in text mode. Each byte represents two colors, the high nibble (4-bit) is the background color and the lowest nibble is the foreground color. For example, byte
0xF2represents a character with color 15 as its background and color 2 as the character color. In 40x20 characters mode, this is still valid, it is possible to set the colors of hidden characters, before they are even shown on screen. - In 8bpp graphics mode: 80x40 foreground tiles. Same as the layer0.
- In 4bpp graphics mode: attributes for the layer0 tiles. For each byte, the lowest bit represent the highest bit of the tile entry index, while the highest 4-bit represent the palette to use (0-16). For example, if entry number 10 is
0x21, the index of the tile to show will be(1 << 8) | layer[10]and it shall be drawn with the palette of index2. This lets us have different 512 tiles in this mode, and even draw the same tile several times on screen but with different colors.