Subversion Repositories svn.mios

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 tk 1
;
2
; Specific Defines and variables of MIOS Application
3
;
4
; ==========================================================================
5
;
6
;  Copyright 1998-2007 Thorsten Klose (tk@midibox.org)
7
;  Licensed for personal non-commercial use only.
8
;  All other rights reserved.
9
;
10
; ==========================================================================
11
 
12
#define SID_STAT_ENGINE_DISABLE     0 ; if set, SID tick and SID interrupt will not be processed
13
#define SID_STAT_ENGINE_DISABLE_LEVEL0  1 ; same as flag 0, but used during startup to overcome a wdt timeout issue when no LCD is connected
14
#define SID_STAT_SIDPLAYER      2 ; exclusive access for SID player
15
#define SID_STAT_SIDPLAYER_CS_DISABLE   3 ; set if CS buttons/encoders should be ignored
16
#define SID_STAT_CLK_SLAVE      4 ; if set, clock generator in slave mode (flag should be outside erasable SID_BASE structure)
17
#define SID_STAT_SE_CYCLE       5 ; switches between first and second engine cycle
18
 
19
;; ==========================================================================
20
 
21
    ;; patch
22
#define BANKSTICK_MAGIC0    0xf3 ; magic numbers - if they don't exists in bankstick at BANK_MAGIC_ADDRESS, 
23
#define BANKSTICK_MAGIC1    0x8b ; the stick will be ignored until it has been formatted
24
 
25
    ;; ensemble
26
#define BANKSTICK_E_MAGIC0  0xa9 ; this name has been selected intentionally ;)
27
#define BANKSTICK_E_MAGIC1  0x4e
28
 
29
;; ==========================================================================
30
 
31
#define CS_STAT_SID_AVAILABLE       0   ; flag 0: for MBNET: edits not possible when slave not available
32
#define CS_STAT_DISPLAY_INIT_REQ    1   ; flag 1: request a display initialization
33
#define CS_STAT_DISPLAY_UPDATE_REQ  2   ; flag 2: request a display update
34
#define CS_STAT_CURSOR_FLASH        3   ; flag 3: handled by cs_menu_timer.inc
35
#define CS_STAT_MODIFY_PARAMETER    4   ; flag 4: modify parameter if set, else select parameter
36
#define CS_STAT_MODIFY_NAME     5   ; flag 5: modify name if set, else modify parameter
37
#define CS_STAT_PAGE_MSG        6   ; flag 6: the page message is print on screen - don't update screen
38
#define CS_STAT_BIG_MSG         7   ; flag 7: e.g. for temporary print parameter name
39
 
40
#define CS_STAT2_WT_DEC_VIEW        0   ; flag 0: decimal view in WTC and WTE page
41
#define CS_STAT2_EDIT_UPDATE_REQ    1   ; flag 1: requests edit buffer update
42
#define CS_STAT2_COPY_BUFFER_FILLED 2   ; flag 2: set if copy buffer filled
43
#define CS_STAT2_LEVEL_METERS       3   ; flag 3: show level meters on LED matrix
44
#define CS_STAT2_PLAY_SID1      4   ; SIDx/Menu button combination: toggles play state
45
#define CS_STAT2_PLAY_SID2      5   ; DON'T CHANGE THE BIT NUMBERS!!!
46
#define CS_STAT2_PLAY_SID3      6   ; 
47
#define CS_STAT2_PLAY_SID4      7   ;
48
 
49
#define CS_STAT3_MODIFY_SEQ     0   ; flag 0: edit drum sequence
50
#define CS_STAT3_MODIFY_SEQ_ROTATE  1   ; flag 1: activate rotate function in drum editor
51
#define CS_STAT3_CFG_PAGE       2   ; flag 2: show CFG page
52
 
53
#define CS_MENU_MODE_SHIFT_PRESSED  0   ; flag 0: Shift Button pressed
54
#define CS_MENU_MODE_CC         1   ; flag 1: CC mode
55
#define CS_MENU_MODE_EDIT       2   ; flag 2: edit mode
56
#define CS_MENU_MODE_EDIT_NOTIFIER  3   ; flag 3: notifies when any value has been changed (can also be mapped to a LED)
57
#define CS_MENU_MODE_EDIT_FLASHED   4   ; flag 4: the flashed version of the edit button
58
#define CS_MENU_MODE_MATRIX_METER   5   ; flag 5: alternative meter mode for modulation sources
59
#define CS_MENU_MODE_MATRIX_METER_DISP  6   ; flag 6: used in cs_menu_matrix.inc to decide if meters should be displayed
60
#define CS_MENU_MODE_MENU_PRESSED   7   ; flag 7: Menu Button pressed
61
 
62
 
63
;; ==========================================================================
64
 
65
;; ==========================================================================
66
;;  General SID Control Variables in ACCESS page
67
;;  These variables are not cleared on a patch change!
68
;; ==========================================================================
69
SID_STAT        EQU 0x010
70
SID_ENSEMBLE        EQU 0x011
71
SID_MIDI_DEVICE     EQU 0x012
72
SID_PATCH       EQU 0x013
73
SID_BANK        EQU 0x014
74
SID_BANKSTICK_CHK_CTR   EQU 0x015
75
SID_BANKSTICK_STATUS    EQU 0x016   ; 8 flags for 8 BankSticks, 1=available
76
SID_BANKSTICK_SIZE  EQU 0x017   ; 8 flags for 8 BankSticks, 0=32k, 1=64k
77
 
78
;; ==========================================================================
79
;;  Variables used by the control surface
80
;; ==========================================================================
81
CS_MENU_PARAMETER_L EQU 0x018   ; contains low-byte of current parameter value, must be located to an even address!!!
82
CS_MENU_PARAMETER_H EQU 0x019   ; contains high-byte of current parameter value
83
CS_MENU_PARAMETER_MAX_L EQU 0x01a   ; contains max value of current parameter, must be located to an even address!!!
84
CS_MENU_PARAMETER_MAX_H EQU 0x01b   ; contains max value of current parameter
85
CS_STAT         EQU 0x01c   ; control surface status
86
CS_STAT2        EQU 0x01d   ; control surface status
87
CS_STAT3        EQU 0x01e   ; control surface status
88
CS_MENU         EQU 0x01f   ; menu page
89
CS_MENU_TABLE_0_L   EQU 0x020   ; pointer to first table entry, low-byte
90
CS_MENU_TABLE_0_H   EQU 0x021   ; pointer to first table entry, high-byte
91
CS_MENU_PAGE_OFFSET EQU 0x022   ; page offset to first displayed entry
92
CS_MENU_CURSOR_POS  EQU 0x023   ; cursor position
93
CS_MENU_ENTRIES     EQU 0x024   ; number of menu entries
94
CS_MENU_TIMER_CTR   EQU 0x025   ; used by cs_menu_timer.inc
95
CS_CURSOR_CTR       EQU 0x026   ; used by cs_menu_timer.inc
96
CS_SELECT_CTR       EQU 0x027   ; used by cs_menu.inc, counted by cs_menu_timer.inc
97
CS_MENU_REFRESH_ITEM_CTR EQU    0x028   ; used by cs_menu.inc to count through the displayed items
98
CS_MENU_ENTRY_TBLPTRL   EQU 0x029   ; used by cs_menu.inc
99
CS_MENU_ENTRY_TBLPTRH   EQU 0x02a   ; used by cs_menu.inc
100
CS_MENU_MODE        EQU 0x02b   ; control mode flags (Link/CC/Edit mode)
101
CS_MENU_WT_POS      EQU 0x02c   ; contains the current WT pos
102
CS_MENU_WT_SEQ      EQU 0x02d   ; contains the current WT sequence (used in bassline/drum mode)
103
CS_MENU_SAVE_ENS    EQU 0x02e   ; contains the ensemble number for save function
104
CS_MENU_SAVE_PATCH  EQU 0x02f   ; contains the patch number for save function
105
CS_MENU_SAVE_BANK   EQU 0x030   ; contains the bank number for save function
106
CS_MENU_REINIT_CFG_CTR  EQU 0x031   ; reinit configuration if counter == 1
107
CS_MENU_NAME_POS    EQU 0x032   ; for the "edit name" mode
108
CS_MENU_SID     EQU 0x033   ; number of SID which is currently handled
109
CS_MENU_SID_M_PATCH EQU 0x034   ; patch number of master    ;(don't change the order of these 4 registers)
110
CS_MENU_SID_S1_PATCH    EQU 0x035   ; patch number of first slave
111
CS_MENU_SID_S2_PATCH    EQU 0x036   ; patch number of second slave
112
CS_MENU_SID_S3_PATCH    EQU 0x037   ; patch number of third slave
113
CS_MENU_SID_M_BANK  EQU 0x038   ; bank number of master         ;(don't change the order of these 4 registers)
114
CS_MENU_SID_S1_BANK EQU 0x039   ; bank number of first slave
115
CS_MENU_SID_S2_BANK EQU 0x03a   ; bank number of second slave
116
CS_MENU_SID_S3_BANK EQU 0x03b   ; bank number of third slave
117
CS_MENU_SID_M_CHN   EQU 0x03c   ; MIDI channel of master    ;(don't change the order of these 4 registers)
118
CS_MENU_SID_S1_CHN  EQU 0x03d   ; MIDI channel of first slave
119
CS_MENU_SID_S2_CHN  EQU 0x03e   ; MIDI channel of second slave
120
CS_MENU_SID_S3_CHN  EQU 0x03f   ; MIDI channel of third slave
121
CS_MENU_TX_M_CTR    EQU 0x040   ; transmit counter master, if > 0, patch tx will be delayed
122
CS_MENU_TX_S1_CTR   EQU 0x041   ; transmit counter master, if > 0, patch tx will be delayed
123
CS_MENU_TX_S2_CTR   EQU 0x042   ; transmit counter master, if > 0, patch tx will be delayed
124
CS_MENU_TX_S3_CTR   EQU 0x043   ; transmit counter master, if > 0, patch tx will be delayed
125
CS_MENU_SELECTED_SID_FLAGS EQU  0x044   ; every flag stays for one SID
126
CS_MENU_SELECTED_SID_LR EQU 0x045   ; selected SID L/R
127
CS_MENU_SELECTED_INS    EQU 0x046   ; the selected ensemble
128
CS_MENU_SELECTED_OSC    EQU 0x047   ; the selected oscillator
129
CS_MENU_SELECTED_OSC_FLAGS EQU  0x048   ; every flag stays for one oscillator
130
CS_MENU_SELECTED_OSC_CTRL EQU   0x049   ; selects Env/Misc and Assign
131
CS_MENU_SELECTED_LFO    EQU 0x04a   ; the selected LFO
132
CS_MENU_SELECTED_ENV    EQU 0x04b   ; the selected envelope
133
CS_MENU_SELECTED_ENV_CTRL EQU   0x04c   ; selects Env/Assign
134
CS_MENU_SELECTED_MOD    EQU 0x04d   ; the selected mod entry
135
CS_MENU_SELECTED_MOD_SRC EQU    0x04e   ; the selected mod source entry
136
CS_MENU_SELECTED_MOD_TARG EQU   0x04f   ; the selected mod target entry
137
CS_MENU_SELECTED_TRG    EQU 0x050   ; the selected trigger entry
138
CS_MENU_SELECTED_TRK    EQU CS_MENU_SELECTED_TRG    ; only for drum engine: selected sequencer track
139
CS_MENU_SELECTED_KNOB   EQU 0x051   ; the selected knob entry
140
CS_MENU_SELECTED_WT EQU 0x052   ; the selected wavetable
141
SAVED_CS_MENU       EQU 0x053   ; used by cs_menu.inc::CS_MENU_ButtonInc
142
SAVED_CS_ENGINE     EQU SAVED_CS_MENU ;  used by cs_menu_buttons.inc::CS_MENU_SID, can be overlayed
143
SAVED_CS_MENU_PAGE_OFFSET EQU   0x054   ; used by cs_menu.inc::CS_MENU_ButtonInc
144
SAVED_CS_MENU_CURSOR_POS EQU    0x055   ; used by cs_menu.inc::CS_MENU_ButtonInc
145
CS_MENU_PARAMETER_IX    EQU 0x056   ; the parameter index (offset within Ix record) which is modified
146
CS_MENU_USED_ENCODER    EQU 0x057   ; used by cs_menu_enc.inc for FAST function
147
CS_MENU_ENC_INCREMENTER EQU     0x058   ; allows to determine the incrementer value of the encoder which modified the item
148
CS_MENU_GET_PATCH_ADDR_L EQU    0x059   ; used by cs_menu_mbnet.inc to fetch a patch stepwise
149
CS_MENU_GET_PATCH_ADDR_H EQU    0x05a   ; used by cs_menu_mbnet.inc to fetch a patch stepwise
150
CS_MENU_MATRIX_CTR  EQU 0x05b   ; counter used by CS_MENU_MATRIX_Handler
151
CS_MENU_MATRIX_FLASH_CTR EQU    0x05c   ; counter used by CS_MENU_MATRIX_Handler
152
CS_MENU_MATRIX_SELECTED_ROW EQU 0x05d   ; selected matrix row (every button has one flag)
153
CS_MENU_MATRIX_SELECTED_COL EQU 0x05e   ; selected matrix column (every button has one flag)
154
CS_MENU_EDIT_BUFFER_SID EQU 0x05f   ; reference to SID patch which is stored in edit buffer
155
 
156
 
157
;; ==========================================================================
158
;; NOTE for PIC18F4685: 0x60-0x7f NOT directly accessible via ACCESS bank!
159
;; ==========================================================================
160
CS_MENU_MATRIX_BEGIN    EQU 0x060   ; content of modulation matrix (8 entries)
161
CS_MENU_MATRIX_END  EQU 0x067
162
 
163
CS_MENU_LASTPAGE_ENG_0  EQU 0x068   ; last selected page of lead engine (used in cs_menu_buttons.inc, see comments there)
164
CS_MENU_LASTPAGE_ENG_1  EQU 0x069   ; last selected page of bassline engine (don't change offset to _0 entry)
165
CS_MENU_LASTPAGE_ENG_2  EQU 0x06a   ; last selected page of drum engine (don't change offset to _0 entry)
166
CS_MENU_LASTPAGE_ENG_3  EQU 0x06b   ; last selected page of multi engine (don't change offset to _0 entry)
167
 
168
SRM_COL_CTR     EQU 0x06c   ; used by "cs_menu_matrix.inc" (button handler)
169
 
170
    ;; free: 0x6d..0x79
171
 
172
 
173
TIMER0_RELOAD_L     EQU 0x07a   ; used by sid_bpm.inc
174
TIMER0_RELOAD_H     EQU 0x07b   ; used by sid_bpm.inc
175
 
176
SAVED_FSR0L     EQU 0x07c   ; used by sid_se.inc
177
SAVED_FSR0H     EQU 0x07d   ; used by sid_se.inc
178
SAVED_PRODL     EQU 0x07e   ; used by sid_se.inc
179
SAVED_PRODH     EQU 0x07f   ; used by sid_se.inc
180
 
181
;; ==========================================================================
182
;; ensemble edit buffer (for a single SID)
183
;; only used by CS
184
SID_ENS_BUFFER      EQU 0x080;..0x0bf
185
 
186
SID_ENSx_BANK       EQU 0x00    ; [2:0] selected bank
187
SID_ENSx_PATCH      EQU 0x01    ; [6:0] selected patch
188
SID_ENSx_CTRL1      EQU 0x02    ; [1:0] clock master/slave/auto, [6] mono
189
SID_ENSx_CTRL2      EQU 0x03    ; [0] F2A, [1] V2A, [3] P2A, [4] K2A, [5] O2A
190
SID_ENSx_RESERVED1  EQU 0x04    ; was global clock divider --- not used anymore, replaced by BPM!
191
SID_ENSx_BPM        EQU 0x05    ; global BPM
192
SID_ENSx_SUPERPOLY_CTRL EQU 0x06    ; [2:0] number of used voices (0..4)
193
SID_ENSx_AOUT_INVERTED  EQU 0x07    ; inversion flags for AOUT Channel 1..8
194
 
195
SID_ENSx_CALI_FIL1_MIN_L EQU    0x08    ; filter calibration values
196
SID_ENSx_CALI_FIL1_MIN_H EQU    0x09    ; filter calibration values
197
SID_ENSx_CALI_FIL1_MAX_L EQU    0x0a    ; filter calibration values
198
SID_ENSx_CALI_FIL1_MAX_H EQU    0x0b    ; filter calibration values
199
SID_ENSx_CALI_FIL2_MIN_L EQU    0x0c    ; filter calibration values
200
SID_ENSx_CALI_FIL2_MIN_H EQU    0x0d    ; filter calibration values
201
SID_ENSx_CALI_FIL2_MAX_L EQU    0x0e    ; filter calibration values
202
SID_ENSx_CALI_FIL2_MAX_H EQU    0x0f    ; filter calibration values
203
 
204
SID_ENSx_I1_BASE    EQU 0x10    ; base address within SID section of instrument 1
205
SID_ENSx_I2_BASE    EQU 0x18    ; base address within SID section of instrument 2
206
SID_ENSx_I3_BASE    EQU 0x20    ; base address within SID section of instrument 3
207
SID_ENSx_I4_BASE    EQU 0x28    ; base address within SID section of instrument 4
208
SID_ENSx_I5_BASE    EQU 0x30    ; base address within SID section of instrument 5
209
SID_ENSx_I6_BASE    EQU 0x38    ; base address within SID section of instrument 6
210
 
211
SID_ENSx_Ix_RECORD_LEN  EQU 0x08
212
 
213
SID_ENSx_Ix_CHN     EQU 0x00    ; [3:0] MIDI channel, [4] disable channel
214
SID_ENSx_Ix_SPLIT_L EQU 0x01    ; lower split point
215
SID_ENSx_Ix_SPLIT_U EQU 0x02    ; upper split point
216
SID_ENSx_Ix_TRN     EQU 0x03    ; transpose
217
SID_ENSx_Ix_RESERVED1   EQU 0x04    ; reserved
218
SID_ENSx_Ix_RESERVED2   EQU 0x05    ; reserved
219
SID_ENSx_Ix_RESERVED3   EQU 0x06    ; reserved
220
SID_ENSx_Ix_RESERVED4   EQU 0x07    ; reserved
221
 
222
;; ==========================================================================
223
 
224
;; global ENS settings - reserved RAM area: 0x0c0-0x0cf (0x10 bytes)
225
;; preloaded from environment
226
 
227
SID_LOCAL_ENS       EQU 0x0c0;..0x0cf
228
;; offsets identical with SID_ENSx_* from 0x00-0x0f
229
 
230
;; ==========================================================================
231
 
232
BM_ROW0_VALUES      EQU 0x0d0   ; used for button matrix - current values
233
BM_ROW1_VALUES      EQU 0x0d1
234
BM_ROW2_VALUES      EQU 0x0d2
235
BM_ROW3_VALUES      EQU 0x0d3
236
BM_ROW4_VALUES      EQU 0x0d4
237
BM_ROW5_VALUES      EQU 0x0d5
238
BM_ROW6_VALUES      EQU 0x0d6
239
BM_ROW7_VALUES      EQU 0x0d7
240
 
241
BM_ROW0_CHANGED     EQU 0x0d8   ; used for button matrix - change flags
242
BM_ROW1_CHANGED     EQU 0x0d9
243
BM_ROW2_CHANGED     EQU 0x0da
244
BM_ROW3_CHANGED     EQU 0x0db
245
BM_ROW4_CHANGED     EQU 0x0dc
246
BM_ROW5_CHANGED     EQU 0x0dd
247
BM_ROW6_CHANGED     EQU 0x0de
248
BM_ROW7_CHANGED     EQU 0x0df
249
 
250
LM_ROW0_VALUES      EQU 0x0e0   ; used for LED matrix - current values
251
LM_ROW1_VALUES      EQU 0x0e1
252
LM_ROW2_VALUES      EQU 0x0e2
253
LM_ROW3_VALUES      EQU 0x0e3
254
LM_ROW4_VALUES      EQU 0x0e4
255
LM_ROW5_VALUES      EQU 0x0e5
256
LM_ROW6_VALUES      EQU 0x0e6
257
LM_ROW7_VALUES      EQU 0x0e7
258
 
259
;; ==========================================================================
260
 
261
    ;; alternative view of mod matrix: meters
262
METER_VALUES0       EQU 0x0e8
263
METER_VALUES1       EQU 0x0e9
264
METER_VALUES2       EQU 0x0ea
265
METER_VALUES3       EQU 0x0eb
266
METER_VALUES4       EQU 0x0ec
267
METER_VALUES5       EQU 0x0ed
268
METER_VALUES6       EQU 0x0ee
269
METER_VALUES7       EQU 0x0ef
270
 
271
;; ==========================================================================
272
    ;; SID player (some variables could be shared - SID player works exclusively)
273
 
274
SIDPLAY_STATE       EQU 0x0f0   ; used by sidplay.inc: the SysEx state
275
SIDPLAY_CMD     EQU 0x0f1   ; used by sidplay.inc: the SysEx command
276
SIDPLAY_DATA_CTR    EQU 0x0f2   ; used by sidplay.inc: the SysEx Data counter
277
SIDPLAY_REG_CTR     EQU 0x0f3   ; used by sidplay.inc: the SID register counter
278
SIDPLAY_BUFFER      EQU 0x0f4   ; used by sidplay.inc: the mask/msb buffer (8 bytes)
279
SIDPLAY_BUFFER_END  EQU 0x0fb
280
 
281
;; ==========================================================================
282
 
283
;; used by superpoly mode in sid_midi_l.inc
284
SID_SUPERPOLY_VOICE_NOTE_TAB EQU 0x0fc  ;  4 bytes used
285
 
286
;; ==========================================================================
287
;;  a lot of SID control variables in BANKED page
288
;; ==========================================================================
289
SID_BASE        EQU 0x100       ; address space of registers which are directly accessed via BANKED
290
SIDSE_CLEAR_BEGIN   EQU 0x100       ; used to initialize the whole SIDSE memory
291
SIDSE_CLEAR_128B_BLOCKS EQU 5       ; number of 128 byte blocks which should be cleared (here: 2 = 0x100..0x37f)
292
 
293
;; ==========================================================================
294
SID_CURRENT_MIDIVOICE   EQU 0x100   ; selects the currently handled MIDI voice
295
SID_CURRENT_VOICE   EQU 0x101   ; selects the currently handled SID voice
296
SID_CURRENT_VOICE_ASSG  EQU 0x102   ; contains the current voice assignment [2:0] and the number of voices [6:4]
297
SID_CURRENT_CHANNEL EQU 0x103   ; used in sid_midi.inc
298
SID_MIDI_PARAMETER1 EQU 0x104   ; used in sid_midi.inc
299
SID_MIDI_PARAMETER2 EQU 0x105   ; used in sid_midi.inc
300
SID_MIDI_FLAGS      EQU 0x106   ; used in sid_midi.inc
301
SID_MIDIVOICE_SUSTAIN   EQU 0x107   ; used in sid_midi.inc - each voice has a sustain flag, which is controlled via CC#64
302
SID_PAR_IX      EQU 0x108   ; parameter index
303
 
304
;; ==========================================================================
305
SID_KNOB_NUM        EQU 0x109   ; temporary used in sid_knob.inc
306
SID_KNOB_VALUE_L    EQU 0x10a   ; temporary used in sid_knob.inc
307
SID_KNOB_VALUE_H    EQU 0x10b   ; temporary used in sid_knob.inc
308
 
309
;; ==========================================================================
310
SID_RANDOM_SEED_L   EQU 0x10c   ; used in sid_rnd.inc
311
SID_RANDOM_SEED_H   EQU 0x10d   ; used in sid_rnd.inc
312
 
313
;; ==========================================================================
314
SID_SYSEX_STATE     EQU 0x10e   ; used by sid_sysex.inc
315
SID_SYSEX_STATE2    EQU 0x10f   ; used by sid_sysex.inc
316
SID_SYSEX_ACTION    EQU 0x110   ; used by sid_sysex.inc
317
SID_SYSEX_IN        EQU 0x111   ; used by sid_sysex.inc
318
SID_SYSEX_CHECKSUM  EQU 0x112   ; used by sid_sysex.inc
319
SID_SYSEX_DATA      EQU 0x113   ; used by sid_sysex.inc
320
SID_SYSEX_ADDRESS_L EQU 0x114   ; used by sid_sysex.inc
321
SID_SYSEX_ADDRESS_H EQU 0x115   ; used by sid_sysex.inc
322
SID_SYSEX_TYPE      EQU 0x116   ; used by sid_sysex.inc
323
 
324
;; ==========================================================================
325
MUL_A_L         EQU 0x117   ; used by math_mul16_16.inc, should be located in SID_BASE bank
326
MUL_A_H         EQU 0x118   ; note: used by sid_se.inc (interrupt handler)
327
MUL_B_L         EQU 0x119   ; interrupts must be disabled if used in main task
328
MUL_B_H         EQU 0x11a
329
MUL_R_0         EQU 0x11b
330
MUL_R_1         EQU 0x11c
331
MUL_R_2         EQU 0x11d
332
MUL_R_3         EQU 0x11e
333
 
334
;; ==========================================================================
335
SID_SE_STATE        EQU 0x11f   ; used in sid_se.inc
336
SID_SE_ELEMENT_NUM  EQU 0x120   ; used in sid_se.inc
337
SID_SE_FRQ_L        EQU 0x121   ; used in sid_se.inc
338
SID_SE_FRQ_H        EQU 0x122   ; used in sid_se.inc
339
SID_SE_TARGET_FRQ_L EQU 0x123   ; used in sid_se.inc
340
SID_SE_TARGET_FRQ_H EQU 0x124   ; used in sid_se.inc
341
SID_SE_TRANSPOSED_NOTE  EQU 0x125   ; used in sid_se.inc
342
SID_SE_MOD_TRANSITION   EQU 0x126   ; used in sid_se.inc
343
SID_SE_MOD_SRC1_L   EQU 0x127   ; used in sid_se.inc
344
SID_SE_MOD_SRC1_H   EQU 0x128   ; used in sid_se.inc
345
SID_SE_MOD_SRC2_L   EQU 0x129   ; used in sid_se.inc
346
SID_SE_MOD_SRC2_H   EQU 0x12a   ; used in sid_se.inc
347
SID_SE_MOD_RES1_L   EQU 0x12b   ; used in sid_se.inc
348
SID_SE_MOD_RES1_H   EQU 0x12c   ; used in sid_se.inc
349
SID_SE_MOD_RES1_U   EQU 0x12d   ; used in sid_se.inc
350
SID_SE_MOD_RES2_L   EQU 0x12e   ; used in sid_se.inc
351
SID_SE_MOD_RES2_H   EQU 0x12f   ; used in sid_se.inc
352
SID_SE_MOD_RES2_U   EQU 0x130   ; used in sid_se.inc
353
SID_SE_LFO_OVERRUN  EQU 0x131   ; used in sid_se.inc
354
SID_SE_GLOBAL_CLK_CTR   EQU 0x132   ; used in sid_se.inc
355
SID_SE_TRG_EVNT_L   EQU 0x133   ; used in sid_se.inc
356
SID_SE_TRG_EVNT_H   EQU 0x134   ; used in sid_se.inc
357
SID_SE_TRG_EVNT_U   EQU 0x135   ; used in sid_se.inc
358
SID_SE_TRG_EVNT_ENVA    EQU 0x136   ; used in sid_se_m.inc
359
SID_SE_TRG_EVNT_ENVR    EQU 0x137   ; used in sid_se_m.inc
360
SID_SE_PHASE_SYNC_REQ   EQU 0x138   ; used in sid_se.inc and sid_sr.inc
361
SID_SE_SR_UPDATE_SYNC   EQU 0x139   ; used in sid_se.inc and sid_sr.inc
362
SID_SE_EXT_ALLOCATED    EQU 0x13a   ; used in sid_se.inc
363
 
364
;; ==========================================================================
365
SID_CLK_REQ_CTR     EQU 0x13b   ; used by MIDI clock handler to quadruple clock
366
SID_INCOMING_CLK_DELAY  EQU 0x13c   ;
367
SID_INCOMING_CLK_CTR    EQU 0x13d   ;
368
SID_SENT_CLK_DELAY  EQU 0x13e   ;
369
SID_SENT_CLK_CTR    EQU 0x13f   ;
370
 
371
;; ==========================================================================
372
;;  Modulation Sources
373
;; ==========================================================================
374
SID_MOD_SRC_NUM     EQU 30
375
SID_MOD_SRC_BASE    EQU 0x140
376
 
377
;; lead engine
378
SID_MOD_SRC_L_ENV1_L    EQU 0x140
379
SID_MOD_SRC_L_ENV1_H    EQU 0x141
380
SID_MOD_SRC_L_ENV2_L    EQU 0x142
381
SID_MOD_SRC_L_ENV2_H    EQU 0x143
382
SID_MOD_SRC_L_LFO1_L    EQU 0x144
383
SID_MOD_SRC_L_LFO1_H    EQU 0x145
384
SID_MOD_SRC_L_LFO2_L    EQU 0x146
385
SID_MOD_SRC_L_LFO2_H    EQU 0x147
386
SID_MOD_SRC_L_LFO3_L    EQU 0x148
387
SID_MOD_SRC_L_LFO3_H    EQU 0x149
388
SID_MOD_SRC_L_LFO4_L    EQU 0x14a
389
SID_MOD_SRC_L_LFO4_H    EQU 0x14b
390
SID_MOD_SRC_L_LFO5_L    EQU 0x14c
391
SID_MOD_SRC_L_LFO5_H    EQU 0x14d
392
SID_MOD_SRC_L_LFO6_L    EQU 0x14e
393
SID_MOD_SRC_L_LFO6_H    EQU 0x14f
394
SID_MOD_SRC_L_MOD1_L    EQU 0x150
395
SID_MOD_SRC_L_MOD1_H    EQU 0x151
396
SID_MOD_SRC_L_MOD2_L    EQU 0x152
397
SID_MOD_SRC_L_MOD2_H    EQU 0x153
398
SID_MOD_SRC_L_MOD3_L    EQU 0x154
399
SID_MOD_SRC_L_MOD3_H    EQU 0x155
400
SID_MOD_SRC_L_MOD4_L    EQU 0x156
401
SID_MOD_SRC_L_MOD4_H    EQU 0x157
402
SID_MOD_SRC_L_MOD5_L    EQU 0x158
403
SID_MOD_SRC_L_MOD5_H    EQU 0x159
404
SID_MOD_SRC_L_MOD6_L    EQU 0x15a
405
SID_MOD_SRC_L_MOD6_H    EQU 0x15b
406
SID_MOD_SRC_L_MOD7_L    EQU 0x15c
407
SID_MOD_SRC_L_MOD7_H    EQU 0x15d
408
SID_MOD_SRC_L_MOD8_L    EQU 0x15e
409
SID_MOD_SRC_L_MOD8_H    EQU 0x15f
410
SID_MOD_SRC_L_MDW_L EQU 0x160
411
SID_MOD_SRC_L_MDW_H EQU 0x161
412
SID_MOD_SRC_L_KEY_L EQU 0x162
413
SID_MOD_SRC_L_KEY_H EQU 0x163
414
SID_MOD_SRC_L_KNOB1_L   EQU 0x164
415
SID_MOD_SRC_L_KNOB1_H   EQU 0x165
416
SID_MOD_SRC_L_KNOB2_L   EQU 0x166
417
SID_MOD_SRC_L_KNOB2_H   EQU 0x167
418
SID_MOD_SRC_L_KNOB3_L   EQU 0x168
419
SID_MOD_SRC_L_KNOB3_H   EQU 0x169
420
SID_MOD_SRC_L_KNOB4_L   EQU 0x16a
421
SID_MOD_SRC_L_KNOB4_H   EQU 0x16b
422
SID_MOD_SRC_L_KNOB5_L   EQU 0x16c
423
SID_MOD_SRC_L_KNOB5_H   EQU 0x16d
424
SID_MOD_SRC_L_VEL_L EQU 0x16e
425
SID_MOD_SRC_L_VEL_H EQU 0x16f
426
SID_MOD_SRC_L_PBN_L EQU 0x170
427
SID_MOD_SRC_L_PBN_H EQU 0x171
428
SID_MOD_SRC_L_ATH_L EQU 0x172
429
SID_MOD_SRC_L_ATH_H EQU 0x173
430
SID_MOD_SRC_L_WT1_L EQU 0x174
431
SID_MOD_SRC_L_WT1_H EQU 0x175
432
SID_MOD_SRC_L_WT2_L EQU 0x176
433
SID_MOD_SRC_L_WT2_H EQU 0x177
434
SID_MOD_SRC_L_WT3_L EQU 0x178
435
SID_MOD_SRC_L_WT3_H EQU 0x179
436
SID_MOD_SRC_L_WT4_L EQU 0x17a
437
SID_MOD_SRC_L_WT4_H EQU 0x17b
438
 
439
 
440
 
441
;; ==========================================================================
442
;;  Modulation Targets
443
;; ==========================================================================
444
SID_MOD_TARG_NUM    EQU 40
445
SID_MOD_TARG_BASE   EQU 0x180
446
SID_MOD_TARG_PITCH1_L   EQU 0x180
447
SID_MOD_TARG_PITCH1_H   EQU 0x181
448
SID_MOD_TARG_PITCH1_U   EQU 0x182
449
SID_MOD_TARG_PITCH2_L   EQU 0x183
450
SID_MOD_TARG_PITCH2_H   EQU 0x184
451
SID_MOD_TARG_PITCH2_U   EQU 0x185
452
SID_MOD_TARG_PITCH3_L   EQU 0x186
453
SID_MOD_TARG_PITCH3_H   EQU 0x187
454
SID_MOD_TARG_PITCH3_U   EQU 0x188
455
SID_MOD_TARG_PITCH4_L   EQU 0x189
456
SID_MOD_TARG_PITCH4_H   EQU 0x18a
457
SID_MOD_TARG_PITCH4_U   EQU 0x18b
458
SID_MOD_TARG_PITCH5_L   EQU 0x18c
459
SID_MOD_TARG_PITCH5_H   EQU 0x18d
460
SID_MOD_TARG_PITCH5_U   EQU 0x18e
461
SID_MOD_TARG_PITCH6_L   EQU 0x18f
462
SID_MOD_TARG_PITCH6_H   EQU 0x190
463
SID_MOD_TARG_PITCH6_U   EQU 0x191
464
SID_MOD_TARG_PW1_L  EQU 0x192
465
SID_MOD_TARG_PW1_H  EQU 0x193
466
SID_MOD_TARG_PW1_U  EQU 0x194
467
SID_MOD_TARG_PW2_L  EQU 0x195
468
SID_MOD_TARG_PW2_H  EQU 0x196
469
SID_MOD_TARG_PW2_U  EQU 0x197
470
SID_MOD_TARG_PW3_L  EQU 0x198
471
SID_MOD_TARG_PW3_H  EQU 0x199
472
SID_MOD_TARG_PW3_U  EQU 0x19a
473
SID_MOD_TARG_PW4_L  EQU 0x19b
474
SID_MOD_TARG_PW4_H  EQU 0x19c
475
SID_MOD_TARG_PW4_U  EQU 0x19d
476
SID_MOD_TARG_PW5_L  EQU 0x19e
477
SID_MOD_TARG_PW5_H  EQU 0x19f
478
SID_MOD_TARG_PW5_U  EQU 0x1a0
479
SID_MOD_TARG_PW6_L  EQU 0x1a1
480
SID_MOD_TARG_PW6_H  EQU 0x1a2
481
SID_MOD_TARG_PW6_U  EQU 0x1a3
482
SID_MOD_TARG_FIL1_L EQU 0x1a4
483
SID_MOD_TARG_FIL1_H EQU 0x1a5
484
SID_MOD_TARG_FIL1_U EQU 0x1a6
485
SID_MOD_TARG_FIL2_L EQU 0x1a7
486
SID_MOD_TARG_FIL2_H EQU 0x1a8
487
SID_MOD_TARG_FIL2_U EQU 0x1a9
488
SID_MOD_TARG_VOL1_L EQU 0x1aa
489
SID_MOD_TARG_VOL1_H EQU 0x1ab
490
SID_MOD_TARG_VOL1_U EQU 0x1ac
491
SID_MOD_TARG_VOL2_L EQU 0x1ad
492
SID_MOD_TARG_VOL2_H EQU 0x1ae
493
SID_MOD_TARG_VOL2_U EQU 0x1af
494
SID_MOD_TARG_LD1_L  EQU 0x1b0
495
SID_MOD_TARG_LD1_H  EQU 0x1b1
496
SID_MOD_TARG_LD1_U  EQU 0x1b2
497
SID_MOD_TARG_LD2_L  EQU 0x1b3
498
SID_MOD_TARG_LD2_H  EQU 0x1b4
499
SID_MOD_TARG_LD2_U  EQU 0x1b5
500
SID_MOD_TARG_LD3_L  EQU 0x1b6
501
SID_MOD_TARG_LD3_H  EQU 0x1b7
502
SID_MOD_TARG_LD3_U  EQU 0x1b8
503
SID_MOD_TARG_LD4_L  EQU 0x1b9
504
SID_MOD_TARG_LD4_H  EQU 0x1ba
505
SID_MOD_TARG_LD4_U  EQU 0x1bb
506
SID_MOD_TARG_LD5_L  EQU 0x1bc
507
SID_MOD_TARG_LD5_H  EQU 0x1bd
508
SID_MOD_TARG_LD5_U  EQU 0x1be
509
SID_MOD_TARG_LD6_L  EQU 0x1bf
510
SID_MOD_TARG_LD6_H  EQU 0x1c0
511
SID_MOD_TARG_LD6_U  EQU 0x1c1
512
SID_MOD_TARG_LR1_L  EQU 0x1c2
513
SID_MOD_TARG_LR1_H  EQU 0x1c3
514
SID_MOD_TARG_LR1_U  EQU 0x1c4
515
SID_MOD_TARG_LR2_L  EQU 0x1c5
516
SID_MOD_TARG_LR2_H  EQU 0x1c6
517
SID_MOD_TARG_LR2_U  EQU 0x1c7
518
SID_MOD_TARG_LR3_L  EQU 0x1c8
519
SID_MOD_TARG_LR3_H  EQU 0x1c9
520
SID_MOD_TARG_LR3_U  EQU 0x1ca
521
SID_MOD_TARG_LR4_L  EQU 0x1cb
522
SID_MOD_TARG_LR4_H  EQU 0x1cc
523
SID_MOD_TARG_LR4_U  EQU 0x1cd
524
SID_MOD_TARG_LR5_L  EQU 0x1ce
525
SID_MOD_TARG_LR5_H  EQU 0x1cf
526
SID_MOD_TARG_LR5_U  EQU 0x1d0
527
SID_MOD_TARG_LR6_L  EQU 0x1d1
528
SID_MOD_TARG_LR6_H  EQU 0x1d2
529
SID_MOD_TARG_LR6_U  EQU 0x1d3
530
SID_MOD_TARG_EXT1_L EQU 0x1d4
531
SID_MOD_TARG_EXT1_H EQU 0x1d5
532
SID_MOD_TARG_EXT1_U EQU 0x1d6
533
SID_MOD_TARG_EXT2_L EQU 0x1d7
534
SID_MOD_TARG_EXT2_H EQU 0x1d8
535
SID_MOD_TARG_EXT2_U EQU 0x1d9
536
SID_MOD_TARG_EXT3_L EQU 0x1da
537
SID_MOD_TARG_EXT3_H EQU 0x1db
538
SID_MOD_TARG_EXT3_U EQU 0x1dc
539
SID_MOD_TARG_EXT4_L EQU 0x1dd
540
SID_MOD_TARG_EXT4_H EQU 0x1de
541
SID_MOD_TARG_EXT4_U EQU 0x1df
542
SID_MOD_TARG_EXT5_L EQU 0x1e0
543
SID_MOD_TARG_EXT5_H EQU 0x1e1
544
SID_MOD_TARG_EXT5_U EQU 0x1e2
545
SID_MOD_TARG_EXT6_L EQU 0x1e3
546
SID_MOD_TARG_EXT6_H EQU 0x1e4
547
SID_MOD_TARG_EXT6_U EQU 0x1e5
548
SID_MOD_TARG_EXT7_L EQU 0x1e6
549
SID_MOD_TARG_EXT7_H EQU 0x1e7
550
SID_MOD_TARG_EXT7_U EQU 0x1e8
551
SID_MOD_TARG_EXT8_L EQU 0x1e9
552
SID_MOD_TARG_EXT8_H EQU 0x1ea
553
SID_MOD_TARG_EXT8_U EQU 0x1eb
554
SID_MOD_TARG_WT1_L  EQU 0x1ec
555
SID_MOD_TARG_WT1_H  EQU 0x1ed
556
SID_MOD_TARG_WT1_U  EQU 0x1ee
557
SID_MOD_TARG_WT2_L  EQU 0x1ef
558
SID_MOD_TARG_WT2_H  EQU 0x1f0
559
SID_MOD_TARG_WT2_U  EQU 0x1f1
560
SID_MOD_TARG_WT3_L  EQU 0x1f2
561
SID_MOD_TARG_WT3_H  EQU 0x1f3
562
SID_MOD_TARG_WT3_U  EQU 0x1f4
563
SID_MOD_TARG_WT4_L  EQU 0x1f5
564
SID_MOD_TARG_WT4_H  EQU 0x1f6
565
SID_MOD_TARG_WT4_U  EQU 0x1f7
566
 
567
;; define memory area which should be cleared before calculating new results
568
SID_MOD_TARG_CLEAR_BEGIN EQU    SID_MOD_TARG_BASE
569
SID_MOD_TARG_CLEAR_END   EQU    0x1ff
570
 
571
;; ==========================================================================
572
;;  Voice records
573
;; ==========================================================================
574
SID_Vx_NUM      EQU 6
575
SID_Vx_RECORD_LEN   EQU 0x18
576
 
577
SID_Vx_ASSIGNED_MV  EQU 0x00
578
SID_Vx_STATE        EQU 0x01
579
SID_Vx_NOTE     EQU 0x02
580
SID_Vx_ARP_NOTE     EQU 0x03
581
SID_Vx_PLAYED_NOTE  EQU 0x04
582
SID_Vx_TRANSP_NOTE  EQU 0x05
583
SID_Vx_OLD_TRANSP_NOTE  EQU 0x06
584
SID_Vx_PITCHBENDER  EQU 0x07
585
SID_Vx_TARGET_FRQ_L EQU 0x08
586
SID_Vx_TARGET_FRQ_H EQU 0x09
587
SID_Vx_OLD_TARGET_FRQ_L EQU 0x0a
588
SID_Vx_OLD_TARGET_FRQ_H EQU 0x0b
589
SID_Vx_PORTA_FRQ_L  EQU 0x0c
590
SID_Vx_PORTA_FRQ_H  EQU 0x0d
591
SID_Vx_PORTA_CTR_L  EQU 0x0e
592
SID_Vx_PORTA_CTR_H  EQU 0x0f
593
SID_Vx_SET_DELAY_CTR_L  EQU 0x10
594
SID_Vx_SET_DELAY_CTR_H  EQU 0x11
595
SID_Vx_CLR_DELAY_CTR_L  EQU 0x12
596
SID_Vx_CLR_DELAY_CTR_H  EQU 0x13
597
    ;; free offsets: 0x14-0x17 (take care: 0x14 temporary allocated by SID_Vx_D_MODEL_PAR3)
598
 
599
    ;; drum engine uses some of these registers on a different way
600
SID_Vx_DRUM     EQU SID_Vx_NOTE     ; drum number
601
SID_Vx_D_MODEL_TBLPTRL  EQU SID_Vx_PORTA_FRQ_L  ; pointer to drum model (-> sid_dmodel.inc)
602
SID_Vx_D_MODEL_TBLPTRH  EQU SID_Vx_PORTA_FRQ_H
603
SID_Vx_D_MODEL_TYPE EQU SID_Vx_PORTA_CTR_L
604
SID_Vx_D_MODEL_BASENOTE EQU SID_Vx_PLAYED_NOTE
605
SID_Vx_D_MODEL_GATELENGTH EQU   SID_Vx_PORTA_CTR_H
606
SID_Vx_D_MODEL_WAVEFORM EQU SID_Vx_OLD_TARGET_FRQ_L
607
SID_Vx_D_MODEL_PULSEWIDTH EQU   SID_Vx_OLD_TARGET_FRQ_H
608
SID_Vx_D_MODEL_WT_SPEED EQU SID_Vx_ARP_NOTE
609
SID_Vx_D_MODEL_WT_END   EQU SID_Vx_TRANSP_NOTE
610
SID_Vx_D_MODEL_WT_LOOP  EQU SID_Vx_OLD_TRANSP_NOTE
611
SID_Vx_D_MODEL_PAR3 EQU 0x14; temporary in voice array
612
 
613
 
614
SIDL_V1_BASE        EQU 0x200;..0x217
615
SIDL_V2_BASE        EQU 0x218;..0x22f
616
SIDL_V3_BASE        EQU 0x230;..0x247
617
SIDR_V1_BASE        EQU 0x248;..0x25f
618
SIDR_V2_BASE        EQU 0x260;..0x277
619
SIDR_V3_BASE        EQU 0x278;..0x29f
620
 
621
;; ==========================================================================
622
;;  LFO records
623
;; ==========================================================================
624
SID_LFOx_NUM        EQU 12
625
SID_LFOx_RECORD_LEN EQU 4
626
 
627
SID_LFOx_CTR_L      EQU 0x00    ; MUST be located at offset 0
628
SID_LFOx_CTR_H      EQU 0x01    ; MUST be located at offset 1
629
SID_LFOx_DELAY_CTR_L    EQU 0x02
630
SID_LFOx_DELAY_CTR_H    EQU 0x03
631
 
632
SID_LFO1_BASE       EQU 0x2a0;..0x2a3
633
SID_LFO2_BASE       EQU 0x2a4;..0x2a7
634
SID_LFO3_BASE       EQU 0x2a8;..0x2ab
635
SID_LFO4_BASE       EQU 0x2ac;..0x2af
636
SID_LFO5_BASE       EQU 0x2b0;..0x2b3
637
SID_LFO6_BASE       EQU 0x2b4;..0x2b7
638
SID_LFO7_BASE       EQU 0x2b8;..0x2bb
639
SID_LFO8_BASE       EQU 0x2bc;..0x2bf
640
SID_LFO9_BASE       EQU 0x2c0;..0x2c3
641
SID_LFO10_BASE      EQU 0x2c4;..0x2c7
642
SID_LFO11_BASE      EQU 0x2c8;..0x2cb
643
SID_LFO12_BASE      EQU 0x2cc;..0x2cf
644
 
645
;; ==========================================================================
646
;;  Envelope records
647
;; ==========================================================================
648
SID_ENVx_NUM        EQU 6   ; (prepared for multi engine)
649
SID_ENVx_RECORD_LEN EQU 6
650
 
651
SID_ENVx_CTR_L      EQU 0x00    ; MUST be located at offset 0
652
SID_ENVx_CTR_H      EQU 0x01    ; MUST be located at offset 1
653
SID_ENVx_DELAY_CTR_L    EQU 0x02
654
SID_ENVx_DELAY_CTR_H    EQU 0x03
655
SID_ENVx_STATE      EQU 0x04
656
 
657
SID_ENV1_BASE       EQU 0x2d0;..0x2d4
658
SID_ENV2_BASE       EQU 0x2d5;..0x2d9
659
SID_ENV3_BASE       EQU 0x2da;..0x2de
660
SID_ENV4_BASE       EQU 0x2df;..0x2e3
661
SID_ENV5_BASE       EQU 0x2e4;..0x2e8
662
SID_ENV6_BASE       EQU 0x2e9;..0x2ed
663
 
664
;; ==========================================================================
665
;;  Wavetable records
666
;; ==========================================================================
667
SID_WTx_NUM     EQU 6
668
SID_WTx_RECORD_LEN  EQU 2
669
 
670
SID_WTx_POS     EQU 0x00
671
SID_WTx_DIV_CTR     EQU 0x01
672
 
673
SID_WT1_BASE        EQU 0x2ee;..0x2ef
674
SID_WT2_BASE        EQU 0x2f0;..0x2f1
675
SID_WT3_BASE        EQU 0x2f2;..0x2f3
676
SID_WT4_BASE        EQU 0x2f4;..0x2f5
677
SID_WT5_BASE        EQU 0x2f6;..0x2f7
678
SID_WT6_BASE        EQU 0x2f8;..0x2f9
679
 
680
;; ==========================================================================
681
;;  Bassline/Drum Sequencer records
682
;; ==========================================================================
683
SID_SEQx_NUM        EQU 2
684
SID_SEQx_RECORD_LEN EQU 3
685
 
686
SID_SEQx_POS        EQU 0x00
687
SID_SEQx_DIV_CTR    EQU 0x01
688
SID_SEQx_MISC       EQU 0x02    ; [2:0] subctr, [3] SEQ On, [4] sequencer running
689
 
690
SID_SEQ1_BASE       EQU 0x2ea;..0x2fc
691
SID_SEQ2_BASE       EQU 0x2fd;..0x2ff
692
 
693
 
694
;; ==========================================================================
695
;;  SID L/R register file + shadow (used in sid_sr.inc)
696
;; ==========================================================================
697
SIDL_BASE       EQU 0x300;..0x31f
698
SIDL_SHADOW_BASE    EQU 0x320;..0x33f
699
SIDR_BASE       EQU 0x340;..0x35f
700
SIDR_SHADOW_BASE    EQU 0x360;..0x37f
701
 
702
    ;; SID register offsets
703
SIDx_V1_FRQ_L       EQU 0x00
704
SIDx_V1_FRQ_H       EQU 0x01
705
SIDx_V1_PW_L        EQU 0x02
706
SIDx_V1_PW_H        EQU 0x03
707
SIDx_V1_CTRL        EQU 0x04
708
SIDx_V1_ENV_AD      EQU 0x05
709
SIDx_V1_ENV_SR      EQU 0x06
710
 
711
SIDx_V2_FRQ_L       EQU 0x07
712
SIDx_V2_FRQ_H       EQU 0x08
713
SIDx_V2_PW_L        EQU 0x09
714
SIDx_V2_PW_H        EQU 0x0a
715
SIDx_V2_CTRL        EQU 0x0b
716
SIDx_V2_ENV_AD      EQU 0x0c
717
SIDx_V2_ENV_SR      EQU 0x0d
718
 
719
SIDx_V3_FRQ_L       EQU 0x0e
720
SIDx_V3_FRQ_H       EQU 0x0f
721
SIDx_V3_PW_L        EQU 0x10
722
SIDx_V3_PW_H        EQU 0x11
723
SIDx_V3_CTRL        EQU 0x12
724
SIDx_V3_ENV_AD      EQU 0x13
725
SIDx_V3_ENV_SR      EQU 0x14
726
 
727
SIDx_FC_L       EQU 0x15
728
SIDx_FC_H       EQU 0x16
729
SIDx_RES_FCHN       EQU 0x17
730
SIDx_MODE_VOL       EQU 0x18
731
 
732
SIDx_SWINSID_V1_PHASE   EQU 0x1a
733
SIDx_SWINSID_V2_PHASE   EQU 0x1b
734
SIDx_SWINSID_V3_PHASE   EQU 0x1c
735
SIDx_SWINSID_V1_MODE    EQU 0x1d
736
SIDx_SWINSID_V2_MODE    EQU 0x1e
737
SIDx_SWINSID_V3_MODE    EQU 0x1f
738
 
739
 
740
;; ==========================================================================
741
;;  AIN RAM area not used
742
;; ==========================================================================
743
 
744
;; ==========================================================================
745
;;  Sequencer Copy/Paste Buffer
746
;;  (located in AIN RAM area - we have our own AIN handler)
747
;; ==========================================================================
748
CS_COPY_PASTE_BUFFER_BEGIN  EQU 0x380   ; 32 bytes
749
CS_COPY_PASTE_BUFFER_END    EQU 0x39f
750
 
751
;; ==========================================================================
752
;;  NRPN arrays (each MIDI channel has an own entry)
753
;; ==========================================================================
754
NRPN_ADDRESS_LSB        EQU 0x3a0   ; ..0x3af for all 16 channels
755
NRPN_ADDRESS_MSB        EQU 0x3b0   ; ..0x3bf for all 16 channels
756
NRPN_DATA_LSB           EQU 0x3c0   ; ..0x3cf for all 16 channels
757
 
758
;; ==========================================================================
759
;;  Filter Interpolation
760
;; ==========================================================================
761
FIP1_BASE       EQU 0x3d0 ; - 0x3d5
762
FIP2_BASE       EQU 0x3d6 ; - 0x3dd
763
 
764
FIPx_TARGET_VALUE_L EQU 0x00
765
FIPx_TARGET_VALUE_H EQU 0x01
766
FIPx_VALUE_L        EQU 0x02
767
FIPx_VALUE_H        EQU 0x03
768
FIPx_DIV_VALUE_L    EQU 0x04
769
FIPx_DIV_VALUE_H    EQU 0x05
770
 
771
;; ==========================================================================
772
    ;; free: 0x3de-0x3e2
773
 
774
;; ==========================================================================
775
;;  AIN registers
776
;;  (located in AIN RAM area - we have our own AIN handler)
777
;; ==========================================================================
778
AIN_INPUT_CTR       EQU 0x3e3
779
AIN_INPUT_CHANGED   EQU 0x3e4
780
AIN_INPUT_CHANGED_TMP   EQU 0x3e5
781
AIN_VALUE_0     EQU 0x3e6
782
AIN_VALUE_1     EQU 0x3e7
783
AIN_VALUE_2     EQU 0x3e8
784
AIN_VALUE_3     EQU 0x3e9
785
AIN_VALUE_4     EQU 0x3ea
786
AIN_VALUE_5     EQU 0x3eb
787
AIN_VALUE_6     EQU 0x3ec
788
AIN_VALUE_7     EQU 0x3ed
789
 
790
;; ==========================================================================
791
;;  AOUT registers
792
;;  (located in AIN RAM area - we have our own AIN handler)
793
;; ==========================================================================
794
AOUT_GATE       EQU 0x3ee   ; 8 gate bits
795
AOUT_GATE_SHADOW    EQU 0x3ef   ; shadow register - helps to determine changes
796
AOUT0_L         EQU 0x3f0   ; 8 * 12 bit values, bit #15 is used internally as "changed" flag
797
AOUT0_H         EQU 0x3f1
798
AOUT1_L         EQU 0x3f2
799
AOUT1_H         EQU 0x3f3
800
AOUT2_L         EQU 0x3f4
801
AOUT2_H         EQU 0x3f5
802
AOUT3_L         EQU 0x3f6
803
AOUT3_H         EQU 0x3f7
804
AOUT4_L         EQU 0x3f8
805
AOUT4_H         EQU 0x3f9
806
AOUT5_L         EQU 0x3fa
807
AOUT5_H         EQU 0x3fb
808
AOUT6_L         EQU 0x3fc
809
AOUT6_H         EQU 0x3fd
810
AOUT7_L         EQU 0x3fe
811
AOUT7_H         EQU 0x3ff
812
 
813
;; ==========================================================================
814
;;  Patch Record Structure
815
;;  Note: on each byte/bit assignment change, the tables under
816
;;  doc/mbsidv2_sysex_implementation.txt have to be adapted as well!
817
;; ==========================================================================
818
 
819
SID_Ix_NAME_x       EQU 0x000; 0x00-0x0f
820
 
821
;; === general parameters, structure identical for each engine ===
822
SID_Ix_ENGINE       EQU 0x010   ; [1:0] engine (Lead/Bassline/Drum/Multi), [7:2]: reserved
823
SID_Ix_HW_FLAGS     EQU 0x011   ; hardware info flags: [1:0] 0=no SID restriction, 1=6581, 2=6582/8580, 3=SwinSID; [3]: stereo, [7:4] caps: 0=470pF, 1=1nF, 2=2.2nF, 3=4.7nF, 4=6.8nF, 5=10nF, 6=22nF, 7=47nF, 8=100nF
824
SID_Ix_OPT1_FLAGS   EQU 0x012   ; [0] ABW, [7:1] reserved for future engine options
825
SID_Ix_OPT2_FLAGS   EQU 0x013   ; reserved for future engine options
826
 
827
SID_Ix_CUSTOM_SW    EQU 0x014   ; custom switch flags #1-8
828
    ;; free: 0x015-0x17
829
 
830
SID_Ix_Px_ASSIGN1   EQU 0x00    ; Knob Parameter assignment #1
831
SID_Ix_Px_ASSIGN2   EQU 0x01    ; Knob Parameter assignment #2
832
SID_Ix_Px_VALUE     EQU 0x02    ; Knob initial value
833
SID_Ix_Px_MIN       EQU 0x03    ; Knob min value
834
SID_Ix_Px_MAX       EQU 0x04    ; Knob max value
835
SID_Ix_P_K1_BASE    EQU 0x018;-0x1c Knob #1
836
SID_Ix_P_K2_BASE    EQU 0x01d;-0x21 Knob #2
837
SID_Ix_P_K3_BASE    EQU 0x022;-0x26 Knob #3
838
SID_Ix_P_K4_BASE    EQU 0x027;-0x2b Knob #4
839
SID_Ix_P_K5_BASE    EQU 0x02c;-0x30 Knob #5
840
SID_Ix_P_KV_BASE    EQU 0x031;-0x35 Velocity
841
SID_Ix_P_KP_BASE    EQU 0x036;-0x3a Pitch Bender
842
SID_Ix_P_KA_BASE    EQU 0x03b;-0x3f     Aftertouch
843
 
844
SID_Ix_EXT_PAR1_L   EQU 0x040   ; external parameter #1 (e.g. for AOUT)
845
SID_Ix_EXT_PAR1_H   EQU 0x041
846
SID_Ix_EXT_PAR2_L   EQU 0x042   ; external parameter #2
847
SID_Ix_EXT_PAR2_H   EQU 0x043
848
SID_Ix_EXT_PAR3_L   EQU 0x044   ; external parameter #3
849
SID_Ix_EXT_PAR3_H   EQU 0x045
850
SID_Ix_EXT_PAR4_L   EQU 0x046   ; external parameter #4
851
SID_Ix_EXT_PAR4_H   EQU 0x047
852
SID_Ix_EXT_PAR5_L   EQU 0x048   ; external parameter #5
853
SID_Ix_EXT_PAR5_H   EQU 0x049
854
SID_Ix_EXT_PAR6_L   EQU 0x04a   ; external parameter #6
855
SID_Ix_EXT_PAR6_H   EQU 0x04b
856
SID_Ix_EXT_PAR7_L   EQU 0x04c   ; external parameter #7
857
SID_Ix_EXT_PAR7_H   EQU 0x04d
858
SID_Ix_EXT_PAR8_L   EQU 0x04e   ; external parameter #8
859
SID_Ix_EXT_PAR8_H   EQU 0x04f
860
 
861
;; === engine specific parameters ===
862
 
863
;; --- Lead ---
864
 
865
;; general flags
866
SID_Ix_L_FLAGS1     EQU 0x050   ; mono/legato [0], WTO [1], SusKey [2]
867
SID_Ix_L_OSC_DETUNE EQU 0x051   ; detune left/right oscillators
868
SID_Ix_L_VOLUME     EQU 0x052   ; 7 bit value, only 4 bit used
869
SID_Ix_L_OSC_PHASE  EQU 0x053   ; oscillator phase offset
870
 
871
;; filter sections (uses SID_Ix_L_Fx_* offsets)
872
SID_Ix_L_S1F_BASE   EQU 0x054;..0x059
873
SID_Ix_L_S2F_BASE   EQU 0x05a;..0x05f
874
 
875
;; oscillator sections (uses SID_Ix_Vx_* offsets)
876
SID_Ix_L_S1V1_BASE  EQU 0x060;..0x06f    SID1 Voice1
877
SID_Ix_L_S1V2_BASE  EQU 0x070;..0x07f    SID1 Voice2
878
SID_Ix_L_S1V3_BASE  EQU 0x080;..0x08f    SID1 Voice3
879
SID_Ix_L_S2V1_BASE  EQU 0x090;..0x09f    SID2 Voice1
880
SID_Ix_L_S2V2_BASE  EQU 0x0a0;..0x0af    SID2 Voice2
881
SID_Ix_L_S2V3_BASE  EQU 0x0b0;..0x0bf    SID2 Voice3
882
 
883
;; LFO sections (uses SID_Ix_LFOx_* offsets)
884
SID_Ix_L_LFO1_BASE  EQU 0x0c0;..0x0c4    LFO1
885
SID_Ix_L_LFO2_BASE  EQU 0x0c5;..0x0c9    LFO2
886
SID_Ix_L_LFO3_BASE  EQU 0x0ca;..0x0ce    LFO3
887
SID_Ix_L_LFO4_BASE  EQU 0x0cf;..0x0d3    LFO4
888
SID_Ix_L_LFO5_BASE  EQU 0x0d4;..0x0d8    LFO5
889
SID_Ix_L_LFO6_BASE  EQU 0x0d9;..0x0dd    LFO6
890
 
891
;; free: 0xde and 0xdf
892
 
893
;; ENV sections (uses SID_Ix_ENVx_* offsets)
894
SID_Ix_L_ENV1_BASE  EQU 0x0e0;..0x0ef    ENV1
895
SID_Ix_L_ENV2_BASE  EQU 0x0f0;..0x0ff    ENV2
896
 
897
;; MOD sections (uses SID_Ix_MODx_* offsets)
898
SID_Ix_L_MOD1_BASE  EQU 0x100;..0x107   Modulator1
899
SID_Ix_L_MOD2_BASE  EQU 0x108;..0x10f   Modulator2
900
SID_Ix_L_MOD3_BASE  EQU 0x110;..0x117   Modulator3
901
SID_Ix_L_MOD4_BASE  EQU 0x118;..0x11f   Modulator4
902
SID_Ix_L_MOD5_BASE  EQU 0x120;..0x127   Modulator5
903
SID_Ix_L_MOD6_BASE  EQU 0x128;..0x12f   Modulator6
904
SID_Ix_L_MOD7_BASE  EQU 0x130;..0x137   Modulator7
905
SID_Ix_L_MOD8_BASE  EQU 0x138;..0x13f   Modulator8
906
 
907
;; TRG sections
908
SID_Ix_L_TRG_BASE   EQU 0x140;..0x16f
909
SID_Ix_L_TRG_NOn_BASE   EQU 0x140;..0x142   Note On
910
SID_Ix_L_TRG_NOf_BASE   EQU 0x143;..0x145   Note Off
911
SID_Ix_L_TRG_E1S_BASE   EQU 0x146;..0x148   ENV1 Sustain Phase
912
SID_Ix_L_TRG_E2S_BASE   EQU 0x149;..0x14b   ENV2 Sustain Phase
913
SID_Ix_L_TRG_L1P_BASE   EQU 0x14c;..0x14e   LFO1 Period
914
SID_Ix_L_TRG_L2P_BASE   EQU 0x14f;..0x151   LFO2 Period
915
SID_Ix_L_TRG_L3P_BASE   EQU 0x152;..0x154   LFO3 Period
916
SID_Ix_L_TRG_L4P_BASE   EQU 0x155;..0x157   LFO4 Period
917
SID_Ix_L_TRG_L5P_BASE   EQU 0x158;..0x15a   LFO5 Period
918
SID_Ix_L_TRG_L6P_BASE   EQU 0x15b;..0x15d   LFO6 Period
919
SID_Ix_L_TRG_Clk_BASE   EQU 0x15e;..0x160   Clock
920
SID_Ix_L_TRG_Cl4_BASE   EQU 0x161;..0x163   Clock/4
921
SID_Ix_L_TRG_C16_BASE   EQU 0x164;..0x166   Clock/16
922
SID_Ix_L_TRG_MSt_BASE   EQU 0x167;..0x169   MIDI Clock Start
923
 
924
;; free: 0x6a-0x6b
925
 
926
;; WT sections (uses SID_Ix_WTx_* offsets)
927
SID_Ix_L_WT1_BASE   EQU 0x16c;..0x170
928
SID_Ix_L_WT2_BASE   EQU 0x171;..0x175
929
SID_Ix_L_WT3_BASE   EQU 0x176;..0x17a
930
SID_Ix_L_WT4_BASE   EQU 0x17b;..0x17f
931
 
932
 
933
;; --- offset definitions ---
934
SID_Ix_L_Fx_CHN_MODE    EQU 0x0 ; [2:0] assigned oscillators, [3] Ext. Input, [6:4] filter mode, [7] OSC3 off
935
SID_Ix_L_Fx_CUTOFF_L    EQU 0x1 ; cut-off frequency (12 bit, 11 bit used)
936
SID_Ix_L_Fx_CUTOFF_H    EQU 0x2     ; bit [7] contols FIP (interpolation option)
937
SID_Ix_L_Fx_RESONANCE   EQU 0x3 ; resonance (8bit, 4 bit used)
938
SID_Ix_L_Fx_KEYTRACK    EQU 0x4 ; keytracking
939
SID_Ix_L_Fx_RESERVED2   EQU 0x5 ; reserved for future expansions
940
 
941
SID_Ix_Vx_FLAGS1    EQU 0x00    ; [1:0] portamento (0), constant time glide (1), glissando (2), [2] GAE (gate always enabled)
942
SID_Ix_Vx_WAVEFORM  EQU 0x01    ; [3:0] waveform, [4] voice off, [5] sync, [6] ring, [7] reserved
943
SID_Ix_Vx_AD        EQU 0x02    ; 2*4bit value for attack [7:4] and decay [3:0]
944
SID_Ix_Vx_SR        EQU 0x03    ; 2*4bit value for sustain [7:4] and sustain [3:0]
945
SID_Ix_Vx_PULSEWIDTH_L  EQU 0x04    ; [7:0] low byte
946
SID_Ix_Vx_PULSEWIDTH_H  EQU 0x05    ; [3:0] high nibble, [7:4] reserved
947
SID_Ix_Vx_ACCENT    EQU 0x06    ; not used by lead engine, could be replaced by something else
948
SID_Ix_Vx_SWINSID_PHASE EQU 0x06    ; used by lead engine of SwinSID option enabled
949
SID_Ix_Vx_DELAY     EQU 0x07    ; 8bit
950
SID_Ix_Vx_TRANSPOSE EQU 0x08    ; 7bit
951
SID_Ix_Vx_FINETUNE  EQU 0x09    ; 8bit
952
SID_Ix_Vx_PITCHRANGE    EQU 0x0a    ; 7bit
953
SID_Ix_Vx_PORTAMENTO    EQU 0x0b    ; 8bit
954
SID_Ix_Vx_ARP_MODE  EQU 0x0c    ; [0] enable, [2:1] dir up/down/U&D/D&U, [3] random, [4] sorted, [5] hold, [6] sync, [7] CAC
955
SID_Ix_Vx_ARP_SPEED_DIV EQU 0x0d    ; [7] oneshot, [6] reserved, [5:0] own speed or derived from global clock (dividable)
956
SID_Ix_Vx_ARP_GL_RNG    EQU 0x0e    ; [4:0] gatelength [7:5] arp octave range (seperate for each voice)
957
SID_Ix_Vx_SWINSID_MODE  EQU 0x0f    ; [3:0] waveform of second OSC, [4] enable 2nd OSC, [5] x2 pitch, [6] reverse waveform
958
 
959
SID_Ix_LFOx_MODE    EQU 0x00    ; [0] enable, [2] clksync, [3] oneshot, [7:4] waveform
960
SID_Ix_LFOx_DEPTH   EQU 0x01    ; LFO depth (8 bit instead of 7 like MBSID V1!)
961
SID_Ix_LFOx_RATE    EQU 0x02    ; LFO rate (8 bit instead of 7 like MBSID V1!)
962
SID_Ix_LFOx_DELAY   EQU 0x03    ; LFO depth (8 bit instead of 7 like MBSID V1!)
963
SID_Ix_LFOx_PHASE   EQU 0x04    ; LFO phase
964
 
965
SID_Ix_L_ENVx_MODE  EQU 0x00    ; ENV mode ([2:0] loop begin, [3] reserved, [6:4] loop end, [7] BPM sync)
966
SID_Ix_L_ENVx_DEPTH EQU 0x01    ; 8bit value
967
SID_Ix_L_ENVx_DELAY EQU 0x02    ; 8bit value
968
SID_Ix_L_ENVx_ATTACK1   EQU 0x03    ; 8bit value
969
SID_Ix_L_ENVx_ATTLVL    EQU 0x04    ; 8bit value
970
SID_Ix_L_ENVx_ATTACK2   EQU 0x05    ; 8bit value
971
SID_Ix_L_ENVx_DECAY1    EQU 0x06    ; 8bit value
972
SID_Ix_L_ENVx_DECLVL    EQU 0x07    ; 8bit value
973
SID_Ix_L_ENVx_DECAY2    EQU 0x08    ; 8bit value
974
SID_Ix_L_ENVx_SUSTAIN   EQU 0x09    ; 8bit value
975
SID_Ix_L_ENVx_RELEASE1  EQU 0x0a    ; 8bit value
976
SID_Ix_L_ENVx_RELLVL    EQU 0x0b    ; 8bit value
977
SID_Ix_L_ENVx_RELEASE2  EQU 0x0c    ; 8bit value
978
SID_Ix_L_ENVx_ATT_CURVE EQU 0x0d    ; 8bit value
979
SID_Ix_L_ENVx_DEC_CURVE EQU 0x0e    ; 8bit value
980
SID_Ix_L_ENVx_REL_CURVE EQU 0x0f    ; 8bit value
981
 
982
SID_Ix_MODx_SRC1    EQU 0x00    ; modulation source #1 - LFO, ENV, Analog In, Velocity, Modwheel, Aftertouch, PitchBend, Keynumber, Knob #1-5
983
SID_Ix_MODx_SRC2    EQU 0x01    ; modulation source #2
984
SID_Ix_MODx_OP      EQU 0x02    ; [7] invert target 1/L [6] invert target 2/R [5:4] reserved [3:0] modulation operation (SRC1 only, SRC2 only, SRC1+SRC2, SRC1-SRC2, SRC1*SRC2, XOR, OR, AND, Min, Max)
985
SID_Ix_MODx_DEPTH   EQU 0x03    ; 8bit value (-128..+127)
986
SID_Ix_MODx_TARG_L  EQU 0x04    ; modulation target SIDL [2:0] Pitch Voice 1/2/3, [5:3] PW Voice 1/2/3, [6] Filter, [7] Volume
987
SID_Ix_MODx_TARG_R  EQU 0x05    ; modulation target SIDR [2:0] Pitch Voice 1/2/3, [5:3] PW Voice 1/2/3, [6] Filter, [7] Volume
988
SID_Ix_MODx_TARG_X1 EQU 0x06    ; additional selectable target #1
989
SID_Ix_MODx_TARG_X2 EQU 0x07    ; additional selectable target #2
990
 
991
SID_Ix_WTx_SPEED    EQU 0x00    ; [5:0] clock divider, [6] channel target SIDL, [7] channel target SIDR
992
SID_Ix_WTx_ASSGN    EQU 0x01    ; parameter assignment
993
SID_Ix_WTx_BEGIN    EQU 0x02    ; [6:0] start position in wavetable, [7] position controlled by MOD
994
SID_Ix_WTx_END      EQU 0x03    ; [6:0] end position in wavetable
995
SID_Ix_WTx_LOOP     EQU 0x04    ; [6:0] loop position in wavetable, [7] one shot
996
 
997
SID_Ix_WAVETABLE    EQU 0x180;..0x1ff
998
 
999
;; --------------------------------------------------------------------------
1000
 
1001
;; --- Multi ---
1002
 
1003
;; general flags
1004
SID_Ix_M_FLAGS1     EQU 0x050   ; not used - FLAGS1 is available for each instrument seperately (SID_Ix_M_Vx_FLAGS1)
1005
    ;; free: 0x51
1006
SID_Ix_M_VOLUME     EQU 0x052   ; 7 bit value, only 4 bit used
1007
    ;; free: 0x53
1008
 
1009
SID_Ix_M_S1F_BASE   EQU 0x054;..0x059
1010
SID_Ix_M_S2F_BASE   EQU 0x05a;..0x05f
1011
 
1012
SID_Ix_M_I1_BASE    EQU 0x060;..0x08f    Multi Instrument #1
1013
SID_Ix_M_I2_BASE    EQU 0x090;..0x0bf    Multi Instrument #2
1014
SID_Ix_M_I3_BASE    EQU 0x0c0;..0x0ef    Multi Instrument #3
1015
SID_Ix_M_I4_BASE    EQU 0x0f0;..0x11f    Multi Instrument #4
1016
SID_Ix_M_I5_BASE    EQU 0x120;..0x14f    Multi Instrument #5
1017
SID_Ix_M_I6_BASE    EQU 0x150;..0x17f    Multi Instrument #6
1018
 
1019
;; enhancement of SID_Ix_Vx_* structure (re-used from lead engine)
1020
SID_Ix_M_Vx_FLAGS2  EQU 0x10    ; mono/legato [0], WTO [1], SusKey [2], Poly [3]
1021
SID_Ix_M_Vx_VOICE_ASSGN EQU 0x11    ; [3:0] voice assignment, [7:4] reserved
1022
SID_Ix_M_Vx_VELOCITY_ASSGN EQU  0x12    ; velocity assignment
1023
SID_Ix_M_Vx_PITCHBENDER_ASSGN EQU 0x13  ; pitchbender assignment
1024
 
1025
SID_Ix_M_Vx_LFO1_MODE   EQU 0x14    ; same as SID_Ix_LFOx_MODE
1026
SID_Ix_M_Vx_LFO1_DEPTH_P EQU    0x15    ; 8bit, depth of pitch modulation
1027
SID_Ix_M_Vx_LFO1_RATE   EQU 0x16    ; same as SID_Ix_LFOx_RATE
1028
SID_Ix_M_Vx_LFO1_DELAY  EQU 0x17    ; same as SID_Ix_LFOx_DELAY
1029
SID_Ix_M_Vx_LFO1_PHASE  EQU 0x18    ; same as SID_Ix_LFOx_PHASE
1030
SID_Ix_M_Vx_LFO1_DEPTH_PW EQU   0x19    ; 8bit, depth of pulsewidth modulation
1031
SID_Ix_M_Vx_LFO1_DEPTH_F EQU    0x1a    ; 8bit, depth of cutoff modulation
1032
SID_Ix_M_Vx_LFO2_MODE   EQU 0x1b    ; same as SID_Ix_LFOx_MODE
1033
SID_Ix_M_Vx_LFO2_DEPTH_P EQU    0x1c    ; 8bit, depth of pitch modulation
1034
SID_Ix_M_Vx_LFO2_RATE   EQU 0x1d    ; same as SID_Ix_LFOx_RATE
1035
SID_Ix_M_Vx_LFO2_DELAY  EQU 0x1e    ; same as SID_Ix_LFOx_DELAY
1036
SID_Ix_M_Vx_LFO2_PHASE  EQU 0x1f    ; same as SID_Ix_LFOx_PHASE
1037
SID_Ix_M_Vx_LFO2_DEPTH_PW EQU   0x20    ; 8bit, depth of pulsewidth modulation
1038
SID_Ix_M_Vx_LFO2_DEPTH_F EQU    0x21    ; 8bit, depth of cutoff modulation
1039
 
1040
SID_Ix_M_Vx_ENV_MODE    EQU 0x22    ; same as SID_Ix_ENVx_MODE, but [6:4] control the curve assignments
1041
SID_Ix_M_Vx_ENV_DEPTH_P EQU 0x23    ; 8bit, depth of pitch modulation
1042
SID_Ix_M_Vx_ENV_DEPTH_PW EQU    0x24    ; 8bit, depth of pulsewidth modulation
1043
SID_Ix_M_Vx_ENV_DEPTH_F EQU 0x25    ; 8bit, depth of cutoff modulation
1044
SID_Ix_M_Vx_ENV_ATTACK  EQU 0x26    ; same as SID_Ix_ENVx_ATTACK1
1045
SID_Ix_M_Vx_ENV_DECAY   EQU 0x27    ; same as SID_Ix_ENVx_DECAY2
1046
SID_Ix_M_Vx_ENV_SUSTAIN EQU 0x28    ; same as SID_Ix_ENVx_SUSTAIN
1047
SID_Ix_M_Vx_ENV_RELEASE EQU 0x29    ; same as SID_Ix_ENVx_RELEASE
1048
SID_Ix_M_Vx_ENV_CURVE EQU   0x2a    ; 8bit value, assignments in SID_Ix_ENVx_MODE[6:4]
1049
 
1050
SID_Ix_M_Vx_WT_SPEED    EQU 0x2b    ; same as SID_Ix_WTx_SPEED
1051
SID_Ix_M_Vx_WT_ASSGN    EQU 0x2c    ; same as SID_Ix_WTx_ASSGN
1052
SID_Ix_M_Vx_WT_BEGIN    EQU 0x2d    ; same as SID_Ix_WTx_BEGIN
1053
SID_Ix_M_Vx_WT_END  EQU 0x2e    ; same as SID_Ix_WTx_END
1054
SID_Ix_M_Vx_WT_LOOP EQU 0x2f    ; same as SID_Ix_WTx_LOOP
1055
 
1056
;; --------------------------------------------------------------------------
1057
 
1058
;; --- Bassline ---
1059
 
1060
;; general flags
1061
SID_Ix_B_FLAGS1     EQU 0x050   ; not used - FLAGS1 is available for each instrument seperately (SID_Ix_B_Vx_FLAGS1)
1062
    ;; free: 0x51
1063
SID_Ix_B_VOLUME     EQU 0x052   ; 7 bit value, only 4 bit used
1064
    ;; free: 0x53
1065
 
1066
SID_Ix_B_S1F_BASE   EQU 0x054;..0x059
1067
SID_Ix_B_S2F_BASE   EQU 0x05a;..0x05f
1068
 
1069
SID_Ix_B_S1V1_BASE  EQU 0x060;..0x0af    SID1 Voice1
1070
SID_Ix_B_S2V1_BASE  EQU 0x0b0;..0x0ff    SID2 Voice1
1071
 
1072
;; enhancement of SID_Ix_Vx_* structure (re-used from lead engine)
1073
SID_Ix_B_Vx_RESERVED1   EQU 0x2c
1074
SID_Ix_B_Vx_RESERVED2   EQU 0x2d
1075
SID_Ix_B_Vx_RESERVED3   EQU 0x2e
1076
SID_Ix_B_Vx_RESERVED4   EQU 0x2f
1077
 
1078
SID_Ix_B_Vx_FLAGS2  EQU 0x10    ; mono/legato [0], WTO [1], SusKey [2], OSC Phase Sync [3]
1079
;; 0x11..0x13 not used (dedicated voice/PB/vel assignments)
1080
 
1081
SID_Ix_B_Vx_LFO1_MODE   EQU 0x14    ; same as SID_Ix_LFOx_MODE
1082
SID_Ix_B_Vx_LFO1_DEPTH_P EQU    0x15    ; 8bit, depth of pitch modulation
1083
SID_Ix_B_Vx_LFO1_RATE   EQU 0x16    ; same as SID_Ix_LFOx_RATE
1084
SID_Ix_B_Vx_LFO1_DELAY  EQU 0x17    ; same as SID_Ix_LFOx_DELAY
1085
SID_Ix_B_Vx_LFO1_PHASE  EQU 0x18    ; same as SID_Ix_LFOx_PHASE
1086
SID_Ix_B_Vx_LFO1_DEPTH_PW EQU   0x19    ; 8bit, depth of pulsewidth modulation
1087
SID_Ix_B_Vx_LFO1_DEPTH_F EQU    0x1a    ; 8bit, depth of cutoff modulation
1088
SID_Ix_B_Vx_LFO2_MODE   EQU 0x1b    ; same as SID_Ix_LFOx_MODE
1089
SID_Ix_B_Vx_LFO2_DEPTH_P EQU    0x1c    ; 8bit, depth of pitch modulation
1090
SID_Ix_B_Vx_LFO2_RATE   EQU 0x1d    ; same as SID_Ix_LFOx_RATE
1091
SID_Ix_B_Vx_LFO2_DELAY  EQU 0x1e    ; same as SID_Ix_LFOx_DELAY
1092
SID_Ix_B_Vx_LFO2_PHASE  EQU 0x1f    ; same as SID_Ix_LFOx_PHASE
1093
SID_Ix_B_Vx_LFO2_DEPTH_PW EQU   0x20    ; 8bit, depth of pulsewidth modulation
1094
SID_Ix_B_Vx_LFO2_DEPTH_F EQU    0x21    ; 8bit, depth of cutoff modulation
1095
 
1096
SID_Ix_B_Vx_ENV_MODE    EQU 0x22    ; same as SID_Ix_ENVx_MODE, but [6:4] control the curve assignments
1097
SID_Ix_B_Vx_ENV_DEPTH_P EQU 0x23    ; 8bit, depth of pitch modulation
1098
SID_Ix_B_Vx_ENV_DEPTH_PW EQU    0x24    ; 8bit, depth of pulsewidth modulation
1099
SID_Ix_B_Vx_ENV_DEPTH_F EQU 0x25    ; 8bit, depth of cutoff modulation
1100
SID_Ix_B_Vx_ENV_ATTACK  EQU 0x26    ; same as SID_Ix_ENVx_ATTACK1
1101
SID_Ix_B_Vx_ENV_DECAY   EQU 0x27    ; same as SID_Ix_ENVx_DECAY2
1102
SID_Ix_B_Vx_ENV_SUSTAIN EQU 0x28    ; same as SID_Ix_ENVx_SUSTAIN
1103
SID_Ix_B_Vx_ENV_RELEASE EQU 0x29    ; same as SID_Ix_ENVx_RELEASE
1104
SID_Ix_B_Vx_ENV_CURVE EQU   0x2a    ; 8bit value, assignments in SID_Ix_ENVx_MODE[6:4]
1105
 
1106
SID_Ix_B_Vx_SEQ_SPEED   EQU 0x2b    ; [5:0] sequencer speed, [6] reserved, [7] 16step sync (sync to measure)
1107
SID_Ix_B_Vx_SEQ_NUM EQU 0x2c    ; [3:0] sequence number (0-8, 8=disabled)
1108
SID_Ix_B_Vx_SEQ_LENGTH  EQU 0x2d    ; [3:0] steps (0-15)
1109
SID_Ix_B_Vx_SEQ_ASSGN   EQU 0x2e    ; same as SID_Ix_WTx_ASSGN
1110
SID_Ix_B_Vx_SEQ_RESERVED2 EQU   0x2f
1111
 
1112
SID_Ix_B_Vx_ENV_DECAY_A EQU 0x030   ; ENV decay used on accented notes
1113
 
1114
    ;; free offsets: 0x31..0x4f
1115
 
1116
SID_Ix_B_SEQUENCES  EQU 0x100;..0x1ff
1117
    ;; structure: 2 bytes for each step (selected with address bit #7)
1118
    ;;              lower byte: note/octave/glide/gate flags
1119
    ;;              upper byte: accent and assignable parameter
1120
    ;;            16 steps per sequence
1121
    ;;            8 sequences
1122
 
1123
;; --------------------------------------------------------------------------
1124
 
1125
;; --- Drums ---
1126
 
1127
;; general flags
1128
SID_Ix_D_SEQ_SPEED  EQU 0x050   ; [5:0] sequencer speed, [6] sequencer on, [7] 16step sync
1129
SID_Ix_D_SEQ_NUM    EQU 0x051   ; sequence number (0-8, 8=disabled)
1130
SID_Ix_D_VOLUME     EQU 0x052   ; 7 bit value, only 4 bit used
1131
SID_Ix_D_SEQ_LENGTH EQU 0x053   ; steps (0-15)
1132
 
1133
SID_Ix_D_S1F_BASE   EQU 0x054;..0x059
1134
SID_Ix_D_S2F_BASE   EQU 0x05a;..0x05f
1135
 
1136
SID_Ix_D_I1_BASE    EQU 0x060;..0x069    Drum Instrument #1
1137
SID_Ix_D_I2_BASE    EQU 0x06a;..0x073    Drum Instrument #2
1138
SID_Ix_D_I3_BASE    EQU 0x074;..0x07d    Drum Instrument #3
1139
SID_Ix_D_I4_BASE    EQU 0x07e;..0x087    Drum Instrument #4
1140
SID_Ix_D_I5_BASE    EQU 0x088;..0x091    Drum Instrument #5
1141
SID_Ix_D_I6_BASE    EQU 0x092;..0x09b    Drum Instrument #6
1142
SID_Ix_D_I7_BASE    EQU 0x09c;..0x0a5    Drum Instrument #7
1143
SID_Ix_D_I8_BASE    EQU 0x0a6;..0x0af    Drum Instrument #8
1144
SID_Ix_D_I9_BASE    EQU 0x0b0;..0x0b9    Drum Instrument #9
1145
SID_Ix_D_I10_BASE   EQU 0x0ba;..0x0c3    Drum Instrument #10
1146
SID_Ix_D_I11_BASE   EQU 0x0c4;..0x0cd    Drum Instrument #11
1147
SID_Ix_D_I12_BASE   EQU 0x0ce;..0x0d7    Drum Instrument #12
1148
SID_Ix_D_I13_BASE   EQU 0x0d8;..0x0e1    Drum Instrument #13
1149
SID_Ix_D_I14_BASE   EQU 0x0e2;..0x0eb    Drum Instrument #14
1150
SID_Ix_D_I15_BASE   EQU 0x0ec;..0x0f5    Drum Instrument #15
1151
SID_Ix_D_I16_BASE   EQU 0x0f6;..0x0ff    Drum Instrument #16
1152
 
1153
SID_Ix_Dx_FLAGS1    EQU 0x00    ; [7:4] voice assignment, [3:0] reserved
1154
SID_Ix_Dx_MODEL     EQU 0x01    ; drum model
1155
SID_Ix_Dx_AD        EQU 0x02    ; 2*4bit value for attack [7:4] and decay [3:0]
1156
SID_Ix_Dx_SR        EQU 0x03    ; 2*4bit value for sustain [7:4] and sustain [3:0]
1157
SID_Ix_Dx_TUNE      EQU 0x04    ; 8bit
1158
SID_Ix_Dx_PAR1      EQU 0x05    ; 8bit
1159
SID_Ix_Dx_PAR2      EQU 0x06    ; 8bit
1160
SID_Ix_Dx_PAR3      EQU 0x07    ; 8bit
1161
SID_Ix_Dx_VELOCITY_ASSGN EQU    0x08    ; velocity assignment
1162
SID_Ix_Dx_RESERVED1 EQU 0x09    ; reserved for future extensions
1163
 
1164
SID_Ix_D_SEQUENCES  EQU 0x100;..0x1ff
1165
    ;; structure: 4 bytes for 16 steps
1166
    ;;              two bytes for gate, two bytes for accent
1167
    ;;            8 tracks per sequence
1168
    ;;            8 sequences
1169
 
1170
;; ==========================================================================
1171
 
1172
MBNET_BASE      EQU 0x600   ; used for SET_BSR
1173
 
1174
MBNET_STATE     EQU 0x600
1175
MBNET_RX_BUFFER_PTR_L   EQU 0x601
1176
MBNET_RX_BUFFER_PTR_H   EQU 0x602
1177
MBNET_MY_ID     EQU 0x603
1178
MBNET_MASTER_ID     EQU 0x604
1179
MBNET_SLAVE_ID      EQU 0x605
1180
MBNET_TOS       EQU 0x606
1181
MBNET_EID_L     EQU 0x607
1182
MBNET_EID_H     EQU 0x608
1183
MBNET_NODE_AVAIL    EQU 0x609
1184
MBNET_NODE_INCOMPATIBLE EQU 0x60a
1185
MBNET_TIMEOUT_CTR_L EQU 0x60b
1186
MBNET_TIMEOUT_CTR_H EQU 0x60c
1187
MBNET_LOOP_CTR      EQU 0x60d
1188
MBNET_RETRY_WAIT_CTR    EQU 0x60e
1189
MBNET_RETRY_NODE    EQU 0x60f
1190
 
1191
MBNET_RETRY_NODE_CTR_BEGIN EQU  0x610   ; ..0x617
1192
 
1193
MBNET_NODE_INFO_BEGIN   EQU 0x620   ; ..0x65f  ; (8*8 bytes)
1194
 
1195
MBNET_CLONE_BUFFER  EQU 0x700   ; 64 bytes, must be aligned, can be any free address since chip will be reset after cloning
1196
 
1197
 
1198
;; ==========================================================================
1199
;;  MIDI Voice records
1200
;; ==========================================================================
1201
SID_MVx_NUM     EQU 6   ; note: changing this value could lead to troubles in sid_ens.inc (ensemble structure...)
1202
SID_MVx_RECORD_LEN  EQU 0x18
1203
 
1204
SID_MVx_MIDI_CHANNEL    EQU 0x00    ; from ensemble
1205
SID_MVx_SPLIT_LOWER EQU 0x01    ; from ensemble
1206
SID_MVx_SPLIT_UPPER EQU 0x02    ; from ensemble
1207
SID_MVx_TRANSPOSE   EQU 0x03    ; from ensemble
1208
SID_MVx_PITCHBENDER EQU 0x04    ; only for Multi Engine ----- we will clear on patch changes from here, see sid_patch.inc
1209
SID_MVx_LAST_VOICE  EQU 0x05    ; only for Multi Engine
1210
SID_MVx_ARP_STATE   EQU 0x06    ; arp variables
1211
SID_MVx_ARP_DIV_CTR EQU 0x07
1212
SID_MVx_ARP_GL_CTR  EQU 0x08
1213
SID_MVx_ARP_NOTE_CTR    EQU 0x09
1214
SID_MVx_ARP_OCT_CTR EQU 0x0a
1215
 
1216
SID_MVx_WT_STACK_0  EQU 0x0b    ; special sorted note stack for WT sequencer (Arp note feature)
1217
SID_MVx_WT_STACK_1  EQU 0x0c
1218
SID_MVx_WT_STACK_2  EQU 0x0d
1219
SID_MVx_WT_STACK_3  EQU 0x0e
1220
 
1221
SID_MVx_NOTE_STACK_PTR  EQU 0x0f    ; the note stack
1222
SID_MVx_NOTE_STACK_0    EQU 0x10
1223
SID_MVx_NOTE_STACK_1    EQU 0x11
1224
SID_MVx_NOTE_STACK_2    EQU 0x12
1225
SID_MVx_NOTE_STACK_3    EQU 0x13
1226
SID_MVx_NOTE_STACK_4    EQU 0x14
1227
SID_MVx_NOTE_STACK_5    EQU 0x15
1228
SID_MVx_NOTE_STACK_6    EQU 0x16
1229
SID_MVx_NOTE_STACK_7    EQU 0x17
1230
 
1231
SID_MV1_BASE        EQU 0x660;..0x677
1232
SID_MV2_BASE        EQU 0x678;..0x68f
1233
SID_MV3_BASE        EQU 0x690;..0x6a7
1234
SID_MV4_BASE        EQU 0x6a8;..0x6bf
1235
SID_MV5_BASE        EQU 0x6c0;..0x6d7
1236
SID_MV6_BASE        EQU 0x6d8;..0x6ef
1237
 
1238
SID_MVx_NOTE_STACK_LEN  EQU SID_MVx_NOTE_STACK_7 - SID_MVx_NOTE_STACK_0 + 1
1239
 
1240
 
1241
;; ==========================================================================
1242
;;  Voice Queue
1243
;; ==========================================================================
1244
 
1245
SID_VOICE_QUEUE_0   EQU 0x6f0
1246
SID_VOICE_QUEUE_5   EQU 0x6f5
1247
SID_VOICE_QUEUE_LEN EQU SID_VOICE_QUEUE_5 - SID_VOICE_QUEUE_0 + 1
1248
 
1249
SID_VOICE_INSTR_0   EQU 0x6f6
1250
SID_VOICE_INSTR_5   EQU 0x6fb
1251
SID_VOICE_INSTR_OFFSET  EQU SID_VOICE_INSTR_0 - SID_VOICE_QUEUE_0
1252
 
1253
    ;; free: 0x6fc-0x6ff
1254
 
1255
;; ==========================================================================
1256
 
1257
;; patch buffer of the MBSID engine
1258
SID_PATCH_BUFFER    EQU 0x700   ; ..0x8ff
1259
 
1260
;; shadowed patch buffer of the MBSID engine (used in sid_se.inc for non-destructive modulations)
1261
SID_PATCH_BUFFER_SHADOW EQU 0x900   ; ..0xbff
1262
;; note: if some memory is required, 0xa80-0xaff could be used, because the wavetable only needs to exist once
1263
 
1264
;; patch buffer of the MBSID engine, which is edited with the CS
1265
SID_EDIT_BUFFER     EQU 0xb00   ; ..0xcff