pokepinball/macros/sound.asm

316 lines
5.0 KiB
NASM
Raw Normal View History

2022-05-12 02:54:45 +00:00
MACRO channel_count
DEF _num_channels = \1 - 1
2021-03-14 05:03:51 +00:00
ENDM
2016-12-07 02:56:48 +00:00
2022-05-12 02:54:45 +00:00
MACRO channel
2021-03-14 05:03:51 +00:00
dn (_num_channels << 2), \1 - 1 ; channel id
dw \2 ; address
2022-05-12 02:54:45 +00:00
DEF _num_channels = 0
2021-03-14 05:03:51 +00:00
ENDM
2016-12-07 02:56:48 +00:00
2022-05-12 02:54:45 +00:00
MACRO note
2021-03-14 05:03:51 +00:00
dn (\1), (\2) - 1 ; pitch, length
ENDM
2022-05-12 02:54:45 +00:00
MACRO drum_note
2021-03-14 05:03:51 +00:00
note \1, \2 ; drum instrument, length
ENDM
2022-05-12 02:54:45 +00:00
MACRO rest
2021-03-14 05:03:51 +00:00
note 0, \1 ; length
ENDM
2022-05-12 02:54:45 +00:00
MACRO square_note
2021-03-14 05:03:51 +00:00
db \1 ; length
IF \3 < 0
dn \2, %1000 | (\3 * -1) ; volume envelope
ELSE
dn \2, \3 ; volume envelope
ENDC
dw \4 ; frequency
ENDM
2022-05-12 02:54:45 +00:00
MACRO noise_note
2021-03-14 05:03:51 +00:00
db \1 ; length
IF \3 < 0
dn \2, %1000 | (\3 * -1) ; volume envelope
ELSE
dn \2, \3 ; volume envelope
ENDC
db \4 ; frequency
ENDM
const_def $d0
2022-05-12 02:59:00 +00:00
DEF FIRST_MUSIC_CMD EQU const_value
2021-03-14 05:03:51 +00:00
const octave_cmd ; $d0
2022-05-12 02:54:45 +00:00
MACRO octave
2021-03-14 05:03:51 +00:00
assert 0 < (\1) && (\1) <= 8, "octave must be 1-8"
db octave_cmd | 8 - (\1) ; octave
ENDM
const_def $d8
const note_type_cmd ; $d8
2022-05-12 02:54:45 +00:00
MACRO note_type
2021-03-14 05:03:51 +00:00
db note_type_cmd
db \1 ; note length
IF _NARG >= 2
IF \3 < 0
dn \2, %1000 | (\3 * -1) ; volume envelope
ELSE
dn \2, \3 ; volume envelope
ENDC
ENDC
ENDM
; only valid on the noise channel
2022-05-12 02:54:45 +00:00
MACRO drum_speed
2021-03-14 05:03:51 +00:00
note_type \1 ; note length
ENDM
const transpose_cmd ; $d9
2022-05-12 02:54:45 +00:00
MACRO transpose
2021-03-14 05:03:51 +00:00
db transpose_cmd
dn \1, \2 ; num octaves, num pitches
ENDM
const tempo_cmd ; $da
2022-05-12 02:54:45 +00:00
MACRO tempo
2021-03-14 05:03:51 +00:00
db tempo_cmd
2015-02-13 16:10:59 +00:00
bigdw \1 ; tempo
2021-03-14 05:03:51 +00:00
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const duty_cycle_cmd ; $db
2022-05-12 02:54:45 +00:00
MACRO duty_cycle
2021-03-14 05:03:51 +00:00
db duty_cycle_cmd
db \1 ; duty cycle
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const volume_envelope_cmd ; $dc
2022-05-12 02:54:45 +00:00
MACRO volume_envelope
2021-03-14 05:03:51 +00:00
db volume_envelope_cmd
IF \2 < 0
dn \1, %1000 | (\2 * -1) ; volume envelope
ELSE
dn \1, \2 ; volume envelope
ENDC
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const pitch_sweep_cmd ; $dd
2022-05-12 02:54:45 +00:00
MACRO pitch_sweep
2021-03-14 05:03:51 +00:00
db pitch_sweep_cmd
IF \2 < 0
dn \1, %1000 | (\2 * -1) ; pitch sweep
ELSE
dn \1, \2 ; pitch sweep
ENDC
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const duty_cycle_pattern_cmd ; $de
2022-05-12 02:54:45 +00:00
MACRO duty_cycle_pattern
2021-03-14 05:03:51 +00:00
db duty_cycle_pattern_cmd
db (\1 << 6) | (\2 << 4) | (\3 << 2) | (\4 << 0) ; duty cycle pattern
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const toggle_sfx_cmd ; $df
2022-05-12 02:54:45 +00:00
MACRO toggle_sfx
2021-03-14 05:03:51 +00:00
db toggle_sfx_cmd
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const pitch_slide_cmd ; $e0
2022-05-12 02:54:45 +00:00
MACRO pitch_slide
2021-03-14 05:03:51 +00:00
db pitch_slide_cmd
db \1 - 1 ; duration
dn 8 - \2, \3 % 12 ; octave, pitch
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const vibrato_cmd ; $e1
2022-05-12 02:54:45 +00:00
MACRO vibrato
2021-03-14 05:03:51 +00:00
db vibrato_cmd
2015-02-13 16:10:59 +00:00
db \1 ; delay
2021-03-14 05:03:51 +00:00
IF _NARG > 2
dn \2, \3 ; extent, rate
ELSE
db \2 ; LEGACY: Support for 1-arg extent
ENDC
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const unknownmusic0xe2_cmd ; $e2
2022-05-12 02:54:45 +00:00
MACRO unknownmusic0xe2
2021-03-14 05:03:51 +00:00
db unknownmusic0xe2_cmd
2015-02-13 16:10:59 +00:00
db \1 ; unknown
2021-03-14 05:03:51 +00:00
ENDM
const toggle_noise_cmd ; $e3
2022-05-12 02:54:45 +00:00
MACRO toggle_noise
2021-03-14 05:03:51 +00:00
db toggle_noise_cmd
IF _NARG > 0
db \1 ; drum kit
ENDC
ENDM
const force_stereo_panning_cmd ; $e4
2022-05-12 02:54:45 +00:00
MACRO force_stereo_panning
2021-03-14 05:03:51 +00:00
db force_stereo_panning_cmd
dn %1111 * (1 && \1), %1111 * (1 && \2) ; left enable, right enable
ENDM
const volume_cmd ; $e5
2022-05-12 02:54:45 +00:00
MACRO volume
2021-03-14 05:03:51 +00:00
db volume_cmd
IF _NARG > 1
dn \1, \2 ; left volume, right volume
ELSE
db \1 ; LEGACY: Support for 1-arg volume
ENDC
ENDM
const pitch_offset_cmd ; $e6
2022-05-12 02:54:45 +00:00
MACRO pitch_offset
2021-03-14 05:03:51 +00:00
db pitch_offset_cmd
bigdw \1 ; pitch offset
ENDM
const unknownmusic0xe7_cmd ; $e7
2022-05-12 02:54:45 +00:00
MACRO unknownmusic0xe7
2021-03-14 05:03:51 +00:00
db unknownmusic0xe7_cmd
2015-02-13 16:10:59 +00:00
db \1 ; unknown
2021-03-14 05:03:51 +00:00
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const unknownmusic0xe8_cmd ; $e8
2022-05-12 02:54:45 +00:00
MACRO unknownmusic0xe8
2021-03-14 05:03:51 +00:00
db unknownmusic0xe8_cmd
2015-02-13 16:10:59 +00:00
db \1 ; unknown
2021-03-14 05:03:51 +00:00
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const tempo_relative_cmd ; $e9
2022-05-12 02:54:45 +00:00
MACRO tempo_relative
2021-03-14 05:03:51 +00:00
db tempo_relative_cmd
bigdw \1 ; tempo adjustment
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const restart_channel_cmd ; $ea
2022-05-12 02:54:45 +00:00
MACRO restart_channel
2021-03-14 05:03:51 +00:00
db restart_channel_cmd
2015-02-13 16:10:59 +00:00
dw \1 ; address
2021-03-14 05:03:51 +00:00
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const new_song_cmd ; $eb
2022-05-12 02:54:45 +00:00
MACRO new_song
2021-03-14 05:03:51 +00:00
db new_song_cmd
2015-02-13 16:10:59 +00:00
bigdw \1 ; id
2021-03-14 05:03:51 +00:00
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const sfx_priority_on_cmd ; $ec
2022-05-12 02:54:45 +00:00
MACRO sfx_priority_on
2021-03-14 05:03:51 +00:00
db sfx_priority_on_cmd
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const sfx_priority_off_cmd ; $ed
2022-05-12 02:54:45 +00:00
MACRO sfx_priority_off
2021-03-14 05:03:51 +00:00
db sfx_priority_off_cmd
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const unknownmusic0xee_cmd ; $ee
2022-05-12 02:54:45 +00:00
MACRO unknownmusic0xee
2021-03-14 05:03:51 +00:00
db unknownmusic0xee_cmd
2015-02-13 16:10:59 +00:00
dw \1 ; address
2021-03-14 05:03:51 +00:00
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const stereo_panning_cmd ; $ef
2022-05-12 02:54:45 +00:00
MACRO stereo_panning
2021-03-14 05:03:51 +00:00
db stereo_panning_cmd
dn %1111 * (1 && \1), %1111 * (1 && \2) ; left enable, right enable
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const sfx_toggle_noise_cmd ; $f0
2022-05-12 02:54:45 +00:00
MACRO sfx_toggle_noise
2021-03-14 05:03:51 +00:00
db sfx_toggle_noise_cmd
IF _NARG > 0
db \1 ; drum kit
ENDC
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const music0xf1_cmd ; $f1
2022-05-12 02:54:45 +00:00
MACRO music0xf1
2021-03-14 05:03:51 +00:00
db music0xf1_cmd
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const music0xf2_cmd ; $f2
2022-05-12 02:54:45 +00:00
MACRO music0xf2
2021-03-14 05:03:51 +00:00
db music0xf2_cmd
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const music0xf3_cmd ; $f3
2022-05-12 02:54:45 +00:00
MACRO music0xf3
2021-03-14 05:03:51 +00:00
db music0xf3_cmd
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const music0xf4_cmd ; $f4
2022-05-12 02:54:45 +00:00
MACRO music0xf4
2021-03-14 05:03:51 +00:00
db music0xf4_cmd
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const music0xf5_cmd ; $f5
2022-05-12 02:54:45 +00:00
MACRO music0xf5
2021-03-14 05:03:51 +00:00
db music0xf5_cmd
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const music0xf6_cmd ; $f6
2022-05-12 02:54:45 +00:00
MACRO music0xf6
2021-03-14 05:03:51 +00:00
db music0xf6_cmd
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const music0xf7_cmd ; $f7
2022-05-12 02:54:45 +00:00
MACRO music0xf7
2021-03-14 05:03:51 +00:00
db music0xf7_cmd
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const music0xf8_cmd ; $f8
2022-05-12 02:54:45 +00:00
MACRO music0xf8
2021-03-14 05:03:51 +00:00
db music0xf8_cmd
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const unknownmusic0xf9_cmd ; $f9
2022-05-12 02:54:45 +00:00
MACRO unknownmusic0xf9
2021-03-14 05:03:51 +00:00
db unknownmusic0xf9_cmd
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const set_condition_cmd ; $fa
2022-05-12 02:54:45 +00:00
MACRO set_condition
2021-03-14 05:03:51 +00:00
db set_condition_cmd
2015-02-13 16:10:59 +00:00
db \1 ; condition
2021-03-14 05:03:51 +00:00
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const sound_jump_if_cmd ; $fb
2022-05-12 02:54:45 +00:00
MACRO sound_jump_if
2021-03-14 05:03:51 +00:00
db sound_jump_if_cmd
2015-02-13 16:10:59 +00:00
db \1 ; condition
dw \2 ; address
2021-03-14 05:03:51 +00:00
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const sound_jump_cmd ; $fc
2022-05-12 02:54:45 +00:00
MACRO sound_jump
2021-03-14 05:03:51 +00:00
db sound_jump_cmd
2015-02-13 16:10:59 +00:00
dw \1 ; address
2021-03-14 05:03:51 +00:00
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const sound_loop_cmd ; $fd
2022-05-12 02:54:45 +00:00
MACRO sound_loop
2021-03-14 05:03:51 +00:00
db sound_loop_cmd
2015-02-13 16:10:59 +00:00
db \1 ; count
dw \2 ; address
2021-03-14 05:03:51 +00:00
ENDM
2015-02-13 16:10:59 +00:00
2021-03-14 05:03:51 +00:00
const sound_call_cmd ; $fe
2022-05-12 02:54:45 +00:00
MACRO sound_call
2021-03-14 05:03:51 +00:00
db sound_call_cmd
2015-02-13 16:10:59 +00:00
dw \1 ; address
2021-03-14 05:03:51 +00:00
ENDM
const sound_ret_cmd ; $ff
2022-05-12 02:54:45 +00:00
MACRO sound_ret
2021-03-14 05:03:51 +00:00
db sound_ret_cmd
2017-06-13 01:49:08 +00:00
ENDM