Skip to content

Commit 5e96d49

Browse files
Document an early revision of the CGB-AGB bootrom (#427)
1 parent aa93775 commit 5e96d49

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Power_Up_Sequence.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A program called the *boot ROM*, burned inside the CPU, is mapped "over" the car
55
This program is responsible for the boot-up animation played before control is handed over to the cartridge's ROM.
66
Since the boot ROM hands off control to the game ROM at address $0100, and developers typically need not care about the boot ROM, the "start address" is usually documented as $0100 and not $0000.
77

8-
8 different known official boot ROMs are known to exist:
8+
9 different known official boot ROMs are known to exist:
99

1010
Name | Size (bytes) | Notes
1111
-----|--------------|------------------------------------------------------------
@@ -16,6 +16,7 @@ SGB | 256 | Only forwards logo to SGB BIOS, performs no checks
1616
SGB2 | 256 | Same difference to SGB than between MGB and DMG
1717
CGB0 | 256 + 1792 | Does not init [wave RAM](<#FF30-FF3F - Wave Pattern RAM>)
1818
CGB | 256 + 1792 | Split in two parts, with the cartridge header in the middle
19+
AGB0 | 256 + 1792 | Increments B register for GBA identification
1920
AGB | 256 + 1792 | Fixes ["logo TOCTTOU"](<#Bypass>)
2021

2122
[A disassembly of all of them is available online.](https://github.com/ISSOtm/gb-bootroms)
@@ -60,7 +61,7 @@ As the DMG and MGB boot ROMs, the SGB and SGB2 boot ROMs write $01 and $FF respe
6061
The way the packet-sending routine works makes transferring a set bit *one cycle* faster than transferring a reset bit; this means that the time taken by the SGB boot ROMs *depends on the cartridge's header*.
6162
The relationship between the header and the time taken is made more complex by the fact that the boot ROM waits for 4 VBlanks after transferring each packet, mostly but not entirely grouping the timings.
6263

63-
## Color models (CGB0, CGB, AGB)
64+
## Color models (CGB0, CGB, AGB0, AGB)
6465

6566
The color boot ROMs are much more complicated, notably because of the compatibility behavior.
6667

@@ -183,13 +184,13 @@ That said, if you want to explicitly mark the lack of licensing from Nintendo, y
183184

184185
The Nintendo logo check has been [circumvented many times](http://fuji.drillspirits.net/?post=87), be it to avoid legal action from Nintendo or for the swag, and there are basically two ways of doing so.
185186

186-
One is to exploit a [TOCTTOU](https://en.wikipedia.org/wiki/TOCTTOU) vulnerability in the way the console reads the logo (doing so once to draw it, and the other time to check it), which has however been patched on the AGB.
187+
One is to exploit a [TOCTTOU](https://en.wikipedia.org/wiki/TOCTTOU) vulnerability in the way the console reads the logo (doing so once to draw it, and the other time to check it), which has however been patched on later revisons of the AGB.
187188
This requires custom hardware in the cartridge, however, and is made difficult by the timing and order of the reads varying greatly between boot ROMs.
188189
Some implementations use a custom mapper, others use a capacitor holding some of the address lines to redirect reads to a separate region of ROM containing the modified logo.
189190

190191
The other way is Game Boy Color (and Advance) exclusive: for some reason, the boot ROM copies the full logo into HRAM, but only compares the first half.
191192
Thus, a logo whose top half is correct but not the bottom half will get a pass from the CGB boot ROM.
192-
Strangely, despite correcting the TOCTTOU vulnerability, the CGB-AGB boot ROM does *not* fix this mistake.
193+
Strangely, despite correcting the TOCTTOU vulnerability in its later revision, the CGB-AGB boot ROM does *not* fix this mistake.
193194

194195
## Console state after boot ROM hand-off
195196

0 commit comments

Comments
 (0)