-
Notifications
You must be signed in to change notification settings - Fork 0
/
sound.z80
128 lines (107 loc) · 5 KB
/
sound.z80
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
; SAM Coupé SAA-1099 sound chip mappings
; --------------------------------------
;
; Author: Simon Cooke ([email protected])
; Licensed under the MIT license (see LICENSE file).
; Datasheet: http://www.vgmpf.com/Wiki/images/1/19/SAA1099_-_Manual_-_1984.pdf
SOUND_DATA: EQU 255 ; [Write Only]
SOUND_ADDRESS: EQU 511
; Number of bytes needed to store copies of all sound registers except
; sound enable.
SOUND_DATA_SIZE: EQU &20
; Sound registers
; ===============
SOUND_OSC0_AMPLITUDE: EQU &00
SOUND_OSC1_AMPLITUDE: EQU &01
SOUND_OSC2_AMPLITUDE: EQU &02
SOUND_OSC3_AMPLITUDE: EQU &03
SOUND_OSC4_AMPLITUDE: EQU &04
SOUND_OSC5_AMPLITUDE: EQU &05
SOUND_UNUSED_1: EQU &06
SOUND_OSC0_FREQ: EQU &08
SOUND_OSC1_FREQ: EQU &09
SOUND_OSC2_FREQ: EQU &0A
SOUND_OSC3_FREQ: EQU &0B
SOUND_OSC4_FREQ: EQU &0C
SOUND_OSC5_FREQ: EQU &0D
SOUND_UNUSED_2: EQU &0E
SOUND_UNUSED_3: EQU &0F
SOUND_OSC10_OCTAVES: EQU &10
SOUND_OSC32_OCTAVES: EQU &11
SOUND_OSC54_OCTAVES: EQU &12
SOUND_UNUSED_4: EQU &13
SOUND_FREQ_ENABLE: EQU &14
SOUND_NOISE_ENABLE: EQU &15
SOUND_NOISE_GENERATORS: EQU &16
SOUND_UNUSED_5: EQU &17
SOUND_ENV_GENERATOR_0: EQU &18
SOUND_ENV_GENERATOR_1: EQU &19
SOUND_UNUSED_6: EQU &1A
SOUND_UNUSED_7: EQU &1B
SOUND_ENABLE: EQU &1C
; These apply to SOUND_OSCn_AMPLITUDE channels
SOUND_AMPLITUDE_LEFT_MASK: EQU %00001111
SOUND_AMPLITUDE_RIGHT_MASK: EQU %11110000
; Min/max volume value range.
SOUND_AMPLITUDE_MIN: EQU &00
SOUND_AMPLITUDE_MAX: EQU &0F
; Multiply values by this to align with right channel bits
SOUND_AMPLITUDE_RIGHT_MALIGN: EQU 16
; Shift values left by this to align with right channel bits
SOUND_AMPLITUDE_RIGHT_LEFTSHIFT: EQU 4
; Multiply values by this to align with left channel bits
SOUND_AMPLITUDE_LEFT_MALIGN: EQU 1
; Shift values left by this to align with left channel bits
SOUND_AMPLITUDE_LEFT_LEFTSHIFT: EQU 0
SOUND_OCTAVE_MIN: EQU 0
SOUND_OCTAVE_MAX: EQU 7
SOUND_FREQ_ENABLE_MASK: EQU %00111111
SOUND_FREQ_ENABLE_CH5: EQU %00100000
SOUND_FREQ_ENABLE_CH4: EQU %00010000
SOUND_FREQ_ENABLE_CH3: EQU %00001000
SOUND_FREQ_ENABLE_CH2: EQU %00000100
SOUND_FREQ_ENABLE_CH1: EQU %00000010
SOUND_FREQ_ENABLE_CH0: EQU %00000001
SOUND_NOISE_ENABLE_MASK: EQU %00111111
SOUND_NOISE_ENABLE_CH5: EQU %00100000
SOUND_NOISE_ENABLE_CH4: EQU %00010000
SOUND_NOISE_ENABLE_CH3: EQU %00001000
SOUND_NOISE_ENABLE_CH2: EQU %00000100
SOUND_NOISE_ENABLE_CH1: EQU %00000010
SOUND_NOISE_ENABLE_CH0: EQU %00000001
; Noise generator frequency for channels 0, 1, 2
SOUND_NOISE_GEN_0_MASK: EQU %00000011
SOUND_NOISE_GEN_0_31300_HZ: EQU %00000000
SOUND_NOISE_GEN_0_15600_HZ: EQU %00000001
SOUND_NOISE_GEN_0_7600_HZ: EQU %00000010
SOUND_NOISE_GEN_0_2X_FREQ_OSC0: EQU %00000011
; Noise generator frequency for channels 3, 4, 5
SOUND_NOISE_GEN_1_MASK: EQU %00110000
SOUND_NOISE_GEN_1_31300_HZ: EQU %00000000
SOUND_NOISE_GEN_1_15600_HZ: EQU %00010000
SOUND_NOISE_GEN_1_7600_HZ: EQU %00100000
SOUND_NOISE_GEN_1_2X_FREQ_OSC2: EQU %00110000
SOUND_ENVELOPE_SHAPE_MASK: EQU %00001110
SOUND_ENVELOPE_ZERO: EQU %00000000 ; >________
SOUND_ENVELOPE_MAX: EQU %00000010 ; >̅ ̅ ̅ ̅
SOUND_ENVELOPE_SINGLE_DECAY: EQU %00000100 ; >|\______
SOUND_ENVELOPE_REPEAT_DECAY: EQU %00000110 ; >|\|\|\|\
SOUND_ENVELOPE_SINGLE_TRIANGLE: EQU %00001000 ; >/\______
SOUND_ENVELOPE_REPEAT_TRIANGLE: EQU %00001010 ; >/\/\/\/\
SOUND_ENVELOPE_SINGLE_ATTACK: EQU %00001100 ; >/|______
SOUND_ENVELOPE_REPEAT_ATTACK: EQU %00001110 ; >/|/|/|/|
SOUND_ENV_LR_INVERSE_MASK: EQU %00000001
SOUND_ENV_RIGHT_IS_INVERSE_LEFT: EQU %00000001
SOUND_ENV_RIGHT_LEFT_SAME: EQU %00000000
SOUND_ENV_BIT_ENV_RESOLUTION_MASK: EQU %00010000
SOUND_ENV_4BIT_ENV_RESOLUTION: EQU %00000000 ; Max Frequency 976Hz
SOUND_ENV_3BIT_ENV_RESOLUTION: EQU %00010000 ; Max Frequency 19500Hz
SOUND_ENV_ENVELOPE_CLOCK_MASK: EQU %00100000
SOUND_ENV_ENVELOPE_CLOCK_INTERNAL: EQU %00000000 ; Frequency generator 1 (env 0) or 4 (env 1)
SOUND_ENV_ENVELOPE_CLOCK_EXTERNAL: EQU %00100000 ; Use Address Write Pulse
SOUND_ENVELOPE_ENABLE_MASK: EQU %10000000
SOUND_ENVELOPE_ENABLED: EQU %10000000
SOUND_ENVELOPE_DISABLED: EQU 0
SOUND_ENABLE_MASK: EQU %00000001
SOUND_ENABLE_ON: EQU %00000001
SOUND_ENABLE_OFF: EQU 0