Skip to content

Commit e6b4062

Browse files
leinaccavivaceISSOtm
authored
Document SGB command $19 - PAL_PRI (#465)
Co-authored-by: Antonio Vivace <[email protected]> Co-authored-by: Eldred Habert <[email protected]>
1 parent 39dc667 commit e6b4062

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

src/SGB_Command_Palettes.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,19 @@ The palette data is sent by VRAM-Transfer (4 KBytes).
8282

8383
Each Palette consists of four 16-bit color definitions (8 bytes). Note:
8484
The data is stored at 3000h-3FFFh in SNES memory.
85+
86+
## SGB Command $19 — PAL_PRI
87+
88+
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.
89+
90+
However, if `PAL_PRI` is enabled, then changing the palette set (via any of the above commands except `PAL_TRN`) will switch back to the game's newly-modified palette set, if it wasn't already active.
91+
92+
_Donkey Kong_ (1994) is one known game that appears to use this.
93+
94+
```
95+
Byte Content
96+
0 Command*8+Length (fixed length=1)
97+
1 Palette priority when a palette packet is sent
98+
Bit 0 - Priority (0=User, 1=Software)
99+
2-F Not used (zero)
100+
```

src/SGB_Command_Summary.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ Code | Name | Explanation
2929
$16 | [ATTR_SET](<#SGB Command $16 — ATTR_SET>) | Set Data to ATF
3030
$17 | [MASK_EN](<#SGB Command $17 — MASK_EN>) | Game Boy Window Mask
3131
$18 | [OBJ_TRN](<#SGB Command $18 — OBJ_TRN>) | Super NES OBJ Mode
32+
$19 | [PAL_PRI](<#SGB Command $19 — PAL_PRI>) | System palette priority
33+

src/SGB_Command_Undocumented.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,10 @@ The following information has been extracted from disassembling a SGB1v2
44
firmware; it should be verified on other SGB revisions.
55

66
The SGB firmware explicitly ignores all commands with ID >= $1E. This
7-
leaves undocumented commands $19 to $1D inclusive.
7+
leaves undocumented commands $1A to $1D inclusive.
88

99
## Stubbed commands
1010

1111
Commands $1A to $1F (inclusive)'s handlers are stubs (only contain an
1212
`RTS`). This is interesting, since the command-processing function
1313
explicitly ignores commands $1E and $1F.
14-
15-
## SGB command $19
16-
17-
The game _Donkey Kong_ (1994) appears to send this command, and it appears
18-
to set a flag in the SGB's memory. It's not known yet what it does,
19-
though.

0 commit comments

Comments
 (0)