Fixed `boot_hwio-C` (for SameBoy’s boot). Closes #59

This commit is contained in:
Lior Halphon 2018-04-03 20:10:11 +03:00
parent 5d63892949
commit b1d65fd84f
1 changed files with 924 additions and 921 deletions

View File

@ -9,7 +9,7 @@ Start:
xor a
; Clear chosen input palette
ld [InputPalette], a
ldh [InputPalette], a
; Clear memory VRAM
ld hl, $8000
call ClearMemoryPage
@ -189,7 +189,7 @@ Start:
; Wait ~0.5 seconds
ld a, 30
ld [WaitLoopCounter], a
ldh [WaitLoopCounter], a
.waitLoop
call GetInputPaletteIndex
@ -714,11 +714,14 @@ DoIntroAnimation:
ret
Preboot:
call FadeOut
call ClearVRAMViaHDMA
; Select the first bank
xor a
ldh [$4F], a
cpl
ldh [$00], a
call ClearVRAMViaHDMA
ld a, [$143]
@ -729,7 +732,7 @@ Preboot:
.cgbGame
ldh [$4C], a ; One day, I will know what this switch does and how it differs from FF6C
ld a, [InputPalette]
ldh a, [InputPalette]
and a
jr nz, .emulateDMGForCGBGame
IF DEF(AGB)
@ -770,7 +773,7 @@ EmulateDMG:
call nz, LoadDMGTilemap
and $7F
ld b, a
ld a, [InputPalette]
ldh a, [InputPalette]
and a
jr z, .nothingDown
ld hl, KeyCombinationPalettes - 1 ; Return value is 1-based, 0 means nothing down
@ -1010,10 +1013,10 @@ GetInputPaletteIndex:
and $C
add c
ld b, a
ld a, [InputPalette]
ldh a, [InputPalette]
ld c, a
ld a, b
ld [InputPalette], a
ldh [InputPalette], a
cp c
pop bc
ret z ; No change, don't load
@ -1055,27 +1058,27 @@ ChangeAnimationPalette:
ld hl, BgPalettes ; First color, all palette
call ReplaceColorInAllPalettes
pop hl
ld [BgPalettes + 2], a ; Second color, first palette
ldh [BgPalettes + 2], a ; Second color, first palette
ld a, [hli]
push hl
ld hl, BgPalettes + 1 ; First color, all palette
call ReplaceColorInAllPalettes
pop hl
ld [BgPalettes + 3], a ; Second color, first palette
ldh [BgPalettes + 3], a ; Second color, first palette
pop af
jr z, .isNotWhite
inc hl
inc hl
.isNotWhite
ld a, [hli]
ld [BgPalettes + 7 * 8 + 2], a ; Second color, 7th palette
ldh [BgPalettes + 7 * 8 + 2], a ; Second color, 7th palette
ld a, [hli]
ld [BgPalettes + 7 * 8 + 3], a ; Second color, 7th palette
ldh [BgPalettes + 7 * 8 + 3], a ; Second color, 7th palette
ld a, [hli]
ld [BgPalettes + 4], a ; Third color, first palette
ldh [BgPalettes + 4], a ; Third color, first palette
ld a, [hl]
ld [BgPalettes + 5], a ; Third color, first palette
ldh [BgPalettes + 5], a ; Third color, first palette
call WaitFrame
ld hl, BgPalettes
@ -1084,7 +1087,7 @@ ChangeAnimationPalette:
call LoadBGPalettes
; Delay the wait loop while the user is selecting a palette
ld a, 30
ld [WaitLoopCounter], a
ldh [WaitLoopCounter], a
pop de
pop bc
pop hl
@ -1136,7 +1139,7 @@ SECTION "ROMMax", ROM0[$900]
; Prevent us from overflowing
ds 1
SECTION "RAM", WRAM0[$C000]
SECTION "HRAM", HRAM[$FF80]
BgPalettes:
ds 8 * 4 * 2
InputPalette: