summaryrefslogtreecommitdiff
path: root/constants
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2015-08-08 22:32:44 -0700
committerYamaArashi <shadow962@live.com>2015-08-08 22:32:44 -0700
commit2b018159997e3b580efd114ff4e3548a0de3cbc5 (patch)
treec43e657b2b5734db05e01fe31e1cb12c4fa987ad /constants
parent40c1ecb4374a83d9511fe2c5fa99704d9cfc521b (diff)
commented audio code
Diffstat (limited to 'constants')
-rw-r--r--constants/hardware_constants.asm1
-rw-r--r--constants/music_constants.asm39
2 files changed, 39 insertions, 1 deletions
diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm
index f9e3fe19..21a3ad93 100644
--- a/constants/hardware_constants.asm
+++ b/constants/hardware_constants.asm
@@ -107,4 +107,3 @@ rUNKNOWN5 EQU $ff75 ; (8Fh) - Bit 4-6 (Read/Write)
rUNKNOWN6 EQU $ff76 ; (00h) - Always 00h (Read Only)
rUNKNOWN7 EQU $ff77 ; (00h) - Always 00h (Read Only)
rIE EQU $ffff ; Interrupt Enable (R/W)
-
diff --git a/constants/music_constants.asm b/constants/music_constants.asm
index f239acea..57ad230d 100644
--- a/constants/music_constants.asm
+++ b/constants/music_constants.asm
@@ -1,3 +1,42 @@
+; 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
+
+MAX_SFX_ID EQU $B9
+
+CRY_SFX_START EQU $14
+CRY_SFX_END EQU $86
+
+; wChannelFlags1 constants
+BIT_PERFECT_PITCH EQU 0 ; controlled by toggleperfectpitch command
+BIT_CHANNEL_CALL EQU 1 ; if in channel 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_BEND_ON EQU 4 ; if pitch bend is active
+BIT_PITCH_BEND_DECREASING EQU 5 ; if the pitch bend frequency is decreasing (instead of increasing)
+BIT_ROTATE_DUTY EQU 6 ; if rotating duty
+
+; wChannelFlags2 constant (only has one flag)
+BIT_EXECUTE_MUSIC EQU 0 ; if in execute music
+
; Song ids are calculated by address to save space.
music_const: MACRO