Document a bunch more stuff

This commit is contained in:
Marcus Huderle 2019-05-22 17:22:00 -05:00
parent a33d0ec36b
commit c552057078
8 changed files with 336 additions and 15194 deletions

View File

@ -34,18 +34,18 @@ InitGame:
ldh [rLCDC], a
di
ld sp, $fffe
ld a, Bank(Call_005_4ad6)
ld a, Bank(InitRAM)
ld [wLoadedROMBank], a
ld [MBC1RomBank], a
call Call_005_4ad6
call Call_005_4abe
call Call_000_193b
call Call_000_21bb
call InitRAM
call WriteDMACodeToHRAM
call ClearSprites
call InitRamFuncD099
call Call_005_4b30
ld a, Bank(Call_005_4c4a)
ld a, Bank(InitSoundEngine)
ld [wLoadedROMBank], a
ld [MBC1RomBank], a
call Call_005_4c4a
call InitSoundEngine
ld a, $01
ld [wLoadedROMBank], a
ld [MBC1RomBank], a
@ -142,7 +142,7 @@ Jump_000_01f2:
Func_000_246:
xor a
ld [$d095], a
ld [wClearSpritesOffset], a
ld a, [wLoadedROMBank]
push af
ld a, Bank(Call_005_432c)
@ -155,7 +155,7 @@ Func_000_246:
ld [MBC1RomBank], a
call Call_000_319d
call Call_000_2e9c
call Call_000_193b
call ClearSprites
ld hl, $ff95
bit 3, [hl]
jr z, .jr_000_0280
@ -197,9 +197,9 @@ Func_000_246:
jr nz, .jr_000_02b9
push hl
xor a
ld [$d095], a
ld [wClearSpritesOffset], a
call Call_000_2e9c
call Call_000_193b
call ClearSprites
pop hl
ldh a, [$94]
bit 5, a
@ -559,9 +559,9 @@ jr_000_0548:
call Call_000_1def
push bc
xor a
ld [$d095], a
ld [wClearSpritesOffset], a
call Call_000_2e9c
call Call_000_193b
call ClearSprites
pop bc
ld a, [$d094]
cp $01
@ -640,7 +640,7 @@ jr_000_0566:
ld [$d078], a
ld [$d079], a
ld [$d064], a
ld [$d095], a
ld [wClearSpritesOffset], a
ld a, $20
ld [$d07c], a
ld a, $0e
@ -659,8 +659,8 @@ jr_000_0566:
call Call_000_21fb
call Call_000_139b
call Call_000_2e9c
call Call_000_193b
call Call_000_1e67
call ClearSprites
call StopTimer
call Call_000_0670
ld a, $08
ldh [$8c], a
@ -693,9 +693,9 @@ Call_000_0648:
ldh [$90], a
.jr_000_0655:
xor a
ld [$d095], a
ld [wClearSpritesOffset], a
call Call_000_2e9c
call Call_000_193b
call ClearSprites
ld hl, $ff8c
set 6, [hl]
.jr_000_0664:
@ -772,7 +772,7 @@ ReadJoypad:
ldh [$8c], a
ei
call Call_000_0648
call Call_000_1e74
call StartTimer
jp InitGame
.noSoftReset:
ld a, [$d050]
@ -3146,7 +3146,7 @@ Jump_000_18ff:
ld a, [hl]
cp $80
jr z, .jr_000_1933
ld a, [$d095]
ld a, [wClearSpritesOffset]
ld e, a
ld d, $c0
.jr_000_1919:
@ -3169,7 +3169,7 @@ Jump_000_18ff:
bit 0, a
jr z, .jr_000_1919
ld a, e
ld [$d095], a
ld [wClearSpritesOffset], a
.jr_000_1933:
pop af
ld [wLoadedROMBank], a
@ -3177,31 +3177,34 @@ Jump_000_18ff:
ret
Call_000_193b:
ld a, [$d096]
ClearSprites:
; Clears all OAM sprites after a specified offset.
; If [wClearAllSprites] == $ff, then all sprites are cleared.
; Otherwise, start clearing at offset in [wClearSpritesOffset].
ld a, [wClearAllSprites]
inc a
jr nz, .jr_000_194d
ld a, $a0
jr nz, .startAtOffset ; $ff indicates that all OAM sprites should be cleared
ld a, wOAMBufferEnd - wOAMBuffer
ld c, a
ld [$d096], a
ld [wClearAllSprites], a
xor a
ld [$d095], a
jr .jr_000_1955
.jr_000_194d:
ld a, [$d095]
ld [$d096], a
ld c, $a0
.jr_000_1955:
ld [wClearSpritesOffset], a
jr .copyOamData
.startAtOffset:
ld a, [wClearSpritesOffset]
ld [wClearAllSprites], a
ld c, wOAMBufferEnd - wOAMBuffer
.copyOamData:
ld l, a
ld h, $c0
ld de, $0004
ld b, $00
.jr_000_195d:
ld h, wOAMBuffer >> 8
ld de, 4 ; size of a single OAM sprite
ld b, 0
.copyLoop:
ld [hl], b
add hl, de
ld a, l
cp c
jr nz, .jr_000_195d
jr nz, .copyLoop
ret
@ -3305,8 +3308,8 @@ Call_000_19f9:
push hl
ld a, $ff
ld [$d03d], a
ld [$d096], a
call Call_000_1e74
ld [wClearAllSprites], a
call StartTimer
ld hl, $38b1
ld a, [$d03b]
add a
@ -3336,7 +3339,7 @@ Call_000_19f9:
ld h, d
ld l, e
ld de, $c100
call Call_000_20c1
call Decompress
pop hl
ld a, [hl+]
ld [$d03f], a
@ -3478,21 +3481,21 @@ Call_000_19f9:
ld hl, $4000
ld de, $8000
ld c, $02
call Call_000_20c1
call Decompress
ld hl, $4855
ld de, $9670
ld c, $02
call Call_000_20c1
call Decompress
jr .jr_000_1b66
.jr_000_1b50:
ld hl, $488d
ld de, $8000
ld c, $0a
call Call_000_20c1
call Decompress
ld hl, $50f3
ld de, $9670
ld c, $0a
call Call_000_20c1
call Decompress
.jr_000_1b66:
pop de
pop hl
@ -3525,7 +3528,7 @@ Call_000_19f9:
ld l, c
ld a, [$d06b]
ld c, a
call Call_000_20c1
call Decompress
ld a, [$d06c]
ld c, a
add a
@ -3543,7 +3546,7 @@ Call_000_19f9:
ld h, d
ld l, e
ld de, $c600
call Call_000_20c1
call Decompress
ld hl, $ff91
bit 5, [hl]
jr z, .jump_000_1bc2
@ -3602,7 +3605,7 @@ InitWindow:
Call_000_1c0a:
call Call_000_1e74
call StartTimer
ld c, $40
ld hl, $9c00
ld a, $7f
@ -3632,7 +3635,7 @@ Call_000_1c0a:
ld [$9c0a], a
ld [$9c30], a
ld [$9c31], a
jp Call_000_1e67
jp StopTimer
Call_000_1c52:
@ -3915,9 +3918,9 @@ Call_000_1dc3:
push hl
push af
xor a
ld [$d095], a
ld [wClearSpritesOffset], a
call Call_000_2e9c
call Call_000_193b
call ClearSprites
pop af
pop hl
dec a
@ -4015,10 +4018,10 @@ Timer:
push hl
ld a, [wLoadedROMBank]
push af
ld a, $05
ld a, Bank(HandleTimer)
ld [wLoadedROMBank], a
ld [MBC1RomBank], a
call $4e0b
call HandleTimer
pop af
ld [wLoadedROMBank], a
ld [MBC1RomBank], a
@ -4029,8 +4032,8 @@ Timer:
reti
Call_000_1e67:
ld a, $00
StopTimer:
ld a, TACF_STOP
ldh [rTAC], a
ldh a, [hLCDC]
set 7, a
@ -4039,19 +4042,19 @@ Call_000_1e67:
ret
Call_000_1e74:
ld hl, $ff8a
res 7, [hl]
StartTimer:
ld hl, hLCDC
res 7, [hl] ; turn off LCDC
ld hl, $ff91
set 3, [hl]
.jr_000_1e7e:
.waitVBlank:
bit 3, [hl]
jr nz, .jr_000_1e7e
ld a, $00
jr nz, .waitVBlank
ld a, TACF_STOP
ldh [rTAC], a
ld a, $bc
ld a, 188
ldh [rTMA], a
ld a, $04
ld a, TACF_START | TACF_4KHZ ; This timer will fire at ~60.24 times per second
ldh [rTAC], a
ret
@ -4373,26 +4376,34 @@ Unk20B9:
db $40, $80, $C0, $00, $02, $01, $00, $00
Call_000_20c1:
Decompress:
; Decompresses a compressed data stream.
; Input: hl = source data
; c = bank of source data
; de = destination to store the decompressed data
ld a, [wLoadedROMBank]
push af
ld a, c
ld [wLoadedROMBank], a
ld [MBC1RomBank], a
ld [MBC1RomBank], a
call Call_000_20da
call HAL_Decompress
pop af
ld [wLoadedROMBank], a
ld [MBC1RomBank], a
ret
Call_000_20da:
HAL_Decompress:
; HAL Laboratory used this decompression technique in many of their games.
; For more information, see the exhal tool: https://github.com/devinacker/exhal
; Input: hl = source data
; de = destination to store the decompressed data
ld a, e
ld [$d097], a
ld [wDestGfxAddress], a
ld a, d
ld [$d098], a
.jump_000_20e2:
ld [wDestGfxAddress + 1], a
.loadNextGfx:
ld a, [hl]
cp $ff
ret z
@ -4418,7 +4429,7 @@ Call_000_20da:
and $1f
ld c, a
ld b, $00
inc c
inc c ; bc = [0] + 1
.jr_000_2104:
inc b
inc c
@ -4426,54 +4437,54 @@ Call_000_20da:
bit 7, a
jr nz, .jr_000_2154
cp $20
jr z, .jr_000_2124
jr z, .action_repeatSingleByte
cp $40
jr z, .jr_000_2131
jr z, .action_repeatTwoBytes
cp $60
jr z, .jr_000_2146
.jr_000_2117:
dec c
jr nz, .jr_000_211e
dec b
jp z, .jump_000_20e2
jp z, .loadNextGfx
.jr_000_211e:
ld a, [hl+]
call $d099
call wRAMFuncD099
jr .jr_000_2117
.jr_000_2124:
.action_repeatSingleByte:
ld a, [hl+]
.jr_000_2125:
.repeatSingleByte:
dec c
jr nz, .jr_000_212c
jr nz, .loadSingleByte
dec b
jp z, .jump_000_20e2
.jr_000_212c:
call $d099
jr .jr_000_2125
.jr_000_2131:
jp z, .loadNextGfx
.loadSingleByte:
call wRAMFuncD099
jr .repeatSingleByte
.action_repeatTwoBytes:
dec c
jr nz, .jr_000_2138
dec b
jp z, .jump_000_2142
.jr_000_2138:
ld a, [hl+]
call $d099
call wRAMFuncD099
ld a, [hl-]
call $d099
jr .jr_000_2131
call wRAMFuncD099
jr .action_repeatTwoBytes
.jump_000_2142:
inc hl
inc hl
jr .jump_000_20e2
jr .loadNextGfx
.jr_000_2146:
ld a, [hl+]
.jr_000_2147:
dec c
jr nz, .jr_000_214e
dec b
jp z, .jump_000_20e2
jp z, .loadNextGfx
.jr_000_214e:
call $d099
call wRAMFuncD099
inc a
jr .jr_000_2147
.jr_000_2154:
@ -4482,10 +4493,10 @@ Call_000_20da:
ld a, [hl+]
ld l, [hl]
ld h, a
ld a, [$d097]
ld a, [wDestGfxAddress]
add l
ld l, a
ld a, [$d098]
ld a, [wDestGfxAddress + 1]
adc h
ld h, a
pop af
@ -4538,34 +4549,42 @@ Call_000_20da:
pop hl
inc hl
inc hl
jp .jump_000_20e2
jp .loadNextGfx
Call_000_21a5:
ld a, $cb
ld [$d099], a
ld [$d09c], a
ld a, $37
ld [$d09a], a
ld [$d09d], a
call Call_000_20da
jp Call_000_21bb
ld a, $cb ; cb instruction prefix
ld [wRAMFuncD099 + 0], a
ld [wRAMFuncD099 + 3], a
ld a, $37 ; swap a
ld [wRAMFuncD099 + 1], a
ld [wRAMFuncD099 + 4], a
call HAL_Decompress
jp InitRamFuncD099
Call_000_21bb:
ld hl, $d099
InitRamFuncD099:
; TODO: There is some self-modifying code in RAM. What is it used for?
; Initializes to the following routine:
; nop
; nop
; ld (de), a
; inc de
; ret
;
ld hl, wRAMFuncD099
xor a
ld [hl+], a
ld [hl+], a
ld [hl+], a ; nop
ld [hl+], a ; nop
ld a, $12
ld [hl+], a
ld [hl+], a ; ld (de), a
xor a
ld [hl+], a
ld [hl+], a
ld a, $13
ld [hl+], a
ld [hl+], a ; inc de
ld a, $c9
ld [hl], a
ld [hl], a ; ret
ret
@ -4614,8 +4633,8 @@ Call_000_21e6:
Call_000_21fb:
ld [$d3f2], a
ld a, $ff
ld [$d096], a
call Call_000_193b
ld [wClearAllSprites], a
call ClearSprites
ld a, [wLoadedROMBank]
push af
ld a, [$d039]

View File

@ -1821,7 +1821,7 @@ Call_001_4bb4:
cp $10
jr nz, .jr_001_4be1
xor a
ld [$d095], a
ld [wClearSpritesOffset], a
ld hl, $d3bf
res 0, [hl]
res 3, [hl]
@ -2006,11 +2006,11 @@ Call_001_4d3f:
ld [$d078], a
ld [$d079], a
ld [$d064], a
ld [$d095], a
ld [wClearSpritesOffset], a
call Call_000_21fb
call Call_000_139b
call Call_000_2e9c
call Call_000_1e67
call StopTimer
call Call_000_0670
ld a, [$d03d]
cp $ff

14899
bank_002.asm

File diff suppressed because it is too large Load Diff

View File

@ -2021,44 +2021,44 @@ jr_005_4a77:
ld [hl], a
ret
Call_005_4abe:
WriteDMACodeToHRAM: ; 0x5f7
; Initializes registers hPushOAM - hFarCallTempA
ld c, $80
ld b, $0a
ld hl, $4acc
jr_005_4ac5:
ld a, [hl+]
ld [c], a
ld b, $a ; number of bytes to load
ld hl, DMARoutine
.loop
ld a, [hli]
ld [$ff00+c], a ; add register c to $ff00, and store register a into the resulting address
inc c
dec b
jr nz, jr_005_4ac5
jr nz, .loop
ret
ld a, $c0
ldh [rDMA], a
DMARoutine:
; This routine is initially loaded into hPushOAM - hFarCallTempA by WriteDMACodeToHRAM.
ld a, wOAMBuffer >> 8
ld [rDMA], a ; start DMA
ld a, $28
jr_005_4ad2:
.waitLoop ; wait for DMA to finish
dec a
jr nz, jr_005_4ad2
jr nz, .waitLoop
ret
Call_005_4ad6:
ld hl, $c000
jr_005_4ad9:
InitRAM:
ld hl, wRAMStart
.clearWRAMLoop:
xor a
ld [hl+], a
ld a, $e0
cp h
jr nz, jr_005_4ad9
ld hl, $ff8a
jr_005_4ae3:
jr nz, .clearWRAMLoop
ld hl, hLCDC
.clearHRAMLoop:
xor a
ld [hl+], a
ld a, l
cp $97
jr nz, jr_005_4ae3
cp (hRam96 + 1) & $ff
jr nz, .clearHRAMLoop
ld a, $01
ld [$d051], a
ld [$d052], a
@ -2089,14 +2089,14 @@ jr_005_4ae3:
inc a
ld [hl+], a
inc a
jr_005_4b2e:
ld [hl], a
ret
Call_005_4b30:
; TODO: nop-ing this function results in title-screen music alterations.
ld hl, $4b3a
ld de, $dc00
call $20da
call HAL_Decompress
ret
@ -2204,7 +2204,8 @@ jr_005_4ba1:
db $ec
ld d, d
cp b
jr nz, jr_005_4b2e
db $20
db $88
ld a, [c]
ld e, h
@ -2362,7 +2363,7 @@ jr_005_4c27:
ld l, d
rst $38
Call_005_4c4a:
InitSoundEngine:
ld a, $80
ldh [rNR52], a
ld a, $77
@ -2686,25 +2687,22 @@ jr_005_4e09:
ret
HandleTimer:
ld b, $07
jr_005_4e0d:
.jr_005_4e0d:
ld h, $de
ld a, $52
add b
ld l, a
ld a, [hl]
and a
jr z, jr_005_4e52
jr z, .jr_005_4e52
ld a, b
cp $04
ld a, $1a
jr c, jr_005_4e20
jr c, .jr_005_4e20
ld a, $2e
jr_005_4e20:
.jr_005_4e20:
ld [$df80], a
ld h, $de
ld a, $5a
@ -2741,23 +2739,19 @@ jr_005_4e20:
ld [hl], d
pop hl
ld [hl], e
jr_005_4e52:
.jr_005_4e52:
dec b
bit 7, b
jr z, jr_005_4e0d
jr z, .jr_005_4e0d
ld b, $03
jr_005_4e59:
.jr_005_4e59:
ld h, $de
ld a, $52
add b
ld l, a
ld a, [hl]
and a
jr nz, jr_005_4e6e
jr nz, .jr_005_4e6e
ld a, $ce
add b
ld l, a
@ -2765,14 +2759,11 @@ jr_005_4e59:
add $fc
ld l, a
ld [hl], $00
jr_005_4e6e:
.jr_005_4e6e:
dec b
bit 7, b
jr z, jr_005_4e59
jr z, .jr_005_4e59
call Call_005_4d1b
Call_005_4e76:
ld de, $de2e
ld a, [$de03]

View File

@ -2,36 +2,36 @@ SECTION "ROM Bank $006", ROMX[$4000], BANK[$6]
Call_006_4000:
ld a, $ff
ld [$d096], a
call $193b
call $1e74
ld [wClearAllSprites], a
call ClearSprites
call StartTimer
xor a
ld [$d095], a
ld [wClearSpritesOffset], a
ld [$d053], a
ld [$d081], a
ld [wBGP], a
ld a, $00
ld [$d055], a
ld hl, $4000
ld de, $8000
ld c, $02
call $20c1
ld hl, KirbySpriteGfx
ld de, _VRAM
ld c, Bank(KirbySpriteGfx)
call Decompress
ld hl, $4000
ld de, $8800
ld c, $0a
call $20c1
call Decompress
ld hl, $42ac
ld de, $9000
ld c, $0a
call $20c1
call Decompress
ld hl, $77e9
ld de, $8e00
ld c, $02
call $20c1
call Decompress
ld hl, $4000
ld de, $9800
ld c, $03
call $20c1
call Decompress
ld a, $05
call $1eb4
ld a, $01
@ -122,8 +122,8 @@ jr_006_40b0:
Call_006_40e4:
ld a, $ff
ld [$d096], a
call $193b
ld [wClearAllSprites], a
call ClearSprites
xor a
ld_long $ff90, a
ld [$d3f1], a
@ -179,11 +179,11 @@ jr_006_411c:
jr_006_4142:
ld a, $ff
ld [$d096], a
ld [wClearAllSprites], a
call $231e
call Call_000_0648
call Call_000_1c0a
call $1e74
call StartTimer
call Call_006_4285
ld d, $00
ld a, [$d03b]
@ -203,7 +203,7 @@ jr_006_4142:
ld h, d
ld l, e
ld de, $c600
call $20c1
call Decompress
ld a, $32
ld_long $ff8f, a
ld a, $15
@ -236,8 +236,8 @@ jr_006_4142:
ld a, [$d087]
ld [$d086], a
xor a
ld [$d095], a
call $193b
ld [wClearSpritesOffset], a
call ClearSprites
pop hl
ld a, [hl+]
ld [$d03e], a
@ -287,11 +287,11 @@ jr_006_421e:
add hl, bc
call $1964
xor a
ld [$d095], a
ld [wClearSpritesOffset], a
call $21fb
call $139b
call Call_000_2329
call $193b
call ClearSprites
ld a, [$d03b]
cp $04
jr nz, jr_006_424a
@ -350,22 +350,22 @@ Call_006_4285:
ld hl, $4000
ld de, $8000
ld c, $02
call $20c1
call Decompress
ld hl, $4855
ld de, $9670
ld c, $02
call $20c1
call Decompress
jr jr_006_42b9
jr_006_42a3:
ld hl, $488d
ld de, $8000
ld c, $0a
call $20c1
call Decompress
ld hl, $50f3
ld de, $9670
ld c, $0a
call $20c1
call Decompress
jr_006_42b9:
ld d, $00
@ -399,14 +399,14 @@ jr_006_42d1:
ld l, c
ld a, [$d06b]
ld c, a
call $20c1
call Decompress
ret
Call_006_42e8:
push hl
xor a
ld [$d095], a
ld [wClearSpritesOffset], a
ld [$d053], a
ld [$d055], a
inc a
@ -414,16 +414,16 @@ Call_006_42e8:
ld [$d052], a
ld hl, $ff94
set 1, [hl]
call $193b
call $1e74
call ClearSprites
call StartTimer
ld hl, $4000
ld de, $8000
ld c, $02
call $20c1
call Decompress
ld hl, $4855
ld de, $9670
ld c, $02
call $20c1
call Decompress
ld a, [$d03b]
ld c, a
add a
@ -447,7 +447,7 @@ Call_006_42e8:
ld l, c
ld a, [$d06b]
ld c, a
call $20c1
call Decompress
ld a, [$d03b]
cp $04
jr z, jr_006_435b
@ -455,11 +455,11 @@ Call_006_42e8:
ld hl, $77e9
ld de, $8e00
ld c, $02
call $20c1
call Decompress
ld hl, $5cdd
ld de, $8800
ld c, $03
call $20c1
call Decompress
jr_006_435b:
ld a, [$d03b]
@ -479,7 +479,7 @@ jr_006_435b:
ld h, d
ld l, e
ld de, $9800
call $20c1
call Decompress
xor a
call $21fb
call $1e67
@ -690,11 +690,11 @@ Call_006_4485:
add hl, bc
call $1964
ld a, $ff
ld [$d096], a
ld [wClearAllSprites], a
call Call_006_444f
xor a
call $21fb
call $193b
call ClearSprites
call $2e9c
ld a, [$d03b]
cp $04
@ -875,10 +875,10 @@ jr_006_45b5:
jr_006_45f6:
xor a
ld [$d095], a
ld [wClearSpritesOffset], a
call $2e9c
call $139b
call $193b
call ClearSprites
ld_long a, $ff8c
set 6, a
ld_long $ff8c, a
@ -1061,17 +1061,17 @@ jr_006_4731:
jr_006_4757:
call Call_000_0648
call $1c01
call $1e74
call StartTimer
ld a, $0a
call $21fb
ld hl, $4665
ld de, $9800
ld c, $03
call $20c1
call Decompress
ld hl, $41c7
ld de, $8e00
ld c, $03
call $20c1
call Decompress
ld a, $03
call $1eb4
xor a
@ -1080,7 +1080,7 @@ jr_006_4757:
call $1e67
call $0670
xor a
ld [$d095], a
ld [wClearSpritesOffset], a
call $2e9c
ld bc, $0118
@ -1110,7 +1110,7 @@ jr_006_47b0:
set 0, [hl]
call Call_000_0648
call $1c01
call $1e74
call StartTimer
call $231e
inc a
ld [$d051], a
@ -1118,20 +1118,20 @@ jr_006_47b0:
ld a, $0b
call $21fb
ld a, $ff
ld [$d096], a
call $193b
ld [wClearAllSprites], a
call ClearSprites
ld hl, $77e9
ld de, $8e00
ld c, $02
call $20c1
call Decompress
ld hl, $5cdd
ld de, $8800
ld c, $03
call $20c1
call Decompress
ld hl, $46b5
ld de, $9800
ld c, $03
call $20c1
call Decompress
xor a
ld [$d06b], a
ld [$d053], a
@ -1199,14 +1199,14 @@ Jump_006_485e:
ld a, $3c
call $1dc3
call Call_000_0648
call $1e74
call StartTimer
jp $0156
Jump_006_486c:
ld a, $ff
ld [$d096], a
call $193b
ld [wClearAllSprites], a
call ClearSprites
call Call_000_0648
ld a, $ff
call $1e96
@ -1226,23 +1226,23 @@ Jump_006_486c:
xor a
ld [$d053], a
ld [$d055], a
call $1e74
call StartTimer
ld hl, $41c7
ld de, $8e00
ld c, $03
call $20c1
call Decompress
ld hl, $4fcf
ld de, $8000
ld c, $03
call $20c1
call Decompress
ld hl, $5894
ld de, $9000
ld c, $03
call $20c1
call Decompress
ld hl, $42c8
ld de, $9800
ld c, $03
call $20c1
call Decompress
call $1e67
call $0670
ld de, $00c8
@ -1264,30 +1264,30 @@ jr_006_48e0:
xor a
ld_long $ff90, a
ld a, $ff
ld [$d096], a
call $193b
ld [wClearAllSprites], a
call ClearSprites
call Call_000_0648
call $1e74
call StartTimer
ld hl, $4000
ld de, $8000
ld c, $02
call $20c1
call Decompress
ld hl, $4855
ld de, $9670
ld c, $02
call $20c1
call Decompress
ld hl, $6c49
ld de, $8800
ld c, $02
call $20c1
call Decompress
ld hl, $777c
ld de, $c600
ld c, $06
call $20c1
call Decompress
ld hl, $71e2
ld de, $c100
ld c, $06
call $20c1
call Decompress
ld a, $04
call $21fb
call Call_006_5098
@ -1316,29 +1316,29 @@ jr_006_495b:
jr nz, jr_006_4959
ld a, $ff
ld [$d096], a
call $193b
ld [wClearAllSprites], a
call ClearSprites
call Call_000_0648
ld a, $05
call $21fb
call Call_006_5098
call $1e74
call StartTimer
ld hl, $41c7
ld de, $8e00
ld c, $03
call $20c1
call Decompress
ld hl, $4fcf
ld de, $8000
ld c, $03
call $20c1
call Decompress
ld hl, $5894
ld de, $9000
ld c, $03
call $20c1
call Decompress
ld hl, $42c8
ld de, $9800
ld c, $03
call $20c1
call Decompress
call $1e67
call $0670
ld de, $0200
@ -1358,7 +1358,7 @@ jr_006_49b7:
jr nz, jr_006_49b5
call Call_000_0648
call $1e74
call StartTimer
ld a, $06
call $21fb
call Call_006_5098
@ -1466,10 +1466,10 @@ jr_006_4a3e:
Jump_006_4a65:
ld a, $ff
ld [$d096], a
call $193b
ld [wClearAllSprites], a
call ClearSprites
call Call_000_0648
call $1e74
call StartTimer
ld a, $07
call $21fb
@ -1785,7 +1785,7 @@ Jump_006_4c5c:
ldh [rOBP0], a
ld a, $05
call $1dc3
call $1e74
call StartTimer
xor a
ld [wBGP], a
ld a, $08
@ -1799,7 +1799,7 @@ Jump_006_4c5c:
ld hl, $437a
ld de, $9800
ld c, $03
call $20c1
call Decompress
call $1e67
call $0670
ld de, $0144
@ -1819,14 +1819,14 @@ jr_006_4cba:
jr nz, jr_006_4cb8
call Call_000_0648
call $1e74
call StartTimer
ld a, $09
call $21fb
call Call_006_5098
ld hl, $441d
ld de, $9800
ld c, $03
call $20c1
call Decompress
call $1e67
call $0670
ld de, $0190
@ -1853,7 +1853,7 @@ jr_006_4cf3:
jr_006_4d06:
call Call_000_0648
call $1e74
call StartTimer
call $231e
ld a, [$d039]
and a
@ -1872,51 +1872,51 @@ jr_006_4d06:
ld hl, $4000
ld de, $9000
ld c, $0d
call $20c1
call Decompress
ld hl, $45c0
ld de, $9800
ld c, $0d
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
ld a, $0d
call $21fb
call Call_006_5098
ld hl, $46fb
ld de, $9000
ld c, $0d
call $20c1
call Decompress
ld hl, $4cb4
ld de, $9800
ld c, $0d
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
ld a, $0e
call $21fb
call Call_006_5098
ld hl, $4dc0
ld de, $9000
ld c, $0d
call $20c1
call Decompress
ld hl, $535c
ld de, $9800
ld c, $0d
call $20c1
call Decompress
call $1e67
call $0670
ld de, $00ec
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
ld a, $01
ld [$d03b], a
call Call_006_4275
@ -1926,34 +1926,34 @@ jr_006_4d06:
ld hl, $543e
ld de, $9000
ld c, $0d
call $20c1
call Decompress
ld hl, $5987
ld de, $9800
ld c, $0d
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
ld a, $10
call $21fb
call Call_006_5098
ld hl, $5a89
ld de, $9000
ld c, $0d
call $20c1
call Decompress
ld hl, $5fd2
ld de, $9800
ld c, $0d
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
ld a, $02
ld [$d03b], a
call Call_006_4275
@ -1963,34 +1963,34 @@ jr_006_4d06:
ld hl, $6063
ld de, $9000
ld c, $0d
call $20c1
call Decompress
ld hl, $6553
ld de, $9800
ld c, $0d
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
ld a, $12
call $21fb
call Call_006_5098
ld hl, $6658
ld de, $9000
ld c, $0d
call $20c1
call Decompress
ld hl, $6b80
ld de, $9800
ld c, $0d
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
ld a, $03
ld [$d03b], a
call Call_006_4275
@ -2000,34 +2000,34 @@ jr_006_4d06:
ld hl, $6c7c
ld de, $9000
ld c, $0d
call $20c1
call Decompress
ld hl, $717d
ld de, $9800
ld c, $0d
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
ld a, $14
call $21fb
call Call_006_5098
ld hl, $729b
ld de, $9000
ld c, $0d
call $20c1
call Decompress
ld hl, $779c
ld de, $9800
ld c, $0d
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
xor a
ld [$d03b], a
call Call_006_4285
@ -2037,17 +2037,17 @@ jr_006_4d06:
ld hl, $4000
ld de, $9000
ld c, $0e
call $20c1
call Decompress
ld hl, $78cc
ld de, $9800
ld c, $0d
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
ld a, $01
ld [$d03b], a
call Call_006_4285
@ -2057,17 +2057,17 @@ jr_006_4d06:
ld hl, $4582
ld de, $9000
ld c, $0e
call $20c1
call Decompress
ld hl, $4ac6
ld de, $9800
ld c, $0e
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
ld a, $02
ld [$d03b], a
call Call_006_4285
@ -2077,17 +2077,17 @@ jr_006_4d06:
ld hl, $4bf3
ld de, $9000
ld c, $0e
call $20c1
call Decompress
ld hl, $511e
ld de, $9800
ld c, $0e
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
ld a, $03
ld [$d03b], a
call Call_006_4285
@ -2097,32 +2097,32 @@ jr_006_4d06:
ld hl, $5206
ld de, $9000
ld c, $0e
call $20c1
call Decompress
ld hl, $5707
ld de, $9800
ld c, $0e
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
call Call_006_5086
call Call_000_0648
call $1e74
call StartTimer
ld hl, $6c49
ld de, $8800
ld c, $02
call $20c1
call Decompress
ld a, $19
call $21fb
call Call_006_5098
ld hl, $5820
ld de, $9000
ld c, $0e
call $20c1
call Decompress
ld hl, $5be1
ld de, $9800
ld c, $0e
call $20c1
call Decompress
call $1e67
call $0670
ld de, $01a0
@ -2149,7 +2149,7 @@ jr_006_500b:
jr_006_501e:
call Call_000_0648
call $1e74
call StartTimer
ld a, $ff
call $1eb4
ld a, $1a
@ -2158,11 +2158,11 @@ jr_006_501e:
ld hl, $5cbf
ld de, $8000
ld c, $0e
call $20c1
call Decompress
ld hl, $6cce
ld de, $9800
ld c, $0e
call $20c1
call Decompress
call $1e67
call $0670
@ -2180,11 +2180,11 @@ Jump_006_5055:
ld hl, $6dd9
ld de, $8000
ld c, $0e
call $20c1
call Decompress
ld hl, $7e4a
ld de, $9800
ld c, $0e
call $20c1
call Decompress
call $1e67
call $0670
@ -2222,9 +2222,9 @@ Call_006_5098:
ld a, [$d06c]
push af
xor a
ld [$d095], a
ld [wClearSpritesOffset], a
call $2e9c
call $193b
call ClearSprites
pop af
ld [$d06c], a
pop af
@ -7096,31 +7096,31 @@ Jump_006_5f00:
Jump_006_6386:
call Call_000_0648
call $1e74
call StartTimer
call $231e
call $1c01
xor a
ld [$d053], a
ld [$d055], a
ld a, $ff
ld [$d096], a
call $193b
ld [wClearAllSprites], a
call ClearSprites
ld hl, $4855
ld de, $9670
ld c, $02
call $20c1
call Decompress
ld hl, $7b0d
ld de, $8800
ld c, $06
call $20c1
call Decompress
ld hl, $41c7
ld de, $8e00
ld c, $03
call $20c1
call Decompress
ld hl, $4541
ld de, $9800
ld c, $03
call $20c1
call Decompress
xor a
ld [$d06b], a
dec a
@ -7374,14 +7374,14 @@ jr_006_652f:
Jump_006_655e:
pop hl
call Call_000_0648
call $1e74
call StartTimer
ld a, $02
call $21fb
call $1c01
ld hl, $44c9
ld de, $9800
ld c, $03
call $20c1
call Decompress
call $1e67
call $0670
xor a

BIN
gfx/kirby_sprites.2bpp.lz Normal file

Binary file not shown.

View File

@ -1 +1,5 @@
hLCDC EQU $8a
hRam80 EQU $ff80
hLCDC EQU $ff8a
hRam96 EQU $ff96

View File

@ -1,7 +1,9 @@
SECTION "WRAM Bank 0", WRAM0
wc000::
ds 1
wRAMStart::
wOAMBuffer:: ; $c000
ds $a0
wOAMBufferEnd:: ; $c0a0
SECTION "WRAM Bank 1", WRAMX
@ -15,3 +17,18 @@ wLoadedROMBank:: ; $d02c
wBGP:: ; $d080
ds 1
ds $14
wClearSpritesOffset:: ; $d095
ds 1
wClearAllSprites:: ; $d096
; When this is set to $ff, all OAM sprites are cleared.
ds 1
wDestGfxAddress:: ; $d097
ds 2
wRAMFuncD099:: ; $d099
ds 7