Skip to main content

Module tile

Module tile 

Source
Expand description

Tile data: the 384 slots at 0x8000, sixteen bytes each.

§Slots and indices

A tilemap byte is eight bits, so it names one of 256 tiles, but there are 384. LCDC bit 4 chooses which window of 256 it names, and the two windows overlap in the middle:

BlockAddressSlotBase8000Base8800
08000-87FF0-127index 0-127out of reach
18800-8FFF128-255index 128-255index 128-255
29000-97FF256-383out of reachindex 0-127

Objects ignore the bit and always read as Base8000, so putting the background on Base8800 gives each a private block and leaves block 1 shared, putting all 384 within reach at once.

Writing here addresses a slot, which means the same tile whichever mode is set; index converts one to the byte a map needs. See https://gbdev.io/pandocs/Tile_Data.html.

Enums§

Addressing
Which 256 slots a tilemap byte names, from LCDC bit 4.

Constants§

SLOT_COUNT
Tile slots in one VRAM bank.

Functions§

addressing
Which window LCDC currently selects for the background and window layers.
index
The tilemap byte that names slot under mode, if mode reaches it.
set_addressing
Select the window for the background and window layers.
slot
The slot a tilemap byte of index names under mode.
write
Write one tile into slot.
write_all
Write data into consecutive slots from first.