You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SGB firmware in Mesen-S updates palette 7 during menu navigation
and fades palettes 4, 5, and 6 during border updates. This means a
border cannot safely use palette 7.
Also clarify the meaning of letterboxing, and document the tile format.
Co-authored-by: Antonio Vivace <[email protected]>
Co-authored-by: Eldred Habert <[email protected]>
Copy file name to clipboardExpand all lines: src/SGB_Command_Border.md
+16-10Lines changed: 16 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,8 @@ tiles 00h-7Fh, and once for tiles 80h-FFh). Note: The BG/OBJ Bit seems
29
29
to have no effect and writes to the same VRAM addresses for both BG and
30
30
OBJ ???
31
31
32
-
TODO: explain tile format
32
+
Each tile is stored in 4-bit-per-pixel format consisting of bit planes 0 and 1 interleaved by row, followed by bit planes 2 and 3 interleaved by row.
33
+
In effect, each tile consists of two Game Boy tiles, the first to determine bits 0 and 1 (choosing among color 0, 1, 2, or 3 within a 4-color subpalette), and the second to determine bits 2 and 3 (choosing among colors 0-3, 4-7, 8-11, or 12-15).
33
34
34
35
## SGB Command $14 — PCT_TRN
35
36
@@ -48,16 +49,16 @@ The map data is sent by VRAM-Transfer (4 KBytes).
48
49
```
49
50
000-6FF BG Map 32x28 Entries of 16 bits each (1792 bytes)
50
51
700-7FF Not used, don't care
51
-
800-87F BG Palette Data (Palettes 4-7, each 16 colors of 16 bits each)
Each BG Map Entry consists of a 16-bit value as such:
56
57
`VH01 PP00 NNNN NNNN```
57
58
58
59
```
59
60
Bit 0-9 - Character Number (use only 00h-FFh, upper 2 bits zero)
60
-
Bit 10-12 - Palette Number (use only 4-7, officially use only 4-6)
61
+
Bit 10-12 - Palette Number (use only 4-6)
61
62
Bit 13 - BG Priority (use only 0)
62
63
Bit 14 - X-Flip (0=Normal, 1=Mirror horizontally)
63
64
Bit 15 - Y-Flip (0=Normal, 1=Mirror vertically)
@@ -70,16 +71,21 @@ window to be displayed inside. Non-transparent border data will cover
70
71
the Game Boy window (for example, *Mario's Picross* does this, as does
71
72
*WildSnake* to a lesser extent).
72
73
74
+
A border designed for a modern (post-2006) widescreen television may use the center 256×176 pixels and leave the top and bottom 24 lines blank.
75
+
Using letterbox allows more tile variety in the portion of the border that a widescreen TV's zoom mode does not cut off.
76
+
73
77
All borders repeat tiles. Assuming that the blank space for the GB
74
-
screen is a single tile, as is the letterbox in a widescreen border, a
78
+
screen is a blank tile, and the letterbox (if any) is a solid tile, a
75
79
border defining all unique tiles would have to define this many tiles:
76
80
77
-
- (256\*224-160\*144)/64+1 = 537 tiles in fullscreen border
78
-
- (256\*176-160\*144)/64+2 = 346 tiles in widescreen border
81
+
- (256\*224-160\*144)/64+1 = 537 tiles in full-screen border
82
+
- (256\*176-160\*144)/64+2 = 346 tiles in letterboxed border
83
+
84
+
Because the CHR RAM allocated by SGB for border holds only 256 tiles, a full-screen border must repeat at least 281 tiles and a letterboxed border at least 90.
79
85
80
-
But the CHR RAM allocated by SGB for border holds only 256 tiles. This
81
-
means a fullscreen border must repeat at least 281 tiles and a
82
-
widescreen border at least 90.
86
+
The Super NES supports 8 background palettes.
87
+
The SGB system software (when run in a LLE such as Mesen-S) has been observed to use background palette 0 for the GB screen, palettes 1, 2, 3, and 7 for the menus, and palettes 4, 5, and 6 for the border.
0 commit comments