From c1ef7b75972fa4fbdf125bc85cc1a66f358151cd Mon Sep 17 00:00:00 2001 From: vulcandth Date: Mon, 6 Jun 2022 16:25:34 -0500 Subject: RGBDS syntax updates (#86) New MACRO and DEF syntax --- macros/scripts/audio.asm | 54 ++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'macros/scripts/audio.asm') diff --git a/macros/scripts/audio.asm b/macros/scripts/audio.asm index b12a2adc..114bf576 100644 --- a/macros/scripts/audio.asm +++ b/macros/scripts/audio.asm @@ -1,4 +1,4 @@ -audio_header: MACRO +MACRO audio_header db (_NARG - 2) << 6 | \2 dw \1_\2 IF _NARG > 2 @@ -24,7 +24,7 @@ ENDM ; 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 +MACRO pitch_sweep db pitch_sweep_cmd IF \2 < 0 db (\1 << 4) | (%1000 | (\2 * -1)) @@ -41,8 +41,8 @@ ENDM ; 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 +DEF square_note_cmd EQU sfx_note_cmd ; $20 +MACRO square_note db square_note_cmd | \1 IF \3 < 0 db (\2 << 4) | (%1000 | (\3 * -1)) @@ -56,8 +56,8 @@ ENDM ; 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 +DEF noise_note_cmd EQU sfx_note_cmd ; $20 +MACRO noise_note db noise_note_cmd | \1 IF \3 < 0 db (\2 << 4) | (%1000 | (\3 * -1)) @@ -68,7 +68,7 @@ noise_note: MACRO ENDM ; arguments: pitch, length [1, 16] -note: MACRO +MACRO note db (\1 << 4) | (\2 - 1) ENDM @@ -76,7 +76,7 @@ ENDM ; arguments: instrument [1, 19], length [1, 16] const drum_note_cmd ; $b0 -drum_note: MACRO +MACRO drum_note db drum_note_cmd | (\2 - 1) db \1 ENDM @@ -85,7 +85,7 @@ ENDM ; like drum_note but one 1 byte instead of 2 ; can only be used with instruments 1-10, excluding 2 ; unused -drum_note_short: MACRO +MACRO drum_note_short db (\1 << 4) | (\2 - 1) ENDM @@ -93,7 +93,7 @@ ENDM ; arguments: length [1, 16] const rest_cmd ; $c0 -rest: MACRO +MACRO rest db rest_cmd | (\1 - 1) ENDM @@ -104,7 +104,7 @@ ENDM ; 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 +MACRO note_type db note_type_cmd | \1 IF \3 < 0 db (\2 << 4) | (%1000 | (\3 * -1)) @@ -114,8 +114,8 @@ note_type: MACRO ENDM ; arguments: speed [0, 15] -drum_speed_cmd EQU note_type_cmd ; $d0 -drum_speed: MACRO +DEF drum_speed_cmd EQU note_type_cmd ; $d0 +MACRO drum_speed db drum_speed_cmd | \1 ENDM @@ -123,7 +123,7 @@ ENDM ; arguments: octave [1, 8] const octave_cmd ; $e0 -octave: MACRO +MACRO octave db octave_cmd | (8 - \1) ENDM @@ -131,7 +131,7 @@ ENDM ; when enabled, effective frequency used is incremented by 1 const toggle_perfect_pitch_cmd ; $e8 -toggle_perfect_pitch: MACRO +MACRO toggle_perfect_pitch db toggle_perfect_pitch_cmd ENDM @@ -142,7 +142,7 @@ ENDM ; depth: amplitude of vibrato wave ; rate: frequency of vibrato wave const vibrato_cmd ; $ea -vibrato: MACRO +MACRO vibrato db vibrato_cmd db \1 db (\2 << 4) | \3 @@ -150,7 +150,7 @@ ENDM ; arguments: length [1, 256], octave [1, 8], pitch const pitch_slide_cmd ; $eb -pitch_slide: MACRO +MACRO pitch_slide db pitch_slide_cmd db \1 - 1 db ((8 - \2) << 4) | \3 @@ -158,7 +158,7 @@ ENDM ; arguments: duty cycle [0, 3] (12.5%, 25%, 50%, 75%) const duty_cycle_cmd ; $ec -duty_cycle: MACRO +MACRO duty_cycle db duty_cycle_cmd db \1 ENDM @@ -170,27 +170,27 @@ ENDM ; if larger than $100, large note speed or note length values might cause overflow ; stored in big endian const tempo_cmd ; $ed -tempo: MACRO +MACRO tempo 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 +MACRO stereo_panning db stereo_panning_cmd db (\1 << 4) | \2 ENDM const unknownmusic0xef_cmd ; $ef -unknownmusic0xef: MACRO +MACRO unknownmusic0xef db unknownmusic0xef_cmd db \1 ENDM ; arguments: left master volume [0, 7], right master volume [0, 7] const volume_cmd ; $f0 -volume: MACRO +MACRO volume db volume_cmd db (\1 << 4) | \2 ENDM @@ -199,7 +199,7 @@ ENDM ; when enabled, the sfx data is interpreted as music data const execute_music_cmd ; $f8 -execute_music: MACRO +MACRO execute_music db execute_music_cmd ENDM @@ -207,27 +207,27 @@ ENDM ; arguments: duty cycle 1, duty cycle 2, duty cycle 3, duty cycle 4 const duty_cycle_pattern_cmd ; $fc -duty_cycle_pattern: MACRO +MACRO duty_cycle_pattern db duty_cycle_pattern_cmd db \1 << 6 | \2 << 4 | \3 << 2 | \4 ENDM ; arguments: address const sound_call_cmd ; $fd -sound_call: MACRO +MACRO sound_call db sound_call_cmd dw \1 ENDM ; arguments: count, address const sound_loop_cmd ; $fe -sound_loop: MACRO +MACRO sound_loop db sound_loop_cmd db \1 dw \2 ENDM const sound_ret_cmd ; $ff -sound_ret: MACRO +MACRO sound_ret db sound_ret_cmd ENDM -- cgit v1.3.1-sl0p