per
Veteran Member
Some time ago, the Boot ROM of the Gameboy Color was dumped. This was the first successful attempt after several failed attempts over the past 10 years. When it was put online, somebody did try to make a disassembly of it, however, that disassembly is not complete and rather badly comented/organized. That's why I try to make a more readable disassembly of the ROM myself.
for those of you who have seen the original GB boot ROM disassembly, it seems rather simple. In the case of the original GB, it's in fact simple because it is made to only support GB games, hence no checks to see if the game has suppor for certain functions that appeared afterwards. The GBC boot code is ten times more complex, because it has to keep backwards-compability with GB games, SuperGB games, GBPocket games, partally colored GB games, and GBC games. In addition, the boot code also has a routine for selecting the palette for certain GB games, and the startup-screne which is far more complex than the startup-screne of the original GB.
One odd thing is that it seems to contain some kind of database. What it does is that if the License within the header of the inserted cartridge equals 01, it calculates the sum of the title (also within the header) and looks it up in a table with 78 entries. If it is found, it's offset into the table is in most causes used as a pointer into a final table. In a few other causes, the 4th character of the title is compared with 2 or 3 different characters from a third table before setteling on a pointer to the final table. The final value returned is used when setting up the palette for original GB games. I have posted the tables below:
for those of you who have seen the original GB boot ROM disassembly, it seems rather simple. In the case of the original GB, it's in fact simple because it is made to only support GB games, hence no checks to see if the game has suppor for certain functions that appeared afterwards. The GBC boot code is ten times more complex, because it has to keep backwards-compability with GB games, SuperGB games, GBPocket games, partally colored GB games, and GBC games. In addition, the boot code also has a routine for selecting the palette for certain GB games, and the startup-screne which is far more complex than the startup-screne of the original GB.
One odd thing is that it seems to contain some kind of database. What it does is that if the License within the header of the inserted cartridge equals 01, it calculates the sum of the title (also within the header) and looks it up in a table with 78 entries. If it is found, it's offset into the table is in most causes used as a pointer into a final table. In a few other causes, the 4th character of the title is compared with 2 or 3 different characters from a third table before setteling on a pointer to the final table. The final value returned is used when setting up the palette for original GB games. I have posted the tables below:
Code:
Explanation:
"Checksum" is the sum of the 16 bytes making up the tiltle.
"Compare" is what the 4th byte of the title is compared to, in the causes where it is compared.
"C" is the pointer into the final table.
How to use the tables:
First find the sum of the title stored in the game cartridge.
Look it up in the table of checksums.
If the value in the thable doesn't have an "v" under itself, find the C number corresponding to the table offset.
If there is a "v", compare the 4th byte of the header with the two or three values in the coloumn below the "v", and find the corresponding C number.
Look up the value with the offset of C in the final table.
The lower 5 bits of this value is stored in $D008, the upper 3 bits is rotated 3 to the left and stored in $D00B.
----------
Anything not listed: C = 00
Checksum: db $00,$88,$16,$36,$D1,$DB,$F2,$3C,$8C,$92,$3D,$5C,$58,$C9 C = 00 -> 0D
Checksum: db $3E,$70,$1D,$59,$69,$19,$35,$A8,$14,$AA,$75,$95,$99,$34 C = 0E -> 1B
Checksum: db $6F,$15,$FF,$97,$4B,$90,$17,$10,$39,$F7,$F6,$A2,$49,$4E C = 1C -> 29
Checksum: db $43,$68,$E0,$8B,$F0,$CE,$0C,$29,$E8,$B7,$86,$9A,$52,$01 C = 2A -> 37
Checksum: db $9D,$71,$9C,$BD,$5D,$6D,$67,$3F,$6B C = 38 -> 40
Checksum: db $B3,$46,$28,$A5,$C6,$D3,$27,$61,$18,$66,$6A,$BF,$0D,$F4
v v v v v v v v v v v v v v
Compare: db $42,$45,$46,$41,$41,$52,$42,$45,$4B,$45,$4B,$20,$52,$2D C = 41 -> 4E
Compare: db $55,$52,$41,$52,$20,$49,$4E,$41,$49,$4C,$49,$43,$45,$20 C = 4F -> 5C
Compare: db $52 C = 5D
Final table: db $7C,$08,$12,$A3,$A2,$07,$87,$4B,$20,$12,$65,$A8,$16,$A9 C = 00 -> 0D
db $86,$B1,$68,$A0,$87,$66,$12,$A1,$30,$3C,$12,$85,$12,$64 C = 0E -> 1B
db $1B,$07,$06,$6F,$6E,$6E,$AE,$AF,$6F,$B2,$AF,$B2,$A8,$AB C = 1C -> 29
db $6F,$AF,$86,$AE,$A2,$A2,$12,$AF,$13,$12,$A1,$6E,$AF,$AF C = 2A -> 37
db $AD,$06,$4C,$6E,$AF,$AF,$12,$7C,$AC,$A8,$6A,$6E,$13,$A0 C = 38 -> 45
db $2D,$A8,$2B,$AC,$64,$AC,$6D,$87,$BC,$60,$B4,$13,$72,$7C C = 46 -> 53
db $B5,$AE,$AE,$7C,$7C,$65,$A2,$6C,$64,$85 C = 54 -> 5D
Last edited: