Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pret/pokered
Browse files Browse the repository at this point in the history
  • Loading branch information
dannye committed Sep 12, 2022
2 parents 8f369bf + d809d3d commit ecab352
Show file tree
Hide file tree
Showing 115 changed files with 1,837 additions and 998 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ To set up the repository, see [**INSTALL.md**](INSTALL.md).

## See also

- [**Wiki**][wiki] (includes [tutorials][tutorials])
- [**Symbols**][symbols]
- **Discord:** [pret][discord]
- **IRC:** [libera#pret][irc]

Expand All @@ -35,6 +37,9 @@ Other disassembly projects:
[pokeruby]: https://github.com/pret/pokeruby
[pokefirered]: https://github.com/pret/pokefirered
[pokeemerald]: https://github.com/pret/pokeemerald
[wiki]: https://github.com/pret/pokeyellow/wiki
[tutorials]: https://github.com/pret/pokeyellow/wiki/Tutorials
[symbols]: https://github.com/pret/pokeyellow/tree/symbols
[discord]: https://discord.gg/d5dubZ3
[irc]: https://web.libera.chat/?#pret
[ci]: https://github.com/pret/pokeyellow/actions
Expand Down
3 changes: 2 additions & 1 deletion audio.asm
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ INCLUDE "audio/engine_4.asm"

SECTION "Music 1", ROMX

Audio1_WavePointers: INCLUDE "audio/wave_instruments.asm"
Audio1_WavePointers:
INCLUDE "audio/wave_samples.asm"

INCLUDE "audio/music/pkmnhealed.asm"
INCLUDE "audio/music/routes1.asm"
Expand Down
86 changes: 43 additions & 43 deletions audio/engine_1.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; The first of four partially duplicated sound engines.

Audio1_UpdateMusic::
ld c, Ch1
ld c, CHAN1
.loop
ld b, 0
ld hl, wChannelSoundIDs
Expand All @@ -10,7 +10,7 @@ Audio1_UpdateMusic::
and a
jr z, .nextChannel
ld a, c
cp Ch5
cp CHAN5
jr nc, .applyAffects ; if sfx channel
ld a, [wMuteAudioAndPauseMusic]
and a
Expand All @@ -30,7 +30,7 @@ Audio1_UpdateMusic::
.nextChannel
ld a, c
inc c ; inc channel number
cp Ch8
cp CHAN8
jr nz, .loop
ret

Expand All @@ -46,9 +46,9 @@ Audio1_ApplyMusicAffects:
dec a ; otherwise, decrease the delay timer
ld [hl], a
ld a, c
cp Ch5
cp CHAN5
jr nc, .startChecks ; if a sfx channel
ld hl, wChannelSoundIDs + Ch5
ld hl, wChannelSoundIDs + CHAN5
add hl, bc
ld a, [hl]
and a
Expand Down Expand Up @@ -180,15 +180,15 @@ Audio1_sound_ret:
bit BIT_SOUND_CALL, [hl]
jr nz, .returnFromCall
ld a, c
cp Ch4
cp CHAN4
jr nc, .noiseOrSfxChannel
jr .disableChannelOutput
.noiseOrSfxChannel
res BIT_NOISE_OR_SFX, [hl]
ld hl, wChannelFlags2
add hl, bc
res BIT_EXECUTE_MUSIC, [hl]
cp Ch7
cp CHAN7
jr nz, .skipSfxChannel3
; restart hardware channel 3 (wave channel) output
ld a, $0
Expand Down Expand Up @@ -232,19 +232,19 @@ Audio1_sound_ret:
and [hl]
ldh [rNR51], a
.afterDisable
ld a, [wChannelSoundIDs + Ch5]
ld a, [wChannelSoundIDs + CHAN5]
cp CRY_SFX_START
jr nc, .maybeCry
jr .skipCry
.maybeCry
ld a, [wChannelSoundIDs + Ch5]
ld a, [wChannelSoundIDs + CHAN5]
cp CRY_SFX_END
jr z, .skipCry
jr c, .cry
jr .skipCry
.cry
ld a, c
cp Ch5
cp CHAN5
jr z, .skipRewind
call Audio1_GoBackOneCommandIfCry
ret c
Expand Down Expand Up @@ -345,14 +345,14 @@ Audio1_note_type:
add hl, bc
ld [hl], a ; store low nibble as speed
ld a, c
cp Ch4
cp CHAN4
jr z, .noiseChannel ; noise channel has 0 params
call Audio1_GetNextMusicByte
ld d, a
ld a, c
cp Ch3
cp CHAN3
jr z, .musicChannel3
cp Ch7
cp CHAN7
jr nz, .skipChannel3
ld hl, wSfxWaveInstrument
jr .channel3
Expand Down Expand Up @@ -486,7 +486,7 @@ Audio1_tempo:
cp tempo_cmd
jr nz, Audio1_stereo_panning
ld a, c
cp Ch5
cp CHAN5
jr nc, .sfxChannel
call Audio1_GetNextMusicByte
ld [wMusicTempo], a ; store first param
Expand Down Expand Up @@ -530,10 +530,10 @@ Audio1_unknownmusic0xef:
ld a, [wDisableChannelOutputWhenSfxEnds]
and a
jr nz, .skip
ld a, [wChannelSoundIDs + Ch8]
ld a, [wChannelSoundIDs + CHAN8]
ld [wDisableChannelOutputWhenSfxEnds], a
xor a
ld [wChannelSoundIDs + Ch8], a
ld [wChannelSoundIDs + CHAN8], a
.skip
jp Audio1_sound_ret

Expand Down Expand Up @@ -587,7 +587,7 @@ Audio1_sfx_note:
cp sfx_note_cmd
jr nz, Audio1_pitch_sweep
ld a, c
cp Ch4 ; is this a noise or sfx channel?
cp CHAN4 ; is this a noise or sfx channel?
jr c, Audio1_pitch_sweep ; no
ld b, 0
ld hl, wChannelFlags2
Expand Down Expand Up @@ -617,7 +617,7 @@ Audio1_sfx_note:
call Audio1_GetNextMusicByte
ld e, a
ld a, c
cp Ch8
cp CHAN8
ld a, 0
jr z, .skip
; Channels 1 through 3 have 2 registers that control frequency, but the noise
Expand All @@ -637,7 +637,7 @@ Audio1_sfx_note:

Audio1_pitch_sweep:
ld a, c
cp Ch5
cp CHAN5
jr c, Audio1_note ; if not a sfx
ld a, d
cp pitch_sweep_cmd
Expand All @@ -653,7 +653,7 @@ Audio1_pitch_sweep:

Audio1_note:
ld a, c
cp Ch4
cp CHAN4
jr nz, Audio1_note_length ; if not noise channel
ld a, d
and $f0
Expand Down Expand Up @@ -711,7 +711,7 @@ Audio1_note_length:
ld l, b
call Audio1_MultiplyAdd
ld a, c
cp Ch5
cp CHAN5
jr nc, .sfxChannel
ld a, [wMusicTempo]
ld d, a
Expand All @@ -721,7 +721,7 @@ Audio1_note_length:
.sfxChannel
ld d, $1
ld e, $0
cp Ch8
cp CHAN8
jr z, .skip ; if noise channel
call Audio1_SetSfxTempo
ld a, [wSfxTempo]
Expand Down Expand Up @@ -761,20 +761,20 @@ Audio1_note_pitch:
cp rest_cmd
jr nz, .notRest
ld a, c
cp Ch5
cp CHAN5
jr nc, .next
; If this isn't an SFX channel, try the corresponding SFX channel.
ld hl, wChannelSoundIDs + Ch5
ld hl, wChannelSoundIDs + CHAN5
add hl, bc
ld a, [hl]
and a
jr nz, .done
; fall through
.next
ld a, c
cp Ch3
cp CHAN3
jr z, .channel3
cp Ch7
cp CHAN7
jr nz, .notChannel3
.channel3
ld b, 0
Expand Down Expand Up @@ -810,10 +810,10 @@ Audio1_note_pitch:
.skipPitchSlide
push de
ld a, c
cp Ch5
cp CHAN5
jr nc, .sfxChannel ; if sfx channel
; If this isn't an SFX channel, try the corresponding SFX channel.
ld hl, wChannelSoundIDs + Ch5
ld hl, wChannelSoundIDs + CHAN5
ld d, 0
ld e, a
add hl, de
Expand Down Expand Up @@ -858,12 +858,12 @@ Audio1_EnableChannelOutput:
or [hl] ; set this channel's bits
ld d, a
ld a, c
cp Ch8
cp CHAN8
jr z, .noiseChannelOrNoSfx
cp Ch5
cp CHAN5
jr nc, .skip ; if sfx channel
; If this isn't an SFX channel, try the corresponding SFX channel.
ld hl, wChannelSoundIDs + Ch5
ld hl, wChannelSoundIDs + CHAN5
add hl, bc
ld a, [hl]
and a
Expand Down Expand Up @@ -893,9 +893,9 @@ Audio1_ApplyDutyCycleAndSoundLength:
add hl, bc
ld d, [hl]
ld a, c
cp Ch3
cp CHAN3
jr z, .skipDuty ; if music channel 3
cp Ch7
cp CHAN7
jr z, .skipDuty ; if sfx channel 3
; include duty cycle (except on channel 3 which doesn't have it)
ld a, d
Expand All @@ -914,15 +914,15 @@ Audio1_ApplyDutyCycleAndSoundLength:

Audio1_ApplyWavePatternAndFrequency:
ld a, c
cp Ch3
cp CHAN3
jr z, .channel3
cp Ch7
cp CHAN7
jr nz, .notChannel3
; fall through
.channel3
push de
ld de, wMusicWaveInstrument
cp Ch3
cp CHAN3
jr z, .next
ld de, wSfxWaveInstrument
.next
Expand Down Expand Up @@ -1046,7 +1046,7 @@ Audio1_GoBackOneCommandIfCry:

Audio1_IsCry:
; Returns whether the currently playing audio is a cry in carry.
ld a, [wChannelSoundIDs + Ch5]
ld a, [wChannelSoundIDs + CHAN5]
cp CRY_SFX_START
jr nc, .next
jr .no
Expand All @@ -1067,9 +1067,9 @@ Audio1_IsBattleSFX:
ld a, [wAudioROMBank]
cp BANK("Audio Engine 2")
jr nz, .no
ld a, [wChannelSoundIDs + Ch8]
ld a, [wChannelSoundIDs + CHAN8]
ld b, a
ld a, [wChannelSoundIDs + Ch5]
ld a, [wChannelSoundIDs + CHAN5]
or b
cp BATTLE_SFX_START
jr c, .no
Expand Down Expand Up @@ -1422,7 +1422,7 @@ Audio1_PlaySound::
and a
jr z, .playChannel
ld a, e
cp Ch8
cp CHAN8
jr nz, .notNoiseChannel
ld a, [wSoundID]
cp NOISE_INSTRUMENTS_END
Expand Down Expand Up @@ -1489,7 +1489,7 @@ Audio1_PlaySound::
push bc
ld b, 0
ld c, a
cp Ch4
cp CHAN4
jr c, .skipSettingFlag
ld hl, wChannelFlags1
add hl, bc
Expand Down Expand Up @@ -1532,12 +1532,12 @@ Audio1_PlaySound::
jr c, .cry
jr .done
.cry
ld hl, wChannelSoundIDs + Ch5
ld hl, wChannelSoundIDs + CHAN5
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld hl, wChannelCommandPointers + Ch7 * 2 ; sfx wave channel pointer
ld hl, wChannelCommandPointers + CHAN7 * 2 ; sfx wave channel pointer
ld de, Audio1_CryRet
ld [hl], e
inc hl
Expand Down
10 changes: 5 additions & 5 deletions audio/engine_2.asm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Audio2_PlaySound::
and a
jr z, .playChannel
ld a, e
cp Ch8
cp CHAN8
jr nz, .notNoiseChannel
ld a, [wSoundID]
cp NOISE_INSTRUMENTS_END
Expand Down Expand Up @@ -126,7 +126,7 @@ Audio2_PlaySound::
push bc
ld b, 0
ld c, a
cp Ch4
cp CHAN4
jr c, .skipSettingFlag
ld hl, wChannelFlags1
add hl, bc
Expand Down Expand Up @@ -169,12 +169,12 @@ Audio2_PlaySound::
jr c, .cry
jr .done
.cry
ld hl, wChannelSoundIDs + Ch5
ld hl, wChannelSoundIDs + CHAN5
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld hl, wChannelCommandPointers + Ch7 * 2 ; sfx wave channel pointer
ld hl, wChannelCommandPointers + CHAN7 * 2 ; sfx wave channel pointer
ld de, Audio2_CryRet
ld [hl], e
inc hl
Expand Down Expand Up @@ -351,7 +351,7 @@ Audio2_InitSFXVariables::
add hl, de
ld [hl], a
ld a, e
cp Ch5
cp CHAN5
ret nz
ld a, $8
ldh [rNR10], a ; sweep off
Expand Down
Loading

0 comments on commit ecab352

Please sign in to comment.