Palette Commands

SGB Command $00 — PAL01

Transmit color data for SGB palette 0, color 0-3, and for SGB palette 1, color 1-3 (without separate color 0).

0123456789101112131415
HeaderPals 0 & 1 color #0Pal 0 color #1Pal 0 color #2Pal 0 color #3Pal 1 color #1Pal 1 color #2Pal 1 color #3

The header byte is $00 << 3 | $01 = $01.

SGB Command $01 — PAL23

Same as PAL01 above, but for Palettes 2 and 3 respectively. The header byte is thus $09.

SGB Command $02 — PAL03

Same as PAL01 above, but for Palettes 0 and 3 respectively. The header byte is thus $11.

SGB Command $03 — PAL12

Same as PAL01 above, but for Palettes 1 and 2 respectively. The header byte is thus $19.

SGB Command $0A — PAL_SET

Used to copy pre-defined palette data from SGB system color palettes to actual SNES palettes.

Before using this feature, System Palette data should be initialized by PAL_TRN command, and (when used) Attribute File (ATF) data should be initialized by ATTR_TRN.

0123456789101112131415
HeaderPalette #0's IDPalette #1's IDPalette #2's IDPalette #3's IDFlags

The header byte is $0A << 3 | $01 = $51. All palette IDs are little-endian.

76543210
FlagsApply ATFCancel MASK_ENATF number
  • Apply ATF: If and only if this is set, then the ATF whose ID is specified by bits 0–5 is applied as if by ATTR_SET.
  • Cancel MASK_EN: If this bit is set, then any current MASK_EN “screen freeze” is cancelled.
  • ATF number: Index of the ATF to transfer. Values greater than $2C are invalid.

SGB Command $0B — PAL_TRN

Used to initialize SGB system color palettes in SNES RAM. System color palette memory contains 512 pre-defined palettes, these palettes do not directly affect the display, however, the PAL_SET command may be later used to transfer four of these “logical” palettes to actual visible “physical” SGB palettes. Also, the OBJ_TRN feature will use groups of 4 System Color Palettes (4*4 colors) for SNES OBJ palettes (16 colors).

0123456789101112131415
Header

The header byte must be $59.

The palette data is sent by VRAM Transfer.

…0…1…2…3…4…5…6…7…8…9…A…B…C…D…E…F
$800…Pal #0 color #0Pal #0 color #1Pal #0 color #2Pal #0 color #3Pal #1 color #0Pal #1 color #1Pal #1 color #2Pal #1 color #3
$801…Pal #2 color #0Pal #2 color #1Pal #2 color #2Pal #2 color #3Pal #3 color #0Pal #3 color #1Pal #3 color #2Pal #3 color #3
$8FF…Pal #510 color #0Pal #510 color #1Pal #510 color #2Pal #510 color #3Pal #511 color #0Pal #511 color #1Pal #511 color #2Pal #511 color #3

The data is stored at 3000-3FFF in SNES memory.

SGB Command $19 — PAL_PRI

If the player overrides the active palette set (a pre-defined or the custom one), it stays in effect until the smiley face is selected again, or the player presses the X button on their SNES controller.

However, if PAL_PRI is enabled, then changing the palette set (via any PAL_* command besides PAL_TRN) will switch back to the game’s newly-modified palette set, if it wasn’t already active.

Donkey Kong (1994) is one known game that appears to use this.

0123456789101112131415
HeaderPriority

The header must be $C9.

Bit 0 of the priority byte enables (1) or disables (0) PAL_PRI.