Optimize more
This commit is contained in:
parent
f46f138e9f
commit
a3f261184d
@ -6,8 +6,7 @@ Start:
|
|||||||
ld sp, $fffe
|
ld sp, $fffe
|
||||||
|
|
||||||
; Clear memory VRAM
|
; Clear memory VRAM
|
||||||
ld hl, $8000
|
call ClearMemoryPage8000
|
||||||
call ClearMemoryPage
|
|
||||||
ld a, 2
|
ld a, 2
|
||||||
ld c, $70
|
ld c, $70
|
||||||
ld [c], a
|
ld [c], a
|
||||||
@ -74,9 +73,7 @@ Start:
|
|||||||
; Clear the second VRAM bank
|
; Clear the second VRAM bank
|
||||||
ld a, 1
|
ld a, 1
|
||||||
ldh [$4F], a
|
ldh [$4F], a
|
||||||
xor a
|
call ClearMemoryPage8000
|
||||||
ld hl, $8000
|
|
||||||
call ClearMemoryPage
|
|
||||||
call LoadTileset
|
call LoadTileset
|
||||||
|
|
||||||
ld b, 3
|
ld b, 3
|
||||||
@ -177,8 +174,10 @@ ENDC
|
|||||||
IF !DEF(FAST)
|
IF !DEF(FAST)
|
||||||
call DoIntroAnimation
|
call DoIntroAnimation
|
||||||
|
|
||||||
|
ld a, 45
|
||||||
|
ldh [WaitLoopCounter], a
|
||||||
; Wait ~0.75 seconds
|
; Wait ~0.75 seconds
|
||||||
ld b, 45
|
ld b, a
|
||||||
call WaitBFrames
|
call WaitBFrames
|
||||||
|
|
||||||
; Play first sound
|
; Play first sound
|
||||||
@ -189,10 +188,6 @@ IF !DEF(FAST)
|
|||||||
; Play second sound
|
; Play second sound
|
||||||
ld a, $c1
|
ld a, $c1
|
||||||
call PlaySound
|
call PlaySound
|
||||||
|
|
||||||
; Wait ~0.5 seconds
|
|
||||||
ld a, 30
|
|
||||||
ldh [WaitLoopCounter], a
|
|
||||||
|
|
||||||
.waitLoop
|
.waitLoop
|
||||||
call GetInputPaletteIndex
|
call GetInputPaletteIndex
|
||||||
@ -602,8 +597,11 @@ PlaySound:
|
|||||||
ldh [$14], a
|
ldh [$14], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
ClearMemoryPage8000:
|
||||||
|
ld hl, $8000
|
||||||
; Clear from HL to HL | 0x2000
|
; Clear from HL to HL | 0x2000
|
||||||
ClearMemoryPage:
|
ClearMemoryPage:
|
||||||
|
xor a
|
||||||
ldi [hl], a
|
ldi [hl], a
|
||||||
bit 5, h
|
bit 5, h
|
||||||
jr z, ClearMemoryPage
|
jr z, ClearMemoryPage
|
||||||
@ -781,6 +779,7 @@ IF !DEF(FAST)
|
|||||||
.fadeLoop
|
.fadeLoop
|
||||||
ld c, 32 ; 32 colors to fade
|
ld c, 32 ; 32 colors to fade
|
||||||
ld hl, BgPalettes
|
ld hl, BgPalettes
|
||||||
|
push hl
|
||||||
.frameLoop
|
.frameLoop
|
||||||
push bc
|
push bc
|
||||||
|
|
||||||
@ -833,7 +832,7 @@ IF !DEF(FAST)
|
|||||||
jr nz, .frameLoop
|
jr nz, .frameLoop
|
||||||
|
|
||||||
call WaitFrame
|
call WaitFrame
|
||||||
ld hl, BgPalettes
|
pop hl
|
||||||
call LoadBGPalettes64
|
call LoadBGPalettes64
|
||||||
call WaitFrame
|
call WaitFrame
|
||||||
dec b
|
dec b
|
||||||
@ -888,6 +887,14 @@ ENDC
|
|||||||
ldh [$4C], a
|
ldh [$4C], a
|
||||||
ld a, $1
|
ld a, $1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
GetKeyComboPalette:
|
||||||
|
ld hl, KeyCombinationPalettes - 1 ; Return value is 1-based, 0 means nothing down
|
||||||
|
ld c ,a
|
||||||
|
ld b, 0
|
||||||
|
add hl, bc
|
||||||
|
ld a, [hl]
|
||||||
|
ret
|
||||||
|
|
||||||
EmulateDMG:
|
EmulateDMG:
|
||||||
ld a, 1
|
ld a, 1
|
||||||
@ -900,11 +907,7 @@ EmulateDMG:
|
|||||||
ldh a, [InputPalette]
|
ldh a, [InputPalette]
|
||||||
and a
|
and a
|
||||||
jr z, .nothingDown
|
jr z, .nothingDown
|
||||||
ld hl, KeyCombinationPalettes - 1 ; Return value is 1-based, 0 means nothing down
|
call GetKeyComboPalette
|
||||||
ld c ,a
|
|
||||||
ld b, 0
|
|
||||||
add hl, bc
|
|
||||||
ld a, [hl]
|
|
||||||
jr .paletteFromKeys
|
jr .paletteFromKeys
|
||||||
.nothingDown
|
.nothingDown
|
||||||
ld a, b
|
ld a, b
|
||||||
@ -985,17 +988,21 @@ GetPaletteIndex:
|
|||||||
.notNintendo
|
.notNintendo
|
||||||
xor a
|
xor a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
LoadPalettesFromIndex: ; a = index of combination
|
GetPaletteCombo:
|
||||||
ld b, a
|
ld b, a
|
||||||
; Multiply by 3
|
; Multiply by 3
|
||||||
add b
|
add b
|
||||||
add b
|
add b
|
||||||
|
|
||||||
ld hl, PaletteCombinations
|
ld hl, PaletteCombinations
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld c, a
|
ld c, a
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
ret
|
||||||
|
|
||||||
|
LoadPalettesFromIndex: ; a = index of combination
|
||||||
|
call GetPaletteCombo
|
||||||
|
|
||||||
; Obj Palettes
|
; Obj Palettes
|
||||||
ld e, 0
|
ld e, 0
|
||||||
@ -1100,20 +1107,10 @@ ChangeAnimationPalette:
|
|||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
push de
|
push de
|
||||||
ld hl, KeyCombinationPalettes - 1 ; Input palettes are 1-based, 0 means nothing down
|
call GetKeyComboPalette
|
||||||
ld c, a
|
call GetPaletteCombo
|
||||||
ld b, 0
|
inc l
|
||||||
add hl, bc
|
inc l
|
||||||
ld a, [hl]
|
|
||||||
ld b, a
|
|
||||||
; Multiply by 3
|
|
||||||
add b
|
|
||||||
add b
|
|
||||||
|
|
||||||
ld hl, PaletteCombinations + 2; Background Palette
|
|
||||||
ld b, 0
|
|
||||||
ld c, a
|
|
||||||
add hl, bc
|
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld hl, Palettes + 1
|
ld hl, Palettes + 1
|
||||||
ld b, 0
|
ld b, 0
|
||||||
@ -1164,7 +1161,7 @@ ChangeAnimationPalette:
|
|||||||
ld hl, BgPalettes
|
ld hl, BgPalettes
|
||||||
call LoadBGPalettes64
|
call LoadBGPalettes64
|
||||||
; Delay the wait loop while the user is selecting a palette
|
; Delay the wait loop while the user is selecting a palette
|
||||||
ld a, 30
|
ld a, 45
|
||||||
ldh [WaitLoopCounter], a
|
ldh [WaitLoopCounter], a
|
||||||
pop de
|
pop de
|
||||||
pop bc
|
pop bc
|
||||||
|
Loading…
Reference in New Issue
Block a user