The CGB boot ROM will now not finish if the user is still selecting palettes

This commit is contained in:
Lior Halphon 2017-06-09 19:52:40 +03:00
parent 144d0348dd
commit 204e22657b

View File

@ -34,16 +34,8 @@ Start:
ldh [$25], a ldh [$25], a
ld a, $77 ld a, $77
ldh [$24], a ldh [$24], a
ld hl, $FF30 call InitWaveform
; Init waveform
xor a
ld c, $10
.waveformLoop
ldi [hl], a
cpl
dec c
jr nz, .waveformLoop
; Init BG palette ; Init BG palette
ld a, $fc ld a, $fc
@ -196,8 +188,15 @@ Start:
call PlaySound call PlaySound
; Wait ~0.5 seconds ; Wait ~0.5 seconds
ld b, 30 ld a, 30
call WaitBFrames ld [WaitLoopCounter], a
.waitLoop
call GetInputPaletteIndex
call WaitFrame
ld hl, WaitLoopCounter
dec [hl]
jr nz, .waitLoop
call Preboot call Preboot
; Will be filled with NOPs ; Will be filled with NOPs
@ -871,7 +870,7 @@ LoadPalettesFromIndex: ; a = index of combination
call LoadBGPalettes call LoadBGPalettes
ret ret
BrithenColor: BrightenColor:
ld a, [hli] ld a, [hli]
ld e, a ld e, a
ld a, [hld] ld a, [hld]
@ -929,7 +928,7 @@ FadeOut:
ld hl, BgPalettes ld hl, BgPalettes
.frameLoop .frameLoop
push bc push bc
call BrithenColor call BrightenColor
pop bc pop bc
dec c dec c
jr nz, .frameLoop jr nz, .frameLoop
@ -1062,7 +1061,9 @@ ChangeAnimationPalette:
ld d, 64 ; Length of write ld d, 64 ; Length of write
ld e, 0 ; Index of write ld e, 0 ; Index of write
call LoadBGPalettes call LoadBGPalettes
; Delay the wait loop while the user is selecting a palette
ld a, 30
ld [WaitLoopCounter], a
pop de pop de
pop bc pop bc
pop hl pop hl
@ -1098,6 +1099,18 @@ LoadDMGTilemap:
pop af pop af
ret ret
InitWaveform:
ld hl, $FF30
; Init waveform
xor a
ld c, $10
.waveformLoop
ldi [hl], a
cpl
dec c
jr nz, .waveformLoop
ret
SECTION "ROMMax", ROM0[$900] SECTION "ROMMax", ROM0[$900]
; Prevent us from overflowing ; Prevent us from overflowing
ds 1 ds 1
@ -1106,4 +1119,6 @@ SECTION "RAM", WRAM0[$C000]
BgPalettes: BgPalettes:
ds 8 * 4 * 2 ds 8 * 4 * 2
InputPalette: InputPalette:
ds 1
WaitLoopCounter:
ds 1 ds 1