summaryrefslogtreecommitdiff
path: root/constants/audio_constants.asm
diff options
context:
space:
mode:
authorRangi <35663410+Rangi42@users.noreply.github.com>2020-07-04 16:19:15 -0400
committerGitHub <noreply@github.com>2020-07-04 16:19:15 -0400
commit2718c36065e7eb201a149938bcdd51987c4e56b6 (patch)
tree4a1c0294193a497e15ec8e6be59390eb1f84b5d3 /constants/audio_constants.asm
parentc85050497c1bd062e9cd40bf5b32fa3beca366cc (diff)
parent36f8cd1477b8ebe0537e99abd3ba53471a2e16c4 (diff)
Merge pull request #257 from Rangi42/master
More reorganization
Diffstat (limited to 'constants/audio_constants.asm')
-rw-r--r--constants/audio_constants.asm59
1 files changed, 59 insertions, 0 deletions
diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm
new file mode 100644
index 00000000..38719f92
--- /dev/null
+++ b/constants/audio_constants.asm
@@ -0,0 +1,59 @@
+; pitch
+ const_def
+ const C_ ; 0
+ const C# ; 1
+ const D_ ; 2
+ const D# ; 3
+ const E_ ; 4
+ const F_ ; 5
+ const F# ; 6
+ const G_ ; 7
+ const G# ; 8
+ const A_ ; 9
+ const A# ; A
+ const B_ ; B
+
+; channel
+ const_def
+ const Ch1 ; 0
+ const Ch2 ; 1
+ const Ch3 ; 2
+ const Ch4 ; 3
+ const Ch5 ; 4
+ const Ch6 ; 5
+ const Ch7 ; 6
+ const Ch8 ; 7
+
+; HW sound channel register base addresses
+HW_CH1_BASE EQU (rNR10 % $100)
+HW_CH2_BASE EQU ((rNR21 % $100) - 1)
+HW_CH3_BASE EQU (rNR30 % $100)
+HW_CH4_BASE EQU ((rNR41 % $100) - 1)
+
+; HW sound channel enable bit masks
+HW_CH1_ENABLE_MASK EQU %00010001
+HW_CH2_ENABLE_MASK EQU %00100010
+HW_CH3_ENABLE_MASK EQU %01000100
+HW_CH4_ENABLE_MASK EQU %10001000
+
+; HW sound channel disable bit masks
+HW_CH1_DISABLE_MASK EQU (~HW_CH1_ENABLE_MASK & $ff)
+HW_CH2_DISABLE_MASK EQU (~HW_CH2_ENABLE_MASK & $ff)
+HW_CH3_DISABLE_MASK EQU (~HW_CH3_ENABLE_MASK & $ff)
+HW_CH4_DISABLE_MASK EQU (~HW_CH4_ENABLE_MASK & $ff)
+
+REG_DUTY_SOUND_LEN EQU 1
+REG_VOLUME_ENVELOPE EQU 2
+REG_FREQUENCY_LO EQU 3
+
+; wChannelFlags1 constants
+BIT_PERFECT_PITCH EQU 0 ; controlled by toggle_perfect_pitch command
+BIT_SOUND_CALL EQU 1 ; if in sound call
+BIT_NOISE_OR_SFX EQU 2 ; if channel is the music noise channel or an SFX channel
+BIT_VIBRATO_DIRECTION EQU 3 ; if the pitch is above or below normal (cycles)
+BIT_PITCH_SLIDE_ON EQU 4 ; if pitch slide is active
+BIT_PITCH_SLIDE_DECREASING EQU 5 ; if the pitch slide frequency is decreasing (instead of increasing)
+BIT_ROTATE_DUTY_CYCLE EQU 6 ; if rotating duty cycle
+
+; wChannelFlags2 constant (only has one flag)
+BIT_EXECUTE_MUSIC EQU 0 ; if in execute music