Palette Remapping

At night, the instrument panel color run (32 colors, 128–159) is replaced with a 32-gradient orange run (black=color 128, bright orange=color 159). This replacement process is known as "night orange color remapping." The instrument panel and the world map are remapped to this color run using the following BGL command.

PANEL_REMAP_TABLEdb256 dup (0);in vgbcol.asm

Every color in the color table is mapped to an orange value, with the exception the bright colors (116–127) which are mapped to themselves. The following function is used to compute the map values.

remap color = 128 + (sqrt ( Red[to the second power] + Green[to the second power] + Blue[to the second power]))/15

Note: The divisor used in the preceding function is 15 because the maximum value, or the dividend, is 442. A divisor of 16 creates a remap range of 128–155; a divisor of 14 creates a remap range of 128–159.

The panel_remap_table is created in the PANEL_REMAP routine, called by TIME_CHANGE in vgbcol.asm. The command panel_remap is called in every frame in which it is determined (by time_change) that the orange palette is needed.