Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

EarthBound/Map Data/Palettes

From Data Crystal
< EarthBound
Revision as of 20:55, 23 June 2023 by Esorth (talk | contribs) (→‎Entry Ordering: Add formula to find individual palette)
Jump to navigation Jump to search

This is a sub-page of EarthBound/Map Data.

Map Palettes
Game EarthBound
Start Address 0x1A7EA7
End Address 0x1AFCA6
# of Entries 168
Entry Length 192 bytes (0xC0)
Total Length 32256 bytes (0x7E00)
Back to the ROM map

Data block of the palette data used for game maps.

Format

Each entry represents palette data for use by EarthBound map graphics for any sector. Each entry is itself comprised of 6 subpalettes (to create 6 different options for palettes to be used by any given map minitile), each comprised of 16 colors.

Terminology Note: What the EarthBound modding community generally refers to as a "subpalette" is itself referred to in the SNES development guide as a "palette", and therefore the grouping of 6 of those, which is generally referred to in EarthBound modding as a "palette" (at least in the context of map changes), would in general SNES development be a group of palettes.

Colors are stored as little endian (2 bytes):

gggrrrrr 0bbbbbgg

Each subpalette is stored as 16 colors in a row (32 bytes). The first color in each subpalette is always treated as transparent. Is that first color always stored as 0x0000, or does EarthBound sometimes use it for flags?

Finally, each palette is stored as 6 subpalettes in a row (192 bytes).

Entry Ordering

Palettes are ordered first by tileset number (from the Global Tileset/Palette Table), then within each tileset by the palette number (also from the Global Tileset/Palette Table). Because different tilesets have different numbers of palettes, a lookup to the Palette Pointer Table is used to find a pointer to the first palette for any given tileset. The individual palette address can then be found using the following formula: palette_pointer = first_palette_pointer_from_pointer_table + 0xC0 * palette_number