summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2016-03-19 19:07:55 -0400
committerluckytyphlosion <alan.rj.huang@gmail.com>2016-03-19 19:07:55 -0400
commit3e6965491f2989912f95e116e138b58044235a30 (patch)
tree87c67d17c85dd774bd325cdc4294631498715364
parentd2a412071cd7cadcd9e3dee6f88f6738419fc70c (diff)
Start working on bank20 audio
Note: Address labels aren't correct.
-rw-r--r--audio.asm10
-rw-r--r--audio/engine_4.asm189
-rwxr-xr-xyellow/main.asm8
3 files changed, 199 insertions, 8 deletions
diff --git a/audio.asm b/audio.asm
index ee334c02..4cc10b34 100644
--- a/audio.asm
+++ b/audio.asm
@@ -2,6 +2,7 @@
AUDIO_1 EQU $2
AUDIO_2 EQU $8
AUDIO_3 EQU $1f
+AUDIO_4 EQU $20
PCM_1 EQU $21
PCM_2 EQU $22
@@ -653,7 +654,16 @@ INCLUDE "audio/music/halloffame.asm"
INCLUDE "audio/music/credits.asm"
INCLUDE "audio/music/yellowintro.asm"
+SECTION "Music 4", ROMX, BANK[AUDIO_4]
+SFX_Headers_4: ; 80000 (20:4000)
+ dr $80000,$80f14
+SurfingPikachu1Graphics: INCBIN "gfx/surfing_pikachu_1.t4.2bpp"
+
+INCLUDE "audio/engine_4.asm"
+
+ dr $82ce8,$84000
+
SECTION "Pikachu Cries 1",ROMX,BANK[PCM_1]
PikachuCry1:: ; 84000 (21:4000)
dw (PikachuCry1_End - PikachuCry1) - 2 ; length of pcm data
diff --git a/audio/engine_4.asm b/audio/engine_4.asm
new file mode 100644
index 00000000..c4c1c9dd
--- /dev/null
+++ b/audio/engine_4.asm
@@ -0,0 +1,189 @@
+Audio4_PlaySound:: ; 82bd4 (20:6bd4)
+; Duplicate of Audio3_PlaySound
+ ld [wSoundID], a
+ ld a, [wSoundID]
+ cp $ff
+ jp z, Audio4_7d18e
+ cp $98
+ jp z, Audio4_7d12d
+ jp c, Audio4_7d12d
+ cp $a3
+ jr z, .asm_7d127
+ jp nc, Audio4_7d12d
+.asm_7d127
+ call InitMusicVariables
+ jp Audio4_7d192
+
+Audio4_7d12d: ; 7d12d (1f:512d)
+ ld l, a
+ ld e, a
+ ld h, $0
+ ld d, h
+ add hl, hl
+ add hl, de
+ ld de, SFX_Headers_4
+ add hl, de
+ ld a, h
+ ld [wSfxHeaderPointer], a
+ ld a, l
+ ld [wSfxHeaderPointer + 1], a
+ ld a, [hl]
+ and $c0
+ rlca
+ rlca
+ ld c, a
+.asm_7d146
+ ld d, c
+ ld a, c
+ add a
+ add c
+ ld c, a
+ ld b, $0
+ ld a, [wSfxHeaderPointer]
+ ld h, a
+ ld a, [wSfxHeaderPointer + 1]
+ ld l, a
+ add hl, bc
+ ld c, d
+ ld a, [hl]
+ and $f
+ ld e, a
+ ld d, $0
+ ld hl, wChannelSoundIDs
+ add hl, de
+ ld a, [hl]
+ and a
+ jr z, .asm_7d182
+ ld a, e
+ cp $7
+ jr nz, .asm_7d179
+ ld a, [wSoundID]
+ cp $14
+ jr nc, .asm_7d172
+ ret
+.asm_7d172
+ ld a, [hl]
+ cp $14
+ jr z, .asm_7d182
+ jr c, .asm_7d182
+.asm_7d179
+ ld a, [wSoundID]
+ cp [hl]
+ jr z, .asm_7d182
+ jr c, .asm_7d182
+ ret
+.asm_7d182
+ call InitSFXVariables
+ ld a, c
+ and a
+ jp z, Audio4_7d192
+ dec c
+ jp .asm_7d146
+
+Audio4_7d18e: ; 7d18e (1f:518e)
+ call StopAllAudio
+ ret
+
+Audio4_7d192: ; 7d192 (1f:5192)
+ ld a, [wSoundID]
+ ld l, a
+ ld e, a
+ ld h, $0
+ ld d, h
+ add hl, hl
+ add hl, de
+ ld de, SFX_Headers_4
+ add hl, de
+ ld e, l
+ ld d, h
+ ld hl, wChannelCommandPointers
+ ld a, [de] ; get channel number
+ ld b, a
+ rlca
+ rlca
+ and $3
+ ld c, a
+ ld a, b
+ and $f
+ ld b, c
+ inc b
+ inc de
+ ld c, $0
+.asm_7d1b4
+ cp c
+ jr z, .asm_7d1bc
+ inc c
+ inc hl
+ inc hl
+ jr .asm_7d1b4
+.asm_7d1bc
+ push af
+ push hl
+ push bc
+ ld b, $0
+ ld c, a
+ cp $3
+ jr c, .asm_7d1cc
+ ld hl, wChannelFlags1
+ add hl, bc
+ set 2, [hl]
+.asm_7d1cc
+ pop bc
+ pop hl
+ ld a, [de] ; get channel pointer
+ ld [hli], a
+ inc de
+ ld a, [de]
+ ld [hli], a
+ inc de
+ pop af
+ push hl
+ push bc
+ ld b, $0
+ ld c, a
+ ld hl, wChannelSoundIDs
+ add hl, bc
+ ld a, [wSoundID]
+ ld [hl], a
+ pop bc
+ pop hl
+ inc c
+ dec b
+ ld a, b
+ and a
+ ld a, [de]
+ inc de
+ jr nz, .asm_7d1b4
+ ld a, [wSoundID]
+ cp $14
+ jr nc, .asm_7d1f5
+ jr .asm_7d21f
+.asm_7d1f5
+ ld a, [wSoundID]
+ cp $86
+ jr z, .asm_7d21f
+ jr c, .asm_7d200
+ jr .asm_7d21f
+.asm_7d200
+ ld hl, wChannelSoundIDs + CH4
+ ld [hli], a
+ ld [hli], a
+ ld [hli], a
+ ld [hl], a
+ ld hl, wChannelCommandPointers + CH6 * 2 ; sfx noise channel pointer
+ ld de, Noise4_endchannel
+ ld [hl], e
+ inc hl
+ ld [hl], d ; overwrite pointer to point to endchannel
+ ld a, [wSavedVolume]
+ and a
+ jr nz, .asm_7d21f
+ ld a, [rNR50]
+ ld [wSavedVolume], a
+ ld a, $77
+ ld [rNR50], a
+.asm_7d21f
+ ret
+
+Noise4_endchannel: ; 7d220 (1f:5220)
+ endchannel \ No newline at end of file
diff --git a/yellow/main.asm b/yellow/main.asm
index e9c5bbf8..81e7005b 100755
--- a/yellow/main.asm
+++ b/yellow/main.asm
@@ -827,14 +827,6 @@ AttackAnimationPointers: ; 7a22a (1e:622a)
SubanimationPointers: ; 7a915 (1e:6915)
dr $7a915,$7c000
-SECTION "bank20",ROMX,BANK[$20]
-
- dr $80000,$80f14
-
-SurfingPikachu1Graphics: INCBIN "gfx/surfing_pikachu_1.t4.2bpp"
-Audio4_PlaySound: ; 82bd4 (20:6bd4)
- dr $82bd4,$84000
-
SECTION "bank2f",ROMX[$5000],BANK[$2F]
INCLUDE "engine/bg_map_attributes.asm"