mirror of
https://github.com/pret/pokered.git
synced 2024-10-22 22:55:31 +00:00
Define constants for audio commands
This commit is contained in:
parent
84abdb0237
commit
7306c1dc2d
4 changed files with 185 additions and 137 deletions
|
@ -41,7 +41,7 @@ Audio1_ApplyMusicAffects:
|
||||||
ld hl, wChannelNoteDelayCounters ; delay until next note
|
ld hl, wChannelNoteDelayCounters ; delay until next note
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp $1 ; if the delay is 1, play next note
|
cp 1 ; if the delay is 1, play next note
|
||||||
jp z, Audio1_PlayNextNote
|
jp z, Audio1_PlayNextNote
|
||||||
dec a ; otherwise, decrease the delay timer
|
dec a ; otherwise, decrease the delay timer
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
@ -163,8 +163,8 @@ Audio1_PlayNextNote:
|
||||||
Audio1_sound_ret:
|
Audio1_sound_ret:
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld d, a
|
ld d, a
|
||||||
cp $ff ; is this command a sound_ret?
|
cp sound_ret_cmd
|
||||||
jp nz, Audio1_sound_call ; no
|
jp nz, Audio1_sound_call
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -251,8 +251,8 @@ Audio1_sound_ret:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Audio1_sound_call:
|
Audio1_sound_call:
|
||||||
cp $fd ; is this command a sound_call?
|
cp sound_call_cmd
|
||||||
jp nz, Audio1_sound_loop ; no
|
jp nz, Audio1_sound_loop
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
push af
|
push af
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
|
@ -288,8 +288,8 @@ Audio1_sound_call:
|
||||||
jp Audio1_sound_ret
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_sound_loop:
|
Audio1_sound_loop:
|
||||||
cp $fe ; is this command a sound_loop?
|
cp sound_loop_cmd
|
||||||
jp nz, Audio1_note_type ; no
|
jp nz, Audio1_note_type
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld e, a
|
ld e, a
|
||||||
and a
|
and a
|
||||||
|
@ -327,8 +327,8 @@ Audio1_sound_loop:
|
||||||
|
|
||||||
Audio1_note_type:
|
Audio1_note_type:
|
||||||
and $f0
|
and $f0
|
||||||
cp $d0 ; is this command a note_type?
|
cp note_type_cmd
|
||||||
jp nz, Audio1_toggle_perfect_pitch ; no
|
jp nz, Audio1_toggle_perfect_pitch
|
||||||
ld a, d
|
ld a, d
|
||||||
and $f
|
and $f
|
||||||
ld b, $0
|
ld b, $0
|
||||||
|
@ -371,8 +371,8 @@ Audio1_note_type:
|
||||||
|
|
||||||
Audio1_toggle_perfect_pitch:
|
Audio1_toggle_perfect_pitch:
|
||||||
ld a, d
|
ld a, d
|
||||||
cp $e8 ; is this command a toggle_perfect_pitch?
|
cp toggle_perfect_pitch_cmd
|
||||||
jr nz, Audio1_vibrato ; no
|
jr nz, Audio1_vibrato
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -382,8 +382,8 @@ Audio1_toggle_perfect_pitch:
|
||||||
jp Audio1_sound_ret
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_vibrato:
|
Audio1_vibrato:
|
||||||
cp $ea ; is this command a vibrato?
|
cp vibrato_cmd
|
||||||
jr nz, Audio1_pitch_slide ; no
|
jr nz, Audio1_pitch_slide
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelVibratoDelayCounters
|
ld hl, wChannelVibratoDelayCounters
|
||||||
|
@ -430,8 +430,8 @@ Audio1_vibrato:
|
||||||
jp Audio1_sound_ret
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_pitch_slide:
|
Audio1_pitch_slide:
|
||||||
cp $eb ; is this command a pitch_slide?
|
cp pitch_slide_cmd
|
||||||
jr nz, Audio1_duty_cycle ; no
|
jr nz, Audio1_duty_cycle
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelPitchSlideLengthModifiers
|
ld hl, wChannelPitchSlideLengthModifiers
|
||||||
|
@ -461,8 +461,8 @@ Audio1_pitch_slide:
|
||||||
jp Audio1_note_length
|
jp Audio1_note_length
|
||||||
|
|
||||||
Audio1_duty_cycle:
|
Audio1_duty_cycle:
|
||||||
cp $ec ; is this command a duty_cycle?
|
cp duty_cycle_cmd
|
||||||
jr nz, Audio1_tempo ; no
|
jr nz, Audio1_tempo
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
rrca
|
rrca
|
||||||
rrca
|
rrca
|
||||||
|
@ -474,8 +474,8 @@ Audio1_duty_cycle:
|
||||||
jp Audio1_sound_ret
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_tempo:
|
Audio1_tempo:
|
||||||
cp $ed ; is this command a tempo?
|
cp tempo_cmd
|
||||||
jr nz, Audio1_stereo_panning ; no
|
jr nz, Audio1_stereo_panning
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch5
|
cp Ch5
|
||||||
jr nc, .sfxChannel
|
jr nc, .sfxChannel
|
||||||
|
@ -503,16 +503,16 @@ Audio1_tempo:
|
||||||
jp Audio1_sound_ret
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_stereo_panning:
|
Audio1_stereo_panning:
|
||||||
cp $ee ; is this command a stereo_panning?
|
cp stereo_panning_cmd
|
||||||
jr nz, Audio1_unknownmusic0xef ; no
|
jr nz, Audio1_unknownmusic0xef
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld [wStereoPanning], a ; store panning
|
ld [wStereoPanning], a ; store panning
|
||||||
jp Audio1_sound_ret
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
; this appears to never be used
|
; this appears to never be used
|
||||||
Audio1_unknownmusic0xef:
|
Audio1_unknownmusic0xef:
|
||||||
cp $ef ; is this command an unknownmusic0xef?
|
cp unknownmusic0xef_cmd
|
||||||
jr nz, Audio1_duty_cycle_pattern ; no
|
jr nz, Audio1_duty_cycle_pattern
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
push bc
|
push bc
|
||||||
call Audio1_PlaySound
|
call Audio1_PlaySound
|
||||||
|
@ -528,8 +528,8 @@ Audio1_unknownmusic0xef:
|
||||||
jp Audio1_sound_ret
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_duty_cycle_pattern:
|
Audio1_duty_cycle_pattern:
|
||||||
cp $fc ; is this command a duty_cycle_pattern?
|
cp duty_cycle_pattern_cmd
|
||||||
jr nz, Audio1_volume ; no
|
jr nz, Audio1_volume
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelDutyCyclePatterns
|
ld hl, wChannelDutyCyclePatterns
|
||||||
|
@ -545,15 +545,15 @@ Audio1_duty_cycle_pattern:
|
||||||
jp Audio1_sound_ret
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_volume:
|
Audio1_volume:
|
||||||
cp $f0 ; is this command a volume?
|
cp volume_cmd
|
||||||
jr nz, Audio1_execute_music ; no
|
jr nz, Audio1_execute_music
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ldh [rNR50], a ; store volume
|
ldh [rNR50], a ; store volume
|
||||||
jp Audio1_sound_ret
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_execute_music:
|
Audio1_execute_music:
|
||||||
cp $f8 ; is this command an execute_music?
|
cp execute_music_cmd
|
||||||
jr nz, Audio1_octave ; no
|
jr nz, Audio1_octave
|
||||||
ld b, $0
|
ld b, $0
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -562,8 +562,8 @@ Audio1_execute_music:
|
||||||
|
|
||||||
Audio1_octave:
|
Audio1_octave:
|
||||||
and $f0
|
and $f0
|
||||||
cp $e0 ; is this command an octave?
|
cp octave_cmd
|
||||||
jr nz, Audio1_sfx_note ; no
|
jr nz, Audio1_sfx_note
|
||||||
ld hl, wChannelOctaves
|
ld hl, wChannelOctaves
|
||||||
ld b, 0
|
ld b, 0
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -574,7 +574,7 @@ Audio1_octave:
|
||||||
|
|
||||||
; sfx_note is either square_note or noise_note depending on the channel
|
; sfx_note is either square_note or noise_note depending on the channel
|
||||||
Audio1_sfx_note:
|
Audio1_sfx_note:
|
||||||
cp $20 ; is this command a sfx_note?
|
cp sfx_note_cmd
|
||||||
jr nz, Audio1_pitch_sweep
|
jr nz, Audio1_pitch_sweep
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch4 ; is this a noise or sfx channel?
|
cp Ch4 ; is this a noise or sfx channel?
|
||||||
|
@ -630,8 +630,8 @@ Audio1_pitch_sweep:
|
||||||
cp Ch5
|
cp Ch5
|
||||||
jr c, Audio1_note ; if not a sfx
|
jr c, Audio1_note ; if not a sfx
|
||||||
ld a, d
|
ld a, d
|
||||||
cp $10 ; is this command a pitch_sweep?
|
cp pitch_sweep_cmd
|
||||||
jr nz, Audio1_note ; no
|
jr nz, Audio1_note
|
||||||
ld b, $0
|
ld b, $0
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -647,12 +647,12 @@ Audio1_note:
|
||||||
jr nz, Audio1_note_length ; if not noise channel
|
jr nz, Audio1_note_length ; if not noise channel
|
||||||
ld a, d
|
ld a, d
|
||||||
and $f0
|
and $f0
|
||||||
cp $b0 ; is this command a drum_note?
|
cp drum_note_cmd
|
||||||
jr z, .drum_note
|
jr z, .drum_note
|
||||||
jr nc, Audio1_note_length ; no
|
jr nc, Audio1_note_length
|
||||||
|
|
||||||
; this executes when on the noise channel and
|
; this executes when on the noise channel and
|
||||||
; the command id is less than $b0
|
; the command id is less than drum_note_cmd ($b0)
|
||||||
; in this case, the upper nybble is used as the noise instrument ($1-$a)
|
; in this case, the upper nybble is used as the noise instrument ($1-$a)
|
||||||
; and the lower nybble is the length minus 1 (0-15)
|
; and the lower nybble is the length minus 1 (0-15)
|
||||||
; however, this doesn't work for instrument #2 because the command id
|
; however, this doesn't work for instrument #2 because the command id
|
||||||
|
@ -748,7 +748,7 @@ Audio1_note_length:
|
||||||
Audio1_note_pitch:
|
Audio1_note_pitch:
|
||||||
pop af
|
pop af
|
||||||
and $f0
|
and $f0
|
||||||
cp $c0 ; compare to rest
|
cp rest_cmd
|
||||||
jr nz, .notRest
|
jr nz, .notRest
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch5
|
cp Ch5
|
||||||
|
@ -1330,7 +1330,7 @@ Audio1_CalculateFrequency:
|
||||||
|
|
||||||
Audio1_PlaySound::
|
Audio1_PlaySound::
|
||||||
ld [wSoundID], a
|
ld [wSoundID], a
|
||||||
cp $ff
|
cp SFX_STOP_ALL_MUSIC
|
||||||
jp z, .stopAllAudio
|
jp z, .stopAllAudio
|
||||||
cp MAX_SFX_ID_1
|
cp MAX_SFX_ID_1
|
||||||
jp z, .playSfx
|
jp z, .playSfx
|
||||||
|
|
|
@ -43,7 +43,7 @@ Audio2_ApplyMusicAffects:
|
||||||
ld hl, wChannelNoteDelayCounters ; delay until next note
|
ld hl, wChannelNoteDelayCounters ; delay until next note
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp $1 ; if the delay is 1, play next note
|
cp 1 ; if the delay is 1, play next note
|
||||||
jp z, Audio2_PlayNextNote
|
jp z, Audio2_PlayNextNote
|
||||||
dec a ; otherwise, decrease the delay timer
|
dec a ; otherwise, decrease the delay timer
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
@ -174,8 +174,8 @@ Audio2_PlayNextNote:
|
||||||
Audio2_sound_ret:
|
Audio2_sound_ret:
|
||||||
call Audio2_GetNextMusicByte
|
call Audio2_GetNextMusicByte
|
||||||
ld d, a
|
ld d, a
|
||||||
cp $ff ; is this command a sound_ret?
|
cp sound_ret_cmd
|
||||||
jp nz, Audio2_sound_call ; no
|
jp nz, Audio2_sound_call
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -262,8 +262,8 @@ Audio2_sound_ret:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Audio2_sound_call:
|
Audio2_sound_call:
|
||||||
cp $fd ; is this command a sound_call?
|
cp sound_call_cmd
|
||||||
jp nz, Audio2_sound_loop ; no
|
jp nz, Audio2_sound_loop
|
||||||
call Audio2_GetNextMusicByte
|
call Audio2_GetNextMusicByte
|
||||||
push af
|
push af
|
||||||
call Audio2_GetNextMusicByte
|
call Audio2_GetNextMusicByte
|
||||||
|
@ -299,8 +299,8 @@ Audio2_sound_call:
|
||||||
jp Audio2_sound_ret
|
jp Audio2_sound_ret
|
||||||
|
|
||||||
Audio2_sound_loop:
|
Audio2_sound_loop:
|
||||||
cp $fe ; is this command a sound_loop?
|
cp sound_loop_cmd
|
||||||
jp nz, Audio2_note_type ; no
|
jp nz, Audio2_note_type
|
||||||
call Audio2_GetNextMusicByte
|
call Audio2_GetNextMusicByte
|
||||||
ld e, a
|
ld e, a
|
||||||
and a
|
and a
|
||||||
|
@ -338,8 +338,8 @@ Audio2_sound_loop:
|
||||||
|
|
||||||
Audio2_note_type:
|
Audio2_note_type:
|
||||||
and $f0
|
and $f0
|
||||||
cp $d0 ; is this command a note_type?
|
cp note_type_cmd
|
||||||
jp nz, Audio2_toggle_perfect_pitch ; no
|
jp nz, Audio2_toggle_perfect_pitch
|
||||||
ld a, d
|
ld a, d
|
||||||
and $f
|
and $f
|
||||||
ld b, $0
|
ld b, $0
|
||||||
|
@ -382,8 +382,8 @@ Audio2_note_type:
|
||||||
|
|
||||||
Audio2_toggle_perfect_pitch:
|
Audio2_toggle_perfect_pitch:
|
||||||
ld a, d
|
ld a, d
|
||||||
cp $e8 ; is this command a toggle_perfect_pitch?
|
cp toggle_perfect_pitch_cmd
|
||||||
jr nz, Audio2_vibrato ; no
|
jr nz, Audio2_vibrato
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -393,8 +393,8 @@ Audio2_toggle_perfect_pitch:
|
||||||
jp Audio2_sound_ret
|
jp Audio2_sound_ret
|
||||||
|
|
||||||
Audio2_vibrato:
|
Audio2_vibrato:
|
||||||
cp $ea ; is this command a vibrato?
|
cp vibrato_cmd
|
||||||
jr nz, Audio2_pitch_slide ; no
|
jr nz, Audio2_pitch_slide
|
||||||
call Audio2_GetNextMusicByte
|
call Audio2_GetNextMusicByte
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelVibratoDelayCounters
|
ld hl, wChannelVibratoDelayCounters
|
||||||
|
@ -441,8 +441,8 @@ Audio2_vibrato:
|
||||||
jp Audio2_sound_ret
|
jp Audio2_sound_ret
|
||||||
|
|
||||||
Audio2_pitch_slide:
|
Audio2_pitch_slide:
|
||||||
cp $eb ; is this command a pitch_slide?
|
cp pitch_slide_cmd
|
||||||
jr nz, Audio2_duty_cycle ; no
|
jr nz, Audio2_duty_cycle
|
||||||
call Audio2_GetNextMusicByte
|
call Audio2_GetNextMusicByte
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelPitchSlideLengthModifiers
|
ld hl, wChannelPitchSlideLengthModifiers
|
||||||
|
@ -472,8 +472,8 @@ Audio2_pitch_slide:
|
||||||
jp Audio2_note_length
|
jp Audio2_note_length
|
||||||
|
|
||||||
Audio2_duty_cycle:
|
Audio2_duty_cycle:
|
||||||
cp $ec ; is this command a duty_cycle?
|
cp duty_cycle_cmd
|
||||||
jr nz, Audio2_tempo ; no
|
jr nz, Audio2_tempo
|
||||||
call Audio2_GetNextMusicByte
|
call Audio2_GetNextMusicByte
|
||||||
rrca
|
rrca
|
||||||
rrca
|
rrca
|
||||||
|
@ -485,8 +485,8 @@ Audio2_duty_cycle:
|
||||||
jp Audio2_sound_ret
|
jp Audio2_sound_ret
|
||||||
|
|
||||||
Audio2_tempo:
|
Audio2_tempo:
|
||||||
cp $ed ; is this command a tempo?
|
cp tempo_cmd
|
||||||
jr nz, Audio2_stereo_panning ; no
|
jr nz, Audio2_stereo_panning
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch5
|
cp Ch5
|
||||||
jr nc, .sfxChannel
|
jr nc, .sfxChannel
|
||||||
|
@ -514,16 +514,16 @@ Audio2_tempo:
|
||||||
jp Audio2_sound_ret
|
jp Audio2_sound_ret
|
||||||
|
|
||||||
Audio2_stereo_panning:
|
Audio2_stereo_panning:
|
||||||
cp $ee ; is this command a stereo_panning?
|
cp stereo_panning_cmd
|
||||||
jr nz, Audio2_unknownmusic0xef ; no
|
jr nz, Audio2_unknownmusic0xef
|
||||||
call Audio2_GetNextMusicByte
|
call Audio2_GetNextMusicByte
|
||||||
ld [wStereoPanning], a ; store panning
|
ld [wStereoPanning], a ; store panning
|
||||||
jp Audio2_sound_ret
|
jp Audio2_sound_ret
|
||||||
|
|
||||||
; this appears to never be used
|
; this appears to never be used
|
||||||
Audio2_unknownmusic0xef:
|
Audio2_unknownmusic0xef:
|
||||||
cp $ef ; is this command an unknownmusic0xef?
|
cp unknownmusic0xef_cmd
|
||||||
jr nz, Audio2_duty_cycle_pattern ; no
|
jr nz, Audio2_duty_cycle_pattern
|
||||||
call Audio2_GetNextMusicByte
|
call Audio2_GetNextMusicByte
|
||||||
push bc
|
push bc
|
||||||
call Audio2_PlaySound
|
call Audio2_PlaySound
|
||||||
|
@ -539,8 +539,8 @@ Audio2_unknownmusic0xef:
|
||||||
jp Audio2_sound_ret
|
jp Audio2_sound_ret
|
||||||
|
|
||||||
Audio2_duty_cycle_pattern:
|
Audio2_duty_cycle_pattern:
|
||||||
cp $fc ; is this command a duty_cycle_pattern?
|
cp duty_cycle_pattern_cmd
|
||||||
jr nz, Audio2_volume ; no
|
jr nz, Audio2_volume
|
||||||
call Audio2_GetNextMusicByte
|
call Audio2_GetNextMusicByte
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelDutyCyclePatterns
|
ld hl, wChannelDutyCyclePatterns
|
||||||
|
@ -556,15 +556,15 @@ Audio2_duty_cycle_pattern:
|
||||||
jp Audio2_sound_ret
|
jp Audio2_sound_ret
|
||||||
|
|
||||||
Audio2_volume:
|
Audio2_volume:
|
||||||
cp $f0 ; is this command a volume?
|
cp volume_cmd
|
||||||
jr nz, Audio2_execute_music ; no
|
jr nz, Audio2_execute_music
|
||||||
call Audio2_GetNextMusicByte
|
call Audio2_GetNextMusicByte
|
||||||
ldh [rNR50], a ; store volume
|
ldh [rNR50], a ; store volume
|
||||||
jp Audio2_sound_ret
|
jp Audio2_sound_ret
|
||||||
|
|
||||||
Audio2_execute_music:
|
Audio2_execute_music:
|
||||||
cp $f8 ; is this command an execute_music?
|
cp execute_music_cmd
|
||||||
jr nz, Audio2_octave ; no
|
jr nz, Audio2_octave
|
||||||
ld b, $0
|
ld b, $0
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -573,8 +573,8 @@ Audio2_execute_music:
|
||||||
|
|
||||||
Audio2_octave:
|
Audio2_octave:
|
||||||
and $f0
|
and $f0
|
||||||
cp $e0 ; is this command an octave?
|
cp octave_cmd
|
||||||
jr nz, Audio2_sfx_note ; no
|
jr nz, Audio2_sfx_note
|
||||||
ld hl, wChannelOctaves
|
ld hl, wChannelOctaves
|
||||||
ld b, 0
|
ld b, 0
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -585,7 +585,7 @@ Audio2_octave:
|
||||||
|
|
||||||
; sfx_note is either square_note or noise_note depending on the channel
|
; sfx_note is either square_note or noise_note depending on the channel
|
||||||
Audio2_sfx_note:
|
Audio2_sfx_note:
|
||||||
cp $20 ; is this command a sfx_note?
|
cp sfx_note_cmd
|
||||||
jr nz, Audio2_pitch_sweep
|
jr nz, Audio2_pitch_sweep
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch4 ; is this a noise or sfx channel?
|
cp Ch4 ; is this a noise or sfx channel?
|
||||||
|
@ -641,8 +641,8 @@ Audio2_pitch_sweep:
|
||||||
cp Ch5
|
cp Ch5
|
||||||
jr c, Audio2_note ; if not a sfx
|
jr c, Audio2_note ; if not a sfx
|
||||||
ld a, d
|
ld a, d
|
||||||
cp $10 ; is this command a pitch_sweep?
|
cp pitch_sweep_cmd
|
||||||
jr nz, Audio2_note ; no
|
jr nz, Audio2_note
|
||||||
ld b, $0
|
ld b, $0
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -658,12 +658,12 @@ Audio2_note:
|
||||||
jr nz, Audio2_note_length ; if not noise channel
|
jr nz, Audio2_note_length ; if not noise channel
|
||||||
ld a, d
|
ld a, d
|
||||||
and $f0
|
and $f0
|
||||||
cp $b0 ; is this command a drum_note?
|
cp drum_note_cmd
|
||||||
jr z, .drum_note
|
jr z, .drum_note
|
||||||
jr nc, Audio2_note_length ; no
|
jr nc, Audio2_note_length
|
||||||
|
|
||||||
; this executes when on the noise channel and
|
; this executes when on the noise channel and
|
||||||
; the command id is less than $b0
|
; the command id is less than drum_note_cmd ($b0)
|
||||||
; in this case, the upper nybble is used as the noise instrument ($1-$a)
|
; in this case, the upper nybble is used as the noise instrument ($1-$a)
|
||||||
; and the lower nybble is the length minus 1 (0-15)
|
; and the lower nybble is the length minus 1 (0-15)
|
||||||
; however, this doesn't work for instrument #2 because the command id
|
; however, this doesn't work for instrument #2 because the command id
|
||||||
|
@ -759,7 +759,7 @@ Audio2_note_length:
|
||||||
Audio2_note_pitch:
|
Audio2_note_pitch:
|
||||||
pop af
|
pop af
|
||||||
and $f0
|
and $f0
|
||||||
cp $c0 ; compare to rest
|
cp rest_cmd
|
||||||
jr nz, .notRest
|
jr nz, .notRest
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch5
|
cp Ch5
|
||||||
|
@ -1393,7 +1393,7 @@ Audio2_CalculateFrequency:
|
||||||
|
|
||||||
Audio2_PlaySound::
|
Audio2_PlaySound::
|
||||||
ld [wSoundID], a
|
ld [wSoundID], a
|
||||||
cp $ff
|
cp SFX_STOP_ALL_MUSIC
|
||||||
jp z, .stopAllAudio
|
jp z, .stopAllAudio
|
||||||
cp MAX_SFX_ID_2
|
cp MAX_SFX_ID_2
|
||||||
jp z, .playSfx
|
jp z, .playSfx
|
||||||
|
|
|
@ -41,7 +41,7 @@ Audio3_ApplyMusicAffects:
|
||||||
ld hl, wChannelNoteDelayCounters ; delay until next note
|
ld hl, wChannelNoteDelayCounters ; delay until next note
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp $1 ; if the delay is 1, play next note
|
cp 1 ; if the delay is 1, play next note
|
||||||
jp z, Audio3_PlayNextNote
|
jp z, Audio3_PlayNextNote
|
||||||
dec a ; otherwise, decrease the delay timer
|
dec a ; otherwise, decrease the delay timer
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
@ -163,8 +163,8 @@ Audio3_PlayNextNote:
|
||||||
Audio3_sound_ret:
|
Audio3_sound_ret:
|
||||||
call Audio3_GetNextMusicByte
|
call Audio3_GetNextMusicByte
|
||||||
ld d, a
|
ld d, a
|
||||||
cp $ff ; is this command a sound_ret?
|
cp sound_ret_cmd
|
||||||
jp nz, Audio3_sound_call ; no
|
jp nz, Audio3_sound_call
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -251,8 +251,8 @@ Audio3_sound_ret:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Audio3_sound_call:
|
Audio3_sound_call:
|
||||||
cp $fd ; is this command a sound_call?
|
cp sound_call_cmd
|
||||||
jp nz, Audio3_sound_loop ; no
|
jp nz, Audio3_sound_loop
|
||||||
call Audio3_GetNextMusicByte
|
call Audio3_GetNextMusicByte
|
||||||
push af
|
push af
|
||||||
call Audio3_GetNextMusicByte
|
call Audio3_GetNextMusicByte
|
||||||
|
@ -288,8 +288,8 @@ Audio3_sound_call:
|
||||||
jp Audio3_sound_ret
|
jp Audio3_sound_ret
|
||||||
|
|
||||||
Audio3_sound_loop:
|
Audio3_sound_loop:
|
||||||
cp $fe ; is this command a sound_loop?
|
cp sound_loop_cmd
|
||||||
jp nz, Audio3_note_type ; no
|
jp nz, Audio3_note_type
|
||||||
call Audio3_GetNextMusicByte
|
call Audio3_GetNextMusicByte
|
||||||
ld e, a
|
ld e, a
|
||||||
and a
|
and a
|
||||||
|
@ -327,8 +327,8 @@ Audio3_sound_loop:
|
||||||
|
|
||||||
Audio3_note_type:
|
Audio3_note_type:
|
||||||
and $f0
|
and $f0
|
||||||
cp $d0 ; is this command a note_type?
|
cp note_type_cmd
|
||||||
jp nz, Audio3_toggle_perfect_pitch ; no
|
jp nz, Audio3_toggle_perfect_pitch
|
||||||
ld a, d
|
ld a, d
|
||||||
and $f
|
and $f
|
||||||
ld b, $0
|
ld b, $0
|
||||||
|
@ -371,8 +371,8 @@ Audio3_note_type:
|
||||||
|
|
||||||
Audio3_toggle_perfect_pitch:
|
Audio3_toggle_perfect_pitch:
|
||||||
ld a, d
|
ld a, d
|
||||||
cp $e8 ; is this command a toggle_perfect_pitch?
|
cp toggle_perfect_pitch_cmd
|
||||||
jr nz, Audio3_vibrato ; no
|
jr nz, Audio3_vibrato
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -382,8 +382,8 @@ Audio3_toggle_perfect_pitch:
|
||||||
jp Audio3_sound_ret
|
jp Audio3_sound_ret
|
||||||
|
|
||||||
Audio3_vibrato:
|
Audio3_vibrato:
|
||||||
cp $ea ; is this command a vibrato?
|
cp vibrato_cmd
|
||||||
jr nz, Audio3_pitch_slide ; no
|
jr nz, Audio3_pitch_slide
|
||||||
call Audio3_GetNextMusicByte
|
call Audio3_GetNextMusicByte
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelVibratoDelayCounters
|
ld hl, wChannelVibratoDelayCounters
|
||||||
|
@ -430,8 +430,8 @@ Audio3_vibrato:
|
||||||
jp Audio3_sound_ret
|
jp Audio3_sound_ret
|
||||||
|
|
||||||
Audio3_pitch_slide:
|
Audio3_pitch_slide:
|
||||||
cp $eb ; is this command a pitch_slide?
|
cp pitch_slide_cmd
|
||||||
jr nz, Audio3_duty_cycle ; no
|
jr nz, Audio3_duty_cycle
|
||||||
call Audio3_GetNextMusicByte
|
call Audio3_GetNextMusicByte
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelPitchSlideLengthModifiers
|
ld hl, wChannelPitchSlideLengthModifiers
|
||||||
|
@ -461,8 +461,8 @@ Audio3_pitch_slide:
|
||||||
jp Audio3_note_length
|
jp Audio3_note_length
|
||||||
|
|
||||||
Audio3_duty_cycle:
|
Audio3_duty_cycle:
|
||||||
cp $ec ; is this command a duty_cycle?
|
cp duty_cycle_cmd
|
||||||
jr nz, Audio3_tempo ; no
|
jr nz, Audio3_tempo
|
||||||
call Audio3_GetNextMusicByte
|
call Audio3_GetNextMusicByte
|
||||||
rrca
|
rrca
|
||||||
rrca
|
rrca
|
||||||
|
@ -474,8 +474,8 @@ Audio3_duty_cycle:
|
||||||
jp Audio3_sound_ret
|
jp Audio3_sound_ret
|
||||||
|
|
||||||
Audio3_tempo:
|
Audio3_tempo:
|
||||||
cp $ed ; is this command a tempo?
|
cp tempo_cmd
|
||||||
jr nz, Audio3_stereo_panning ; no
|
jr nz, Audio3_stereo_panning
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch5
|
cp Ch5
|
||||||
jr nc, .sfxChannel
|
jr nc, .sfxChannel
|
||||||
|
@ -503,16 +503,16 @@ Audio3_tempo:
|
||||||
jp Audio3_sound_ret
|
jp Audio3_sound_ret
|
||||||
|
|
||||||
Audio3_stereo_panning:
|
Audio3_stereo_panning:
|
||||||
cp $ee ; is this command a stereo_panning?
|
cp stereo_panning_cmd
|
||||||
jr nz, Audio3_unknownmusic0xef ; no
|
jr nz, Audio3_unknownmusic0xef
|
||||||
call Audio3_GetNextMusicByte
|
call Audio3_GetNextMusicByte
|
||||||
ld [wStereoPanning], a ; store panning
|
ld [wStereoPanning], a ; store panning
|
||||||
jp Audio3_sound_ret
|
jp Audio3_sound_ret
|
||||||
|
|
||||||
; this appears to never be used
|
; this appears to never be used
|
||||||
Audio3_unknownmusic0xef:
|
Audio3_unknownmusic0xef:
|
||||||
cp $ef ; is this command an unknownmusic0xef?
|
cp unknownmusic0xef_cmd
|
||||||
jr nz, Audio3_duty_cycle_pattern ; no
|
jr nz, Audio3_duty_cycle_pattern
|
||||||
call Audio3_GetNextMusicByte
|
call Audio3_GetNextMusicByte
|
||||||
push bc
|
push bc
|
||||||
call Audio3_PlaySound
|
call Audio3_PlaySound
|
||||||
|
@ -528,8 +528,8 @@ Audio3_unknownmusic0xef:
|
||||||
jp Audio3_sound_ret
|
jp Audio3_sound_ret
|
||||||
|
|
||||||
Audio3_duty_cycle_pattern:
|
Audio3_duty_cycle_pattern:
|
||||||
cp $fc ; is this command a duty_cycle_pattern?
|
cp duty_cycle_pattern_cmd
|
||||||
jr nz, Audio3_volume ; no
|
jr nz, Audio3_volume
|
||||||
call Audio3_GetNextMusicByte
|
call Audio3_GetNextMusicByte
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelDutyCyclePatterns
|
ld hl, wChannelDutyCyclePatterns
|
||||||
|
@ -545,15 +545,15 @@ Audio3_duty_cycle_pattern:
|
||||||
jp Audio3_sound_ret
|
jp Audio3_sound_ret
|
||||||
|
|
||||||
Audio3_volume:
|
Audio3_volume:
|
||||||
cp $f0 ; is this command a volume?
|
cp volume_cmd
|
||||||
jr nz, Audio3_execute_music ; no
|
jr nz, Audio3_execute_music
|
||||||
call Audio3_GetNextMusicByte
|
call Audio3_GetNextMusicByte
|
||||||
ldh [rNR50], a ; store volume
|
ldh [rNR50], a ; store volume
|
||||||
jp Audio3_sound_ret
|
jp Audio3_sound_ret
|
||||||
|
|
||||||
Audio3_execute_music:
|
Audio3_execute_music:
|
||||||
cp $f8 ; is this command an execute_music?
|
cp execute_music_cmd
|
||||||
jr nz, Audio3_octave ; no
|
jr nz, Audio3_octave
|
||||||
ld b, $0
|
ld b, $0
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -562,8 +562,8 @@ Audio3_execute_music:
|
||||||
|
|
||||||
Audio3_octave:
|
Audio3_octave:
|
||||||
and $f0
|
and $f0
|
||||||
cp $e0 ; is this command an octave?
|
cp octave_cmd
|
||||||
jr nz, Audio3_sfx_note ; no
|
jr nz, Audio3_sfx_note
|
||||||
ld hl, wChannelOctaves
|
ld hl, wChannelOctaves
|
||||||
ld b, 0
|
ld b, 0
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -574,7 +574,7 @@ Audio3_octave:
|
||||||
|
|
||||||
; sfx_note is either square_note or noise_note depending on the channel
|
; sfx_note is either square_note or noise_note depending on the channel
|
||||||
Audio3_sfx_note:
|
Audio3_sfx_note:
|
||||||
cp $20 ; is this command a sfx_note?
|
cp sfx_note_cmd
|
||||||
jr nz, Audio3_pitch_sweep
|
jr nz, Audio3_pitch_sweep
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch4 ; is this a noise or sfx channel?
|
cp Ch4 ; is this a noise or sfx channel?
|
||||||
|
@ -630,8 +630,8 @@ Audio3_pitch_sweep:
|
||||||
cp Ch5
|
cp Ch5
|
||||||
jr c, Audio3_note ; if not a sfx
|
jr c, Audio3_note ; if not a sfx
|
||||||
ld a, d
|
ld a, d
|
||||||
cp $10 ; is this command a pitch_sweep?
|
cp pitch_sweep_cmd
|
||||||
jr nz, Audio3_note ; no
|
jr nz, Audio3_note
|
||||||
ld b, $0
|
ld b, $0
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -647,12 +647,12 @@ Audio3_note:
|
||||||
jr nz, Audio3_note_length ; if not noise channel
|
jr nz, Audio3_note_length ; if not noise channel
|
||||||
ld a, d
|
ld a, d
|
||||||
and $f0
|
and $f0
|
||||||
cp $b0 ; is this command a drum_note?
|
cp drum_note_cmd
|
||||||
jr z, .drum_note
|
jr z, .drum_note
|
||||||
jr nc, Audio3_note_length ; no
|
jr nc, Audio3_note_length
|
||||||
|
|
||||||
; this executes when on the noise channel and
|
; this executes when on the noise channel and
|
||||||
; the command id is less than $b0
|
; the command id is less than drum_note_cmd ($b0)
|
||||||
; in this case, the upper nybble is used as the noise instrument ($1-$a)
|
; in this case, the upper nybble is used as the noise instrument ($1-$a)
|
||||||
; and the lower nybble is the length minus 1 (0-15)
|
; and the lower nybble is the length minus 1 (0-15)
|
||||||
; however, this doesn't work for instrument #2 because the command id
|
; however, this doesn't work for instrument #2 because the command id
|
||||||
|
@ -748,7 +748,7 @@ Audio3_note_length:
|
||||||
Audio3_note_pitch:
|
Audio3_note_pitch:
|
||||||
pop af
|
pop af
|
||||||
and $f0
|
and $f0
|
||||||
cp $c0 ; compare to rest
|
cp rest_cmd
|
||||||
jr nz, .notRest
|
jr nz, .notRest
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch5
|
cp Ch5
|
||||||
|
@ -1330,7 +1330,7 @@ Audio3_CalculateFrequency:
|
||||||
|
|
||||||
Audio3_PlaySound::
|
Audio3_PlaySound::
|
||||||
ld [wSoundID], a
|
ld [wSoundID], a
|
||||||
cp $ff
|
cp SFX_STOP_ALL_MUSIC
|
||||||
jp z, .stopAllAudio
|
jp z, .stopAllAudio
|
||||||
cp MAX_SFX_ID_3
|
cp MAX_SFX_ID_3
|
||||||
jp z, .playSfx
|
jp z, .playSfx
|
||||||
|
|
|
@ -15,14 +15,17 @@ audio_header: MACRO
|
||||||
ENDC
|
ENDC
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const_def $10
|
||||||
|
|
||||||
; arguments: length [0, 7], pitch change [-7, 7]
|
; arguments: length [0, 7], pitch change [-7, 7]
|
||||||
; length: length of time between pitch shifts
|
; length: length of time between pitch shifts
|
||||||
; sometimes used with a value >7 in which case the MSB is ignored
|
; sometimes used with a value >7 in which case the MSB is ignored
|
||||||
; pitch change: positive value means increase in pitch, negative value means decrease in pitch
|
; pitch change: positive value means increase in pitch, negative value means decrease in pitch
|
||||||
; small magnitude means quick change, large magnitude means slow change
|
; small magnitude means quick change, large magnitude means slow change
|
||||||
; in signed magnitude representation, so a value of 8 is the same as (negative) 0
|
; in signed magnitude representation, so a value of 8 is the same as (negative) 0
|
||||||
|
const pitch_sweep_cmd ; $10
|
||||||
pitch_sweep: MACRO
|
pitch_sweep: MACRO
|
||||||
db $10
|
db pitch_sweep_cmd
|
||||||
IF \2 < 0
|
IF \2 < 0
|
||||||
db (\1 << 4) | (%1000 | (\2 * -1))
|
db (\1 << 4) | (%1000 | (\2 * -1))
|
||||||
ELSE
|
ELSE
|
||||||
|
@ -30,12 +33,17 @@ pitch_sweep: MACRO
|
||||||
ENDC
|
ENDC
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const_next $20
|
||||||
|
|
||||||
|
const sfx_note_cmd ; $20
|
||||||
|
|
||||||
; arguments: length [0, 15], volume [0, 15], fade [-7, 7], frequency
|
; arguments: length [0, 15], volume [0, 15], fade [-7, 7], frequency
|
||||||
; fade: positive value means decrease in volume, negative value means increase in volume
|
; fade: positive value means decrease in volume, negative value means increase in volume
|
||||||
; small magnitude means quick change, large magnitude means slow change
|
; small magnitude means quick change, large magnitude means slow change
|
||||||
; in signed magnitude representation, so a value of 8 is the same as (negative) 0
|
; in signed magnitude representation, so a value of 8 is the same as (negative) 0
|
||||||
|
square_note_cmd EQU sfx_note_cmd ; $20
|
||||||
square_note: MACRO
|
square_note: MACRO
|
||||||
db $20 | \1
|
db square_note_cmd | \1
|
||||||
IF \3 < 0
|
IF \3 < 0
|
||||||
db (\2 << 4) | (%1000 | (\3 * -1))
|
db (\2 << 4) | (%1000 | (\3 * -1))
|
||||||
ELSE
|
ELSE
|
||||||
|
@ -48,8 +56,9 @@ ENDM
|
||||||
; fade: positive value means decrease in volume, negative value means increase in volume
|
; fade: positive value means decrease in volume, negative value means increase in volume
|
||||||
; small magnitude means quick change, large magnitude means slow change
|
; small magnitude means quick change, large magnitude means slow change
|
||||||
; in signed magnitude representation, so a value of 8 is the same as (negative) 0
|
; in signed magnitude representation, so a value of 8 is the same as (negative) 0
|
||||||
|
noise_note_cmd EQU sfx_note_cmd ; $20
|
||||||
noise_note: MACRO
|
noise_note: MACRO
|
||||||
db $20 | \1
|
db noise_note_cmd | \1
|
||||||
IF \3 < 0
|
IF \3 < 0
|
||||||
db (\2 << 4) | (%1000 | (\3 * -1))
|
db (\2 << 4) | (%1000 | (\3 * -1))
|
||||||
ELSE
|
ELSE
|
||||||
|
@ -63,9 +72,12 @@ note: MACRO
|
||||||
db (\1 << 4) | (\2 - 1)
|
db (\1 << 4) | (\2 - 1)
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const_next $b0
|
||||||
|
|
||||||
; arguments: instrument [1, 19], length [1, 16]
|
; arguments: instrument [1, 19], length [1, 16]
|
||||||
|
const drum_note_cmd ; $b0
|
||||||
drum_note: MACRO
|
drum_note: MACRO
|
||||||
db $B0 | (\2 - 1)
|
db drum_note_cmd | (\2 - 1)
|
||||||
db \1
|
db \1
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
@ -77,17 +89,23 @@ drum_note_short: MACRO
|
||||||
db (\1 << 4) | (\2 - 1)
|
db (\1 << 4) | (\2 - 1)
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const_next $c0
|
||||||
|
|
||||||
; arguments: length [1, 16]
|
; arguments: length [1, 16]
|
||||||
|
const rest_cmd ; $c0
|
||||||
rest: MACRO
|
rest: MACRO
|
||||||
db $C0 | (\1 - 1)
|
db rest_cmd | (\1 - 1)
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const_next $d0
|
||||||
|
|
||||||
; arguments: speed [0, 15], volume [0, 15], fade [-7, 7]
|
; arguments: speed [0, 15], volume [0, 15], fade [-7, 7]
|
||||||
; fade: positive value means decrease in volume, negative value means increase in volume
|
; fade: positive value means decrease in volume, negative value means increase in volume
|
||||||
; small magnitude means quick change, large magnitude means slow change
|
; small magnitude means quick change, large magnitude means slow change
|
||||||
; in signed magnitude representation, so a value of 8 is the same as (negative) 0
|
; in signed magnitude representation, so a value of 8 is the same as (negative) 0
|
||||||
|
const note_type_cmd ; $d0
|
||||||
note_type: MACRO
|
note_type: MACRO
|
||||||
db $D0 | \1
|
db note_type_cmd | \1
|
||||||
IF \3 < 0
|
IF \3 < 0
|
||||||
db (\2 << 4) | (%1000 | (\3 * -1))
|
db (\2 << 4) | (%1000 | (\3 * -1))
|
||||||
ELSE
|
ELSE
|
||||||
|
@ -96,40 +114,52 @@ note_type: MACRO
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
; arguments: speed [0, 15]
|
; arguments: speed [0, 15]
|
||||||
|
drum_speed_cmd EQU note_type_cmd ; $d0
|
||||||
drum_speed: MACRO
|
drum_speed: MACRO
|
||||||
db $D0 | \1
|
db drum_speed_cmd | \1
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const_next $e0
|
||||||
|
|
||||||
; arguments: octave [1, 8]
|
; arguments: octave [1, 8]
|
||||||
|
const octave_cmd ; $e0
|
||||||
octave: MACRO
|
octave: MACRO
|
||||||
db $E8 - \1
|
db octave_cmd | (8 - \1)
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const_next $e8
|
||||||
|
|
||||||
; when enabled, effective frequency used is incremented by 1
|
; when enabled, effective frequency used is incremented by 1
|
||||||
|
const toggle_perfect_pitch_cmd ; $e8
|
||||||
toggle_perfect_pitch: MACRO
|
toggle_perfect_pitch: MACRO
|
||||||
db $E8
|
db toggle_perfect_pitch_cmd
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const_skip ; $e9
|
||||||
|
|
||||||
; arguments: delay [0, 255], depth [0, 15], rate [0, 15]
|
; arguments: delay [0, 255], depth [0, 15], rate [0, 15]
|
||||||
; delay: time delay until vibrato effect begins
|
; delay: time delay until vibrato effect begins
|
||||||
; depth: amplitude of vibrato wave
|
; depth: amplitude of vibrato wave
|
||||||
; rate: frequency of vibrato wave
|
; rate: frequency of vibrato wave
|
||||||
|
const vibrato_cmd ; $ea
|
||||||
vibrato: MACRO
|
vibrato: MACRO
|
||||||
db $EA
|
db vibrato_cmd
|
||||||
db \1
|
db \1
|
||||||
db (\2 << 4) | \3
|
db (\2 << 4) | \3
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
; arguments: length [1, 256], octave [1, 8], pitch
|
; arguments: length [1, 256], octave [1, 8], pitch
|
||||||
|
const pitch_slide_cmd ; $eb
|
||||||
pitch_slide: MACRO
|
pitch_slide: MACRO
|
||||||
db $EB
|
db pitch_slide_cmd
|
||||||
db \1 - 1
|
db \1 - 1
|
||||||
db ((8 - \2) << 4) | \3
|
db ((8 - \2) << 4) | \3
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
; arguments: duty cycle [0, 3] (12.5%, 25%, 50%, 75%)
|
; arguments: duty cycle [0, 3] (12.5%, 25%, 50%, 75%)
|
||||||
|
const duty_cycle_cmd ; $ec
|
||||||
duty_cycle: MACRO
|
duty_cycle: MACRO
|
||||||
db $EC
|
db duty_cycle_cmd
|
||||||
db \1
|
db \1
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
@ -139,47 +169,65 @@ ENDM
|
||||||
; ideally should be set to $100 or less to guarantee no overflow
|
; ideally should be set to $100 or less to guarantee no overflow
|
||||||
; if larger than $100, large note speed or note length values might cause overflow
|
; if larger than $100, large note speed or note length values might cause overflow
|
||||||
; stored in big endian
|
; stored in big endian
|
||||||
|
const tempo_cmd ; $ed
|
||||||
tempo: MACRO
|
tempo: MACRO
|
||||||
db $ED
|
db tempo_cmd
|
||||||
db HIGH(\1), LOW(\1)
|
db HIGH(\1), LOW(\1)
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
; arguments: left output enable mask, right output enable mask
|
; arguments: left output enable mask, right output enable mask
|
||||||
|
const stereo_panning_cmd ; $ee
|
||||||
stereo_panning: MACRO
|
stereo_panning: MACRO
|
||||||
db $EE
|
db stereo_panning_cmd
|
||||||
db (\1 << 4) | \2
|
db (\1 << 4) | \2
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const unknownmusic0xef_cmd ; $ef
|
||||||
|
unknownmusic0xef: MACRO
|
||||||
|
db unknownmusic0xef_cmd
|
||||||
|
db \1
|
||||||
|
ENDM
|
||||||
|
|
||||||
; arguments: left master volume [0, 7], right master volume [0, 7]
|
; arguments: left master volume [0, 7], right master volume [0, 7]
|
||||||
|
const volume_cmd ; $f0
|
||||||
volume: MACRO
|
volume: MACRO
|
||||||
db $F0
|
db volume_cmd
|
||||||
db (\1 << 4) | \2
|
db (\1 << 4) | \2
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const_next $f8
|
||||||
|
|
||||||
; when enabled, the sfx data is interpreted as music data
|
; when enabled, the sfx data is interpreted as music data
|
||||||
|
const execute_music_cmd ; $f8
|
||||||
execute_music: MACRO
|
execute_music: MACRO
|
||||||
db $F8
|
db execute_music_cmd
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const_next $fc
|
||||||
|
|
||||||
; arguments: duty cycle 1, duty cycle 2, duty cycle 3, duty cycle 4
|
; arguments: duty cycle 1, duty cycle 2, duty cycle 3, duty cycle 4
|
||||||
|
const duty_cycle_pattern_cmd ; $fc
|
||||||
duty_cycle_pattern: MACRO
|
duty_cycle_pattern: MACRO
|
||||||
db $FC
|
db duty_cycle_pattern_cmd
|
||||||
db \1 << 6 | \2 << 4 | \3 << 2 | \4
|
db \1 << 6 | \2 << 4 | \3 << 2 | \4
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
; arguments: address
|
; arguments: address
|
||||||
|
const sound_call_cmd ; $fd
|
||||||
sound_call: MACRO
|
sound_call: MACRO
|
||||||
db $FD
|
db sound_call_cmd
|
||||||
dw \1
|
dw \1
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
; arguments: count, address
|
; arguments: count, address
|
||||||
|
const sound_loop_cmd ; $fe
|
||||||
sound_loop: MACRO
|
sound_loop: MACRO
|
||||||
db $FE
|
db sound_loop_cmd
|
||||||
db \1
|
db \1
|
||||||
dw \2
|
dw \2
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
const sound_ret_cmd ; $ff
|
||||||
sound_ret: MACRO
|
sound_ret: MACRO
|
||||||
db $FF
|
db sound_ret_cmd
|
||||||
ENDM
|
ENDM
|
||||||
|
|
Loading…
Reference in a new issue