[−][src]Module gba::palram
Module that allows interacting with palette memory, (PALRAM
).
The PALRAM
contains 256 Color
values for Background use, and 256 Color
values for Object use.
Each block of PALRAM
can be viewed as "8 bits per pixel" (8bpp), where
there's a single palette of 256 entries. It can also be viewed as "4 bits
per pixel" (4bpp), where there's 16 "palbank" entries that each have 16
slots. Both interpretations are correct, simultaneously. If you're a
real palette wizard you can carefully arrange for some things to use 4bpp
mode while other things use 8bpp mode and have it all look good.
Transparency
In 8bpp mode the 0th palette index is "transparent" when used in an image (giving you 255 usable slots). In 4bpp mode the 0th palbank index of each palbank is considered a transparency pixel (giving you 15 usable slots per palbank).
Clear Color
The 0th palette index of the background palette holds the color that the display will show if no background or object draws over top of a given pixel during rendering.
Constants
PALRAM_BG | The |
PALRAM_OBJ | The |
Functions
index_palram_bg_4bpp | Obtains the address of the specified 4bpp background palbank and palslot. |
index_palram_bg_8bpp | Obtains the address of the specified 8bpp background palette slot. |
index_palram_obj_4bpp | Obtains the address of the specified 4bpp object palbank and palslot. |
index_palram_obj_8bpp | Obtains the address of the specified 8bpp object palette slot. |