mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 15:45:24 +13:00
Define constants for audio commands
This commit is contained in:
parent
84abdb0237
commit
7306c1dc2d
4 changed files with 185 additions and 137 deletions
|
|
@ -15,14 +15,17 @@ audio_header: MACRO
|
|||
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
|
||||
; 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 @@ pitch_sweep: MACRO
|
|||
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 @@ 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
|
||||
db $20 | \1
|
||||
db noise_note_cmd | \1
|
||||
IF \3 < 0
|
||||
db (\2 << 4) | (%1000 | (\3 * -1))
|
||||
ELSE
|
||||
|
|
@ -63,9 +72,12 @@ note: MACRO
|
|||
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 @@ drum_note_short: MACRO
|
|||
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 @@ note_type: MACRO
|
|||
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 @@ ENDM
|
|||
; 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue