shithub: pokered

Download patch

ref: 7306c1dc2dca5666a5276a6758d1a64e1ddeae20
parent: 84abdb0237caedebe9b7ec41e5fcc51775e87ca9
author: Rangi <[email protected]>
date: Thu Jul 16 09:25:02 EDT 2020

Define constants for audio commands

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