Load DMG's tilemap for specific games in the CGB boot (Fixes X's title screen and an unknown game with title checksum $43)

This commit is contained in:
Lior Halphon 2016-04-16 01:14:30 +03:00
parent d63a801821
commit ddc9605271

View File

@ -1,4 +1,4 @@
; Sameboy DMG bootstrap ROM ; Sameboy CGB bootstrap ROM
; Todo: use friendly names for HW registers instead of magic numbers ; Todo: use friendly names for HW registers instead of magic numbers
; Todo: add support for games that assume DMG boot logo (Such as X), like the ; Todo: add support for games that assume DMG boot logo (Such as X), like the
; original boot ROM. ; original boot ROM.
@ -255,7 +255,7 @@ TitleChecksums:
db $A2 ; STAR WARS-NOA db $A2 ; STAR WARS-NOA
db $49 ; db $49 ;
db $4E ; WAVERACE db $4E ; WAVERACE
db $43 ; db $43 | $80 ;
db $68 ; LOLO2 db $68 ; LOLO2
db $E0 ; YOSHI'S COOKIE db $E0 ; YOSHI'S COOKIE
db $8B ; MYSTIC QUEST db $8B ; MYSTIC QUEST
@ -313,6 +313,7 @@ FirstChecksumWithDuplicate:
ChecksumsEnd: ChecksumsEnd:
PalettePerChecksum: PalettePerChecksum:
; | $80 means game requires DMG boot tilemap
db 0 ; Default Palette db 0 ; Default Palette
db 4 ; ALLEY WAY db 4 ; ALLEY WAY
db 5 ; YAKUMAN db 5 ; YAKUMAN
@ -325,7 +326,7 @@ PalettePerChecksum:
db 5 ; F1RACE db 5 ; F1RACE
db 19 ; YOSSY NO TAMAGO db 19 ; YOSSY NO TAMAGO
db 36 ; db 36 ;
db 7 ; X db 7 | $80 ; X
db 37 ; MARIOLAND2 db 37 ; MARIOLAND2
db 30 ; YOSSY NO COOKIE db 30 ; YOSSY NO COOKIE
db 44 ; ZELDA db 44 ; ZELDA
@ -747,6 +748,11 @@ Preboot:
EmulateDMG: EmulateDMG:
ld a, 1 ld a, 1
ldh [$6C], a ; DMG Emulation ldh [$6C], a ; DMG Emulation
call GetPaletteIndex
bit 7, a
call nz, LoadDMGTilemap
and $7F
ld b, a
ld a, [InputPalette] ld a, [InputPalette]
and a and a
jr z, .nothingDown jr z, .nothingDown
@ -757,7 +763,7 @@ EmulateDMG:
ld a, [hl] ld a, [hl]
jr .paletteFromKeys jr .paletteFromKeys
.nothingDown .nothingDown
call GetPaletteIndex ld a, b
.paletteFromKeys .paletteFromKeys
call WaitFrame call WaitFrame
call LoadPalettesFromIndex call LoadPalettesFromIndex
@ -1076,6 +1082,25 @@ ReplaceColorInAllPalettes:
jr nz, .loop jr nz, .loop
ret ret
LoadDMGTilemap:
push af
call WaitFrame
ld a,$19 ; Trademark symbol
ld [$9910], a ; ... put in the superscript position
ld hl,$992f ; Bottom right corner of the logo
ld c,$c ; Tiles in a logo row
.tilemapLoop
dec a
jr z, .tilemapDone
ldd [hl], a
dec c
jr nz, .tilemapLoop
ld l,$0f ; Jump to top row
jr .tilemapLoop
.tilemapDone
pop af
ret
SECTION "ROMMax", ROM0[$900] SECTION "ROMMax", ROM0[$900]
; Prevent us from overflowing ; Prevent us from overflowing
ds 1 ds 1