Subversion Repositories svn.mios

Rev

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

Rev Author Line No. Line
44 tk 1
; $Id: cs_menu_p2r_r2p.inc 1102 2012-12-30 20:39:10Z tk $
1 tk 2
;
3
; SID Control Surface Menu Parameter Copy Functions
4
;
5
; ==========================================================================
6
;
7
;  Copyright 1998-2007 Thorsten Klose (tk@midibox.org)
8
;  Licensed for personal non-commercial use only.
9
;  All other rights reserved.
10
;
11
; ==========================================================================
12
 
13
; ==========================================================================
14
; ==========================================================================
15
;  refered by cs_menu_tables.inc
16
; ==========================================================================
17
; ==========================================================================
18
 
19
; ==========================================================================
20
;  All supported R2PP2R_* indices
21
; ==========================================================================
22
R2PP2R_NOP		EQU	0x00
23
 
24
R2PP2R_PAR8		EQU	0x01
25
R2PP2R_PAR16		EQU	0x02
26
 
27
R2PP2R_VAR		EQU	0x03
28
R2PP2R_VAR_SID		EQU	0x04
29
R2PP2R_VAR_OSC		EQU	0x05
30
R2PP2R_VAR_SIDLR	EQU	0x06
31
R2PP2R_VAR_CALI		EQU	0x07
32
R2PP2R_SAVE_NAME	EQU	0x08
33
R2PP2R_EDIT_SEQ		EQU	0x09
34
 
35
R2PP2R_Vx		EQU	0x0a
36
R2PP2R_Vx_4U		EQU	0x0b
37
R2PP2R_Vx_4L		EQU	0x0c
38
R2PP2R_Vx_PMD		EQU	0x0d
362 tk 39
R2PP2R_Vx_PM3		EQU	0x0e
40
R2PP2R_Vx_GSA		EQU	0x0f
41
R2PP2R_Vx_12		EQU	0x10
42
R2PP2R_Vx_WAV		EQU	0x11
43
R2PP2R_Vx_S_R		EQU	0x12
44
R2PP2R_Vx_ARP_ON	EQU	0x13
45
R2PP2R_Vx_ARP_DIR	EQU	0x14
46
R2PP2R_Vx_ARP_SOR	EQU	0x15
47
R2PP2R_Vx_ARP_HLD	EQU	0x16
679 tk 48
R2PP2R_Vx_ARP_SNC_ESY	EQU	0x17
362 tk 49
R2PP2R_Vx_ARP_CAC	EQU	0x18
50
R2PP2R_Vx_ARP_GLN	EQU	0x19
51
R2PP2R_Vx_ARP_RNG	EQU	0x1a
52
R2PP2R_Vx_ARP_SPD	EQU	0x1b
53
R2PP2R_Vx_ARP_ONE	EQU	0x1c
1 tk 54
 
362 tk 55
R2PP2R_M_Vx_PHASE	EQU	0x1d
56
R2PP2R_M_Vx_POL		EQU	0x1e
57
R2PP2R_BM_Vx_LEG	EQU	0x1f
58
R2PP2R_M_Vx_WTO		EQU	0x20
59
R2PP2R_BM_Vx_SUK	EQU	0x21
60
R2PP2R_M_Vx_VAS		EQU	0x22
61
R2PP2R_M_D_Vx_ASG	EQU	0x23
1 tk 62
 
362 tk 63
R2PP2R_B_Vx_MODE	EQU	0x24
64
R2PP2R_B_Vx_SEQ_SPD	EQU	0x25
65
R2PP2R_B_Vx_SEQ_S16	EQU	0x26
1 tk 66
 
362 tk 67
R2PP2R_D_Vx_VAS		EQU	0x27
1 tk 68
 
362 tk 69
R2PP2R_Fx_CHN		EQU	0x28
70
R2PP2R_Fx_CUTOFF	EQU	0x29
71
R2PP2R_Fx_RESON		EQU	0x2a
72
R2PP2R_Fx_KTR		EQU	0x2b
73
R2PP2R_Fx_MOD		EQU	0x2c
74
R2PP2R_Fx_EXT		EQU	0x2d
75
R2PP2R_Fx_3OF		EQU	0x2e
76
R2PP2R_Fx_FIP		EQU	0x2f
1 tk 77
 
362 tk 78
R2PP2R_LFOx		EQU	0x30
79
R2PP2R_LFOx_WAV		EQU	0x31
80
R2PP2R_LFOx_SNC		EQU	0x32
81
R2PP2R_LFOx_SNC_M	EQU	0x33
82
R2PP2R_LFOx_ONE		EQU	0x34
83
R2PP2R_LFOx_CSN		EQU	0x35
1 tk 84
 
362 tk 85
R2PP2R_ENVx		EQU	0x36
86
R2PP2R_ENVx_LPB		EQU	0x37
87
R2PP2R_ENVx_LPE		EQU	0x38
88
R2PP2R_ENVx_CSN		EQU	0x39
89
R2PP2R_ENVx_CAS		EQU	0x3a
1 tk 90
 
362 tk 91
R2PP2R_MODx		EQU	0x3b
92
R2PP2R_MODx_SRC		EQU	0x3c
93
R2PP2R_MODx_OP		EQU	0x3d
94
R2PP2R_MODx_INV1	EQU	0x3e
95
R2PP2R_MODx_INV2	EQU	0x3f
96
R2PP2R_MODx_Nx		EQU	0x40
1 tk 97
 
362 tk 98
R2PP2R_TRGx_Nx		EQU	0x41
1 tk 99
 
362 tk 100
R2PP2R_CHN		EQU	0x42
101
R2PP2R_BNK		EQU	0x43
102
R2PP2R_PAT		EQU	0x44
103
R2PP2R_B0		EQU	0x45
104
R2PP2R_B1		EQU	0x46
105
R2PP2R_B2		EQU	0x47
1 tk 106
 
362 tk 107
R2PP2R_CLK_BPM		EQU	0x48
108
R2PP2R_CLK_SLAVE	EQU	0x49
1102 tk 109
R2PP2R_CLK_OUT		EQU	0x4a
1 tk 110
 
1102 tk 111
R2PP2R_KNB_VALUE	EQU	0x4b
112
R2PP2R_KNB_P		EQU	0x4c
113
R2PP2R_KNB_ASG		EQU	0x4d
1 tk 114
 
1102 tk 115
R2PP2R_EXT_VALUE	EQU	0x4e
116
R2PP2R_EXT_SWITCH	EQU	0x4f
1 tk 117
 
1102 tk 118
R2PP2R_WTx_PAR		EQU	0x50
119
R2PP2R_WTx_SID		EQU	0x51
120
R2PP2R_WTx_SPD		EQU	0x52
121
R2PP2R_WTx_B6		EQU	0x53
122
R2PP2R_WTx_B7		EQU	0x54
123
R2PP2R_WTx_POS		EQU	0x55
124
R2PP2R_WTx_LOP		EQU	0x56
1 tk 125
 
1102 tk 126
R2PP2R_WTE_PAR		EQU	0x57
127
R2PP2R_WT_VAL		EQU	0x58
1 tk 128
 
1102 tk 129
R2PP2R_B_SEQ_VAL	EQU	0x59
1 tk 130
 
1102 tk 131
R2PP2R_ENSx_VAL		EQU	0x5a
132
R2PP2R_ENSxIx_VAL	EQU	0x5b
133
R2PP2R_ENSx_X2A		EQU	0x5c
134
R2PP2R_ENSx_RESERVED	EQU	0x5d
135
R2PP2R_ENSx_MONO	EQU	0x5e
136
R2PP2R_ENSx_FILLOG	EQU	0x5f
137
R2PP2R_ENSx_DOR		EQU	0x60
138
R2PP2R_ENSx_SPV		EQU	0x61
139
R2PP2R_ENSx_EXTINV	EQU	0x62
1 tk 140
 
1102 tk 141
R2PP2R_303_CUTOFF	EQU	0x63
142
R2PP2R_303_DEP		EQU	0x64
143
R2PP2R_303_DEC		EQU	0x65
1 tk 144
 
145
 
146
	;; help macro
147
R2PP2R_TARGET MACRO p2r_func, r2p_func
148
	bra	p2r_func
149
	bra	r2p_func
150
	ENDM
151
 
152
; ==========================================================================
153
;  The P2R handler
154
;; IN: R2PP2R_xxx ID in WREG
155
; ==========================================================================
156
CS_MENU_P2R_Handler
157
	mullw	4
158
	rgoto	CS_MENU_P2R_Handler_Jmp
159
 
160
; ==========================================================================
161
;  The R2P handler
162
;; IN: R2PP2R_xxx ID in WREG
163
; ==========================================================================
164
CS_MENU_R2P_Handler
165
	mullw	4
166
	movlw	2
167
	addwf	PRODL, F
168
 
169
CS_MENU_P2R_Handler_Jmp
170
	call	CS_MENU_P2RR2P_GetIndex_2bytes	; special variant of MIOS_HLP_GetIndex_2bytes which allows to add 16bit values (PROD[LH])
171
	R2PP2R_TARGET	CS_MENU_P2R_NOP, CS_MENU_R2P_NOP
172
 
173
	R2PP2R_TARGET	CS_MENU_P2R_PAR8, CS_MENU_R2P_PAR8
174
	R2PP2R_TARGET	CS_MENU_P2R_PAR16, CS_MENU_R2P_PAR16
175
 
176
	R2PP2R_TARGET	CS_MENU_P2R_VAR, CS_MENU_R2P_VAR
177
	R2PP2R_TARGET	CS_MENU_P2R_VAR_SID, CS_MENU_R2P_VAR_SID
178
	R2PP2R_TARGET	CS_MENU_P2R_VAR_OSC, CS_MENU_R2P_VAR_OSC
179
	R2PP2R_TARGET	CS_MENU_P2R_VAR_SIDLR, CS_MENU_R2P_VAR_SIDLR
180
	R2PP2R_TARGET	CS_MENU_P2R_VAR_CALI, CS_MENU_R2P_VAR_CALI
181
	R2PP2R_TARGET	CS_MENU_P2R_SAVE_NAME, CS_MENU_R2P_SAVE_NAME
182
	R2PP2R_TARGET	CS_MENU_P2R_EDIT_SEQ, CS_MENU_R2P_EDIT_SEQ
183
 
184
	R2PP2R_TARGET	CS_MENU_P2R_Vx, CS_MENU_R2P_Vx
185
	R2PP2R_TARGET	CS_MENU_P2R_Vx_4U, CS_MENU_R2P_Vx_4U
186
	R2PP2R_TARGET	CS_MENU_P2R_Vx_4L, CS_MENU_R2P_Vx_4L
187
	R2PP2R_TARGET	CS_MENU_P2R_Vx_PMD,CS_MENU_R2P_Vx_PMD
362 tk 188
	R2PP2R_TARGET	CS_MENU_P2R_Vx_PM3,CS_MENU_R2P_Vx_PM3
1 tk 189
	R2PP2R_TARGET	CS_MENU_P2R_Vx_GSA,CS_MENU_R2P_Vx_GSA
190
	R2PP2R_TARGET	CS_MENU_P2R_Vx_12, CS_MENU_R2P_Vx_12
191
	R2PP2R_TARGET	CS_MENU_P2R_Vx_WAV, CS_MENU_R2P_Vx_WAV
192
	R2PP2R_TARGET	CS_MENU_P2R_Vx_S_R, CS_MENU_R2P_Vx_S_R
193
	R2PP2R_TARGET	CS_MENU_P2R_Vx_ARP_ON, CS_MENU_R2P_Vx_ARP_ON
194
	R2PP2R_TARGET	CS_MENU_P2R_Vx_ARP_DIR, CS_MENU_R2P_Vx_ARP_DIR
195
	R2PP2R_TARGET	CS_MENU_P2R_Vx_ARP_SOR, CS_MENU_R2P_Vx_ARP_SOR
196
	R2PP2R_TARGET	CS_MENU_P2R_Vx_ARP_HLD, CS_MENU_R2P_Vx_ARP_HLD
679 tk 197
	R2PP2R_TARGET	CS_MENU_P2R_Vx_ARP_SNC_ESY, CS_MENU_R2P_Vx_ARP_SNC_ESY
1 tk 198
	R2PP2R_TARGET	CS_MENU_P2R_Vx_ARP_CAC, CS_MENU_R2P_Vx_ARP_CAC
199
	R2PP2R_TARGET	CS_MENU_P2R_Vx_ARP_GLN, CS_MENU_R2P_Vx_ARP_GLN
200
	R2PP2R_TARGET	CS_MENU_P2R_Vx_ARP_RNG, CS_MENU_R2P_Vx_ARP_RNG
201
	R2PP2R_TARGET	CS_MENU_P2R_Vx_ARP_SPD, CS_MENU_R2P_Vx_ARP_SPD
202
	R2PP2R_TARGET	CS_MENU_P2R_Vx_ARP_ONE, CS_MENU_R2P_Vx_ARP_ONE
203
 
204
	R2PP2R_TARGET	CS_MENU_P2R_M_Vx_PHASE, CS_MENU_R2P_M_Vx_PHASE
205
	R2PP2R_TARGET	CS_MENU_P2R_M_Vx_POL, CS_MENU_R2P_M_Vx_POL
228 tk 206
	R2PP2R_TARGET	CS_MENU_P2R_BM_Vx_LEG, CS_MENU_R2P_BM_Vx_LEG
1 tk 207
	R2PP2R_TARGET	CS_MENU_P2R_M_Vx_WTO, CS_MENU_R2P_M_Vx_WTO
228 tk 208
	R2PP2R_TARGET	CS_MENU_P2R_BM_Vx_SUK, CS_MENU_R2P_BM_Vx_SUK
1 tk 209
	R2PP2R_TARGET	CS_MENU_P2R_M_Vx_VAS, CS_MENU_R2P_M_Vx_VAS
210
	R2PP2R_TARGET	CS_MENU_P2R_M_D_Vx_ASG, CS_MENU_R2P_M_D_Vx_ASG
211
 
212
	R2PP2R_TARGET	CS_MENU_P2R_B_Vx_MODE, CS_MENU_R2P_B_Vx_MODE
213
	R2PP2R_TARGET	CS_MENU_P2R_B_Vx_SEQ_SPD, CS_MENU_R2P_B_Vx_SEQ_SPD
214
	R2PP2R_TARGET	CS_MENU_P2R_B_Vx_SEQ_S16, CS_MENU_R2P_B_Vx_SEQ_S16
215
 
216
	R2PP2R_TARGET	CS_MENU_P2R_D_Vx_VAS, CS_MENU_R2P_D_Vx_VAS
217
 
218
	R2PP2R_TARGET	CS_MENU_P2R_Fx_CHN, CS_MENU_R2P_Fx_CHN
219
	R2PP2R_TARGET	CS_MENU_P2R_Fx_CUTOFF, CS_MENU_R2P_Fx_CUTOFF
220
	R2PP2R_TARGET	CS_MENU_P2R_Fx_RESON, CS_MENU_R2P_Fx_RESON
221
	R2PP2R_TARGET	CS_MENU_P2R_Fx_KTR, CS_MENU_R2P_Fx_KTR
222
	R2PP2R_TARGET	CS_MENU_P2R_Fx_MOD, CS_MENU_R2P_Fx_MOD
223
	R2PP2R_TARGET	CS_MENU_P2R_Fx_EXT, CS_MENU_R2P_Fx_EXT
224
	R2PP2R_TARGET	CS_MENU_P2R_Fx_3OF, CS_MENU_R2P_Fx_3OF
225
	R2PP2R_TARGET	CS_MENU_P2R_Fx_FIP, CS_MENU_R2P_Fx_FIP
226
 
227
	R2PP2R_TARGET	CS_MENU_P2R_LFOx, CS_MENU_R2P_LFOx
228
	R2PP2R_TARGET	CS_MENU_P2R_LFOx_WAV, CS_MENU_R2P_LFOx_WAV
229
	R2PP2R_TARGET	CS_MENU_P2R_LFOx_SNC, CS_MENU_R2P_LFOx_SNC
230
	R2PP2R_TARGET	CS_MENU_P2R_LFOx_SNC_M, CS_MENU_R2P_LFOx_SNC_M
231
	R2PP2R_TARGET	CS_MENU_P2R_LFOx_ONE, CS_MENU_R2P_LFOx_ONE
232
	R2PP2R_TARGET	CS_MENU_P2R_LFOx_CSN, CS_MENU_R2P_LFOx_CSN
233
 
234
	R2PP2R_TARGET	CS_MENU_P2R_ENVx, CS_MENU_R2P_ENVx
235
	R2PP2R_TARGET	CS_MENU_P2R_ENVx_LPB, CS_MENU_R2P_ENVx_LPB
236
	R2PP2R_TARGET	CS_MENU_P2R_ENVx_LPE, CS_MENU_R2P_ENVx_LPE
237
	R2PP2R_TARGET	CS_MENU_P2R_ENVx_CSN, CS_MENU_R2P_ENVx_CSN
228 tk 238
	R2PP2R_TARGET	CS_MENU_P2R_ENVx_CAS, CS_MENU_R2P_ENVx_CAS
1 tk 239
 
240
	R2PP2R_TARGET	CS_MENU_P2R_MODx, CS_MENU_R2P_MODx
241
	R2PP2R_TARGET	CS_MENU_P2R_MODx_SRC, CS_MENU_R2P_MODx_SRC
242
	R2PP2R_TARGET	CS_MENU_P2R_MODx_OP, CS_MENU_R2P_MODx_OP
243
	R2PP2R_TARGET	CS_MENU_P2R_MODx_INV1, CS_MENU_R2P_MODx_INV1
244
	R2PP2R_TARGET	CS_MENU_P2R_MODx_INV2, CS_MENU_R2P_MODx_INV2
245
	R2PP2R_TARGET	_CS_MENU_P2R_MODx_Nx, _CS_MENU_R2P_MODx_Nx
246
 
247
	R2PP2R_TARGET	_CS_MENU_P2R_TRGx_Nx, _CS_MENU_R2P_TRGx_Nx
248
 
249
	R2PP2R_TARGET	CS_MENU_P2R_CHN, CS_MENU_R2P_CHN
250
	R2PP2R_TARGET	CS_MENU_P2R_BNK, CS_MENU_R2P_BNK
251
	R2PP2R_TARGET	CS_MENU_P2R_PAT, CS_MENU_R2P_PAT
252
	R2PP2R_TARGET	CS_MENU_P2R_B0, CS_MENU_R2P_B0
253
	R2PP2R_TARGET	CS_MENU_P2R_B1, CS_MENU_R2P_B1
254
	R2PP2R_TARGET	CS_MENU_P2R_B2, CS_MENU_R2P_B2
255
 
256
	R2PP2R_TARGET	CS_MENU_P2R_CLK_BPM, CS_MENU_R2P_CLK_BPM
257
	R2PP2R_TARGET	CS_MENU_P2R_CLK_SLAVE, CS_MENU_R2P_CLK_SLAVE
1102 tk 258
	R2PP2R_TARGET	CS_MENU_P2R_CLK_OUT, CS_MENU_R2P_CLK_OUT
1 tk 259
 
260
	R2PP2R_TARGET	CS_MENU_P2R_KNB_VALUE, CS_MENU_R2P_KNB_VALUE
261
	R2PP2R_TARGET	CS_MENU_P2R_KNB_P, CS_MENU_R2P_KNB_P
262
	R2PP2R_TARGET	CS_MENU_P2R_KNB_ASG, CS_MENU_R2P_KNB_ASG
263
 
264
	R2PP2R_TARGET	CS_MENU_P2R_EXT_VALUE, CS_MENU_R2P_EXT_VALUE
265
	R2PP2R_TARGET	CS_MENU_P2R_EXT_SWITCH, CS_MENU_R2P_EXT_SWITCH
266
 
267
	R2PP2R_TARGET	CS_MENU_P2R_WTx_PAR, CS_MENU_R2P_WTx_PAR
268
	R2PP2R_TARGET	CS_MENU_P2R_WTx_SID, CS_MENU_R2P_WTx_SID
269
	R2PP2R_TARGET	CS_MENU_P2R_WTx_SPD, CS_MENU_R2P_WTx_SPD
270
	R2PP2R_TARGET	CS_MENU_P2R_WTx_B6, CS_MENU_R2P_WTx_B6
271
	R2PP2R_TARGET	CS_MENU_P2R_WTx_B7, CS_MENU_R2P_WTx_B7
272
	R2PP2R_TARGET	CS_MENU_P2R_WTx_POS, CS_MENU_R2P_WTx_POS
273
	R2PP2R_TARGET	CS_MENU_P2R_WTx_LOP, CS_MENU_R2P_WTx_LOP
274
 
275
	R2PP2R_TARGET	CS_MENU_P2R_WTE_PAR, CS_MENU_R2P_WTE_PAR
276
	R2PP2R_TARGET	CS_MENU_P2R_WT_VAL, CS_MENU_R2P_WT_VAL
277
 
278
	R2PP2R_TARGET	CS_MENU_P2R_B_SEQ_VAL, CS_MENU_R2P_B_SEQ_VAL
279
 
280
	R2PP2R_TARGET	CS_MENU_P2R_ENSx_VAL, CS_MENU_R2P_ENSx_VAL
281
	R2PP2R_TARGET	CS_MENU_P2R_ENSxIx_VAL, CS_MENU_R2P_ENSxIx_VAL
282
	R2PP2R_TARGET	CS_MENU_P2R_ENSx_X2A, CS_MENU_R2P_ENSx_X2A
283
	R2PP2R_TARGET	CS_MENU_P2R_ENSx_RESERVED, CS_MENU_R2P_ENSx_RESERVED
284
	R2PP2R_TARGET	CS_MENU_P2R_ENSx_MONO, CS_MENU_R2P_ENSx_MONO
340 tk 285
	R2PP2R_TARGET	CS_MENU_P2R_ENSx_FILLOG, CS_MENU_R2P_ENSx_FILLOG
286
	R2PP2R_TARGET	CS_MENU_P2R_ENSx_DOR, CS_MENU_R2P_ENSx_DOR
1 tk 287
	R2PP2R_TARGET	CS_MENU_P2R_ENSx_SPV, CS_MENU_R2P_ENSx_SPV
288
	R2PP2R_TARGET	CS_MENU_P2R_ENSx_EXTINV, CS_MENU_R2P_ENSx_EXTINV
289
 
290
	R2PP2R_TARGET	CS_MENU_P2R_303_CUTOFF, CS_MENU_R2P_303_CUTOFF
291
	R2PP2R_TARGET	CS_MENU_P2R_303_DEP, CS_MENU_R2P_303_DEP
292
	R2PP2R_TARGET	CS_MENU_P2R_303_DEC, CS_MENU_R2P_303_DEC
293
 
294
 
295
; --------------------------------------------------------------------------
296
; Macros used for passing parameter values to the selected SIDs
297
; --------------------------------------------------------------------------
298
CS_MENU_P2R_VX_SEND_MACRO MACRO
299
	;; dirty trick:	this call puts the address behind the instruction into the caller stack
300
	;; the address is visible in TOS[LHU] and will be taken by CS_MENU_P2R_Vx_Send to determine
301
	;; the function which should be called multiple times
302
	;; at the end a "pop" instruction will be executed, which turns the "call" into a "goto"!
303
	rcall	CS_MENU_P2R_Vx_Send
304
	ENDM
305
 
306
CS_MENU_P2R_FX_SEND_MACRO MACRO
307
	;; see comments for CS_MENU_P2R_VX_SEND_MACRO
308
	rcall	CS_MENU_P2R_Fx_Send
309
	ENDM
310
 
296 tk 311
CS_MENU_P2R_LFOX_SEND_MACRO MACRO
312
	;; see comments for CS_MENU_P2R_VX_SEND_MACRO
313
	rcall	CS_MENU_P2R_LFOx_Send
314
	ENDM
315
 
316
CS_MENU_P2R_ENVX_SEND_MACRO MACRO
317
	;; see comments for CS_MENU_P2R_VX_SEND_MACRO
327 tk 318
	rcall	CS_MENU_P2R_ENVx_Send
296 tk 319
	ENDM
320
 
321
 
1 tk 322
; --------------------------------------------------------------------------
323
CS_MENU_P2R_NOP
324
CS_MENU_R2P_NOP
325
	return
326
 
327
; --------------------------------------------------------------------------
328
CS_MENU_P2R_PAR8
329
	movff	CS_MENU_PARAMETER_L, INDF0
330
	goto	CS_MENU_P2R_Hlp_ParSend
331
 
332
CS_MENU_R2P_PAR8
333
	movf	INDF0, W
334
	goto	CS_MENU_R2P_SetPar
335
 
336
; --------------------------------------------------------------------------
337
CS_MENU_P2R_PAR16
338
	movff	CS_MENU_PARAMETER_L, POSTINC0
339
	movff	CS_MENU_PARAMETER_H, POSTDEC0
340
	goto	CS_MENU_P2R_Hlp_ParSend
341
 
342
CS_MENU_R2P_PAR16
343
	movff	POSTINC0, CS_MENU_PARAMETER_L
344
	movff	POSTDEC0, CS_MENU_PARAMETER_H
345
	return
346
 
347
; --------------------------------------------------------------------------
348
CS_MENU_P2R_VAR
349
	goto	CS_MENU_P2RR2P_SetVAR
350
 
351
CS_MENU_R2P_VAR
352
	call	CS_MENU_P2RR2P_GetVAR
353
	goto	CS_MENU_R2P_SetPar
354
 
355
; --------------------------------------------------------------------------
356
CS_MENU_P2R_VAR_SID
357
	;; set new SID number
358
	;; check if new SID available - if not, increment/decrement until an available one has been found
359
 
360
	;; store available flags in PRODL
361
	movff	MBNET_NODE_AVAIL, PRODL
362
 
363
	;; branch depending on current SID
364
	movf	CS_MENU_SID, W
365
	cpfsgt	CS_MENU_PARAMETER_L, ACCESS
366
	rgoto CS_MENU_P2R_VAR_SID_Dec
367
CS_MENU_P2R_VAR_SID_Inc
368
	movf	CS_MENU_PARAMETER_L, W
369
	call	MIOS_HLP_GetBitORMask
370
	andwf	PRODL, W
371
	bnz	CS_MENU_P2R_VAR_SID_Ok
372
	incf	CS_MENU_PARAMETER_L, W
373
	andlw	0x03
374
	movwf	CS_MENU_PARAMETER_L
375
	bnz	CS_MENU_P2R_VAR_SID
376
 
377
CS_MENU_P2R_VAR_SID_Old
378
	movf	CS_MENU_SID, W
379
	movwf	CS_MENU_PARAMETER_L
380
 	rgoto	CS_MENU_P2R_VAR_SID_Ok
381
 
382
CS_MENU_P2R_VAR_SID_Dec
383
	movf	CS_MENU_PARAMETER_L, W
384
	call	MIOS_HLP_GetBitORMask
385
	andwf	PRODL, W
386
	bnz	CS_MENU_P2R_VAR_SID_Ok
387
	decf	CS_MENU_PARAMETER_L, W
388
	andlw	0x03
389
	movwf	CS_MENU_PARAMETER_L
390
	xorlw	0x03
391
	bnz	CS_MENU_P2R_VAR_SID
392
	rgoto	CS_MENU_P2R_VAR_SID_Old
393
 
394
 
395
CS_MENU_P2R_VAR_SID_Ok
396
	movf	CS_MENU_PARAMETER_L, W
397
	call	MIOS_HLP_GetBitORMask
398
	iorlw	0xf0		; (for button pressed detection)
399
	movwf	CS_MENU_SELECTED_SID_FLAGS
400
	;; request edit buffer update
401
	bsf	CS_STAT2, CS_STAT2_EDIT_UPDATE_REQ
402
	return
403
 
404
CS_MENU_R2P_VAR_SID
405
	movf	CS_MENU_SID, W		; (already derived from CS_MENU_SELECTED_SID_FLAGS)
406
	rgoto	CS_MENU_R2P_SetPar
407
 
408
; --------------------------------------------------------------------------
409
CS_MENU_P2R_VAR_OSC
410
	movff	CS_MENU_PARAMETER_L, CS_MENU_SELECTED_OSC
411
	goto	CS_MENU_Hlp_UpdateOSCFlags	; update of "osc_flags" register
412
 
413
CS_MENU_R2P_VAR_OSC
414
	movf	CS_MENU_SELECTED_OSC, W
415
	rgoto	CS_MENU_R2P_SetPar
416
 
417
; --------------------------------------------------------------------------
418
CS_MENU_P2R_VAR_SIDLR
419
	;; 0: L, 1: R, 2: LR
420
	incf	CS_MENU_PARAMETER_L, W
421
	movwf	CS_MENU_SELECTED_SID_LR
422
	return
423
 
424
CS_MENU_R2P_VAR_SIDLR
425
	;; L: 0, R: 1, LR: 2
426
	decf	CS_MENU_SELECTED_SID_LR, W
427
	andlw	0x03
428
	rgoto	CS_MENU_R2P_SetPar
429
 
430
; --------------------------------------------------------------------------
431
CS_MENU_P2R_VAR_CALI
432
	call	CS_MENU_FSR0_ENS
433
	RCALL_IFSET CS_MENU_SELECTED_SID_LR, 0, ACCESS, CS_MENU_P2R_VAR_CALI_Sub
434
	movlw	4
435
	addwf	CS_MENU_PARAMETER_IX, F
436
	call	CS_MENU_FSR0_ENS
437
	RCALL_IFSET CS_MENU_SELECTED_SID_LR, 1, ACCESS, CS_MENU_P2R_VAR_CALI_Sub
438
	return
439
 
440
CS_MENU_P2R_VAR_CALI_Sub
441
	swapf	CS_MENU_PARAMETER_L, W	; 12bit -> 16bit
442
	andlw	0xf0
443
	movwf	POSTINC0
444
	swapf	CS_MENU_PARAMETER_L, W
445
	andlw	0x0f
446
	movwf	INDF0
447
	swapf	CS_MENU_PARAMETER_H, W
448
	andlw	0xf0
449
	iorwf	POSTDEC0, F
450
 
451
	;; forward 16bit parameter to master/slave
452
	call	CS_MENU_MS_SendEnsParameter
453
	incf	FSR0L, F
454
	goto	CS_MENU_MS_SendEnsParameter
455
 
456
 
457
CS_MENU_R2P_VAR_CALI
458
	call	CS_MENU_FSR0_ENS
459
	;; add offset 4 if left SID is not selected
460
	movlw	0x00
461
	btfss	CS_MENU_SELECTED_SID_LR, 0
462
	addlw 4
463
	addwf	FSR0L, F
464
	swapf	POSTINC0, W	; 16bit -> 12bit
465
	andlw	0x0f
466
	movwf	CS_MENU_PARAMETER_L
467
	swapf	INDF0, W
468
	andlw	0xf0
469
	iorwf	CS_MENU_PARAMETER_L, F
470
	swapf	INDF0, W
471
	andlw	0x0f
472
	movwf	CS_MENU_PARAMETER_H
473
	return
474
 
475
; --------------------------------------------------------------------------
476
CS_MENU_P2R_SAVE_NAME
477
	movf	CS_MENU_NAME_POS, W
478
	movff	CS_MENU_PARAMETER_L, PLUSW0
479
	return
480
 
481
CS_MENU_R2P_SAVE_NAME
482
	movf	CS_MENU_NAME_POS, W
483
	movf	PLUSW0, W
484
	rgoto	CS_MENU_R2P_SetPar
485
 
486
; --------------------------------------------------------------------------
487
CS_MENU_P2R_EDIT_SEQ
488
	;; if rotate function active: branch to special routine which is doing the rotation
489
	BRA_IFSET CS_STAT3, CS_STAT3_MODIFY_SEQ_ROTATE, ACCESS, CS_MENU_P2R_RotateSeqTrack
490
	rgoto	CS_MENU_P2R_VAR
491
 
492
CS_MENU_R2P_EDIT_SEQ
493
	;; nothing to do here if rotate function active
494
	btfsc	CS_STAT3, CS_STAT3_MODIFY_SEQ_ROTATE
495
	return
496
	rgoto	CS_MENU_R2P_VAR
497
 
498
; --------------------------------------------------------------------------
499
CS_MENU_P2R_Vx
500
	CS_MENU_P2R_VX_SEND_MACRO
501
	movff	CS_MENU_PARAMETER_L, INDF0
502
	rgoto	CS_MENU_P2R_Hlp_ParSend
503
 
504
CS_MENU_R2P_Vx
505
	rcall	CS_MENU_FSR0_Voice
506
	rgoto	CS_MENU_R2P_PAR8
507
 
508
; --------------------------------------------------------------------------
509
CS_MENU_P2R_Vx_4U
510
	CS_MENU_P2R_VX_SEND_MACRO
511
	movlw	0x0f
512
	andwf	INDF0, F
513
	swapf	CS_MENU_PARAMETER_L, W
514
	andlw	0xf0
515
	iorwf	INDF0, F
516
	rgoto	CS_MENU_P2R_Hlp_ParSend
517
 
518
CS_MENU_R2P_Vx_4U
519
	rcall	CS_MENU_FSR0_Voice
520
	swapf	INDF0, W
521
	andlw	0x0f
522
	rgoto	CS_MENU_R2P_SetPar
523
 
524
; --------------------------------------------------------------------------
525
CS_MENU_P2R_Vx_4L
526
	CS_MENU_P2R_VX_SEND_MACRO
527
	movlw	0xf0
528
	andwf	INDF0, F
529
	movf	CS_MENU_PARAMETER_L, W
530
	andlw	0x0f
531
	iorwf	INDF0, F
532
	rgoto	CS_MENU_P2R_Hlp_ParSend
533
 
534
CS_MENU_R2P_Vx_4L
535
	rcall	CS_MENU_FSR0_Voice
536
	movf	INDF0, W
537
	andlw	0x0f
538
	rgoto	CS_MENU_R2P_SetPar
539
 
540
; --------------------------------------------------------------------------
541
CS_MENU_P2R_Vx_PMD
542
	CS_MENU_P2R_VX_SEND_MACRO
543
	movlw	0xfc
544
	andwf	INDF0, F
545
	movf	CS_MENU_PARAMETER_L, W
546
	andlw	0x03
547
	iorwf	INDF0, F
548
	rgoto	CS_MENU_P2R_Hlp_ParSend
549
 
550
CS_MENU_R2P_Vx_PMD
551
	rcall	CS_MENU_FSR0_Voice
552
	movf	INDF0, W
553
	andlw	0x03
554
	rgoto	CS_MENU_R2P_SetPar
555
 
556
; --------------------------------------------------------------------------
362 tk 557
CS_MENU_P2R_Vx_PM3
558
	;; TODO: proper +/- handling
559
	rgoto	CS_MENU_P2R_Vx
560
 
561
CS_MENU_R2P_Vx_PM3
562
	;; TODO: proper +/- handling
563
	rgoto	CS_MENU_R2P_Vx
564
 
565
; --------------------------------------------------------------------------
1 tk 566
CS_MENU_P2R_Vx_GSA
567
	CS_MENU_P2R_VX_SEND_MACRO
568
	movlw	SID_I_V_FLAGS1_GSA
569
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
570
 
571
CS_MENU_R2P_Vx_GSA
572
	rcall	CS_MENU_FSR0_Voice
573
	movlw	SID_I_V_FLAGS1_GSA
574
	rgoto	CS_MENU_R2P_SetParFlag
575
 
576
; --------------------------------------------------------------------------
577
CS_MENU_P2R_Vx_12
578
	CS_MENU_P2R_VX_SEND_MACRO
579
	movff	CS_MENU_PARAMETER_L, INDF0	; send low byte
580
	rcall	CS_MENU_P2R_Hlp_ParSend
581
	movf	POSTINC0, W
582
	movff	CS_MENU_PARAMETER_H, INDF0	; send high byte
583
	rcall	CS_MENU_P2R_Hlp_ParSend
584
	movf	POSTDEC0, W
585
	return
586
 
587
CS_MENU_R2P_Vx_12
588
	rcall	CS_MENU_FSR0_Voice
589
	movff	POSTINC0, CS_MENU_PARAMETER_L
590
	movff	POSTDEC0, CS_MENU_PARAMETER_H
591
	return
592
 
593
; --------------------------------------------------------------------------
594
CS_MENU_P2R_Vx_WAV
595
	CS_MENU_P2R_VX_SEND_MACRO
596
	movlw	0xe0
597
	andwf	INDF0, F
598
 
599
	movf	CS_MENU_PARAMETER_L, W
600
	iorwf	INDF0, F
601
	movf	CS_MENU_PARAMETER_L, W
602
	skpnz
603
	bsf	INDF0, 4
604
	rgoto	CS_MENU_P2R_Hlp_ParSend
605
 
606
CS_MENU_R2P_Vx_WAV
607
	rcall	CS_MENU_FSR0_Voice
805 tk 608
#if DEFAULT_ENABLE_UPPER_WAVEFORMS == 0
1 tk 609
	movf	INDF0, W
610
	andlw	0x07
611
	btfsc	INDF0, 3
805 tk 612
	movlw	0x08
613
#else
614
	movf	INDF0, W
615
	andlw	0x0f
616
#endif
1 tk 617
	btfsc	INDF0, 4
805 tk 618
	movlw	0x00
1 tk 619
	rgoto	CS_MENU_R2P_SetPar
620
 
621
; --------------------------------------------------------------------------
622
CS_MENU_P2R_Vx_S_R
623
	CS_MENU_P2R_VX_SEND_MACRO
624
	movlw	0x1f
625
	andwf	INDF0, F
626
	swapf	CS_MENU_PARAMETER_L, W
627
	rlf	WREG, W
628
	andlw	0x60
629
	iorwf	INDF0, F
630
	rgoto	CS_MENU_P2R_Hlp_ParSend
631
 
632
CS_MENU_R2P_Vx_S_R
633
	rcall	CS_MENU_FSR0_Voice
634
	swapf	INDF0, W
635
	rrf	WREG, W
636
	andlw	0x03
637
	rgoto	CS_MENU_R2P_SetPar
638
 
639
; --------------------------------------------------------------------------
640
CS_MENU_P2R_Vx_ARP_ON
641
	CS_MENU_P2R_VX_SEND_MACRO
642
	movlw	SID_I_V_ARP_MODE_ENABLE
643
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
644
 
645
CS_MENU_R2P_Vx_ARP_ON
646
	rcall	CS_MENU_FSR0_Voice
647
	movlw	SID_I_V_ARP_MODE_ENABLE
648
	rgoto	CS_MENU_R2P_SetParFlag
649
 
650
; --------------------------------------------------------------------------
651
CS_MENU_P2R_Vx_ARP_DIR
652
	CS_MENU_P2R_VX_SEND_MACRO
653
	movlw	0xf1
654
	andwf	INDF0, F
655
	rlf	CS_MENU_PARAMETER_L, W
656
	andlw	0x0e
657
	iorwf	INDF0, F
658
	rgoto	CS_MENU_P2R_Hlp_ParSend
659
 
660
CS_MENU_R2P_Vx_ARP_DIR
661
	rcall	CS_MENU_FSR0_Voice
662
	rrf	INDF0, W
663
	andlw	0x07
664
	rgoto	CS_MENU_R2P_SetPar
665
 
666
; --------------------------------------------------------------------------
667
CS_MENU_P2R_Vx_ARP_SOR
668
	CS_MENU_P2R_VX_SEND_MACRO
669
	movlw	SID_I_V_ARP_MODE_SORTED
670
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
671
 
672
CS_MENU_R2P_Vx_ARP_SOR
673
	rcall	CS_MENU_FSR0_Voice
674
	movlw	SID_I_V_ARP_MODE_SORTED
675
	rgoto	CS_MENU_R2P_SetParFlag
676
 
677
; --------------------------------------------------------------------------
678
CS_MENU_P2R_Vx_ARP_HLD
679
	CS_MENU_P2R_VX_SEND_MACRO
680
	movlw	SID_I_V_ARP_MODE_HOLD
681
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
682
 
683
CS_MENU_R2P_Vx_ARP_HLD
684
	rcall	CS_MENU_FSR0_Voice
685
	movlw	SID_I_V_ARP_MODE_HOLD
686
	rgoto	CS_MENU_R2P_SetParFlag
687
 
688
; --------------------------------------------------------------------------
679 tk 689
CS_MENU_P2R_Vx_ARP_SNC_ESY
1 tk 690
	CS_MENU_P2R_VX_SEND_MACRO
679 tk 691
	movlw	SID_I_V_ARP_MODE_DIV_SYNC ; same as SID_I_V_ARP_SPEED_DIV_EASY_CHORD
1 tk 692
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
693
 
679 tk 694
CS_MENU_R2P_Vx_ARP_SNC_ESY
1 tk 695
	rcall	CS_MENU_FSR0_Voice
679 tk 696
	movlw	SID_I_V_ARP_MODE_DIV_SYNC ; same as SID_I_V_ARP_SPEED_DIV_EASY_CHORD
1 tk 697
	rgoto	CS_MENU_R2P_SetParFlag
698
 
699
; --------------------------------------------------------------------------
700
CS_MENU_P2R_Vx_ARP_CAC
701
	CS_MENU_P2R_VX_SEND_MACRO
702
	movlw	SID_I_V_ARP_MODE_CAC
703
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
704
 
705
CS_MENU_R2P_Vx_ARP_CAC
706
	rcall	CS_MENU_FSR0_Voice
707
	movlw	SID_I_V_ARP_MODE_CAC
708
	rgoto	CS_MENU_R2P_SetParFlag
709
 
710
; --------------------------------------------------------------------------
711
CS_MENU_P2R_Vx_ARP_GLN
712
	CS_MENU_P2R_VX_SEND_MACRO
713
	movlw	0xe0
714
	andwf	INDF0, F
715
	movf	CS_MENU_PARAMETER_L, W
716
	iorwf	INDF0, F
717
	rgoto	CS_MENU_P2R_Hlp_ParSend
718
 
719
CS_MENU_R2P_Vx_ARP_GLN
720
	rcall	CS_MENU_FSR0_Voice
721
	movf	INDF0, W
722
	andlw	0x1f
723
	rgoto	CS_MENU_R2P_SetPar
724
 
725
; --------------------------------------------------------------------------
726
CS_MENU_P2R_Vx_ARP_RNG
727
	CS_MENU_P2R_VX_SEND_MACRO
728
	movlw	0x1f
729
	andwf	INDF0, F
730
	swapf	CS_MENU_PARAMETER_L, W
731
	rlf	WREG, W
732
	andlw	0xe0
733
	iorwf	INDF0, F
734
	rgoto	CS_MENU_P2R_Hlp_ParSend
735
 
736
CS_MENU_R2P_Vx_ARP_RNG
737
	rcall	CS_MENU_FSR0_Voice
738
	swapf	INDF0, W
739
	rrf	WREG, W
740
	andlw	0x07
741
	rgoto	CS_MENU_R2P_SetPar
742
 
743
; --------------------------------------------------------------------------
744
CS_MENU_P2R_Vx_ARP_SPD
745
	CS_MENU_P2R_VX_SEND_MACRO
746
	movlw	0xc0
747
	andwf	INDF0, F
748
	movf	CS_MENU_PARAMETER_L, W
749
	andlw	0x3f
750
	iorwf	INDF0, F
751
	rgoto	CS_MENU_P2R_Hlp_ParSend
752
 
753
CS_MENU_R2P_Vx_ARP_SPD
754
	rcall	CS_MENU_FSR0_Voice
755
	movf	INDF0, W
756
	andlw	0x3f
757
	rgoto	CS_MENU_R2P_SetPar
758
 
759
; --------------------------------------------------------------------------
760
CS_MENU_P2R_Vx_ARP_ONE
761
	CS_MENU_P2R_VX_SEND_MACRO
762
	movlw	SID_I_V_ARP_SPEED_DIV_ONESHOT
763
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
764
 
765
CS_MENU_R2P_Vx_ARP_ONE
766
	rcall	CS_MENU_FSR0_Voice
767
	movlw	SID_I_V_ARP_SPEED_DIV_ONESHOT
768
	rgoto	CS_MENU_R2P_SetParFlag
769
 
770
; --------------------------------------------------------------------------
771
CS_MENU_P2R_M_Vx_PHASE
772
	CS_MENU_P2R_VX_SEND_MACRO
773
	movlw	SID_I_M_V_FLAGS2_PHASE
774
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
775
 
776
CS_MENU_R2P_M_Vx_PHASE
777
	rcall	CS_MENU_FSR0_Voice
778
	movlw	SID_I_M_V_FLAGS2_PHASE
779
	rgoto	CS_MENU_R2P_SetParFlag
780
 
781
; --------------------------------------------------------------------------
782
CS_MENU_P2R_M_Vx_POL
783
	CS_MENU_P2R_VX_SEND_MACRO
784
	movlw	SID_I_M_V_FLAGS2_POLY
785
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
786
 
787
CS_MENU_R2P_M_Vx_POL
788
	rcall	CS_MENU_FSR0_Voice
789
	movlw	SID_I_M_V_FLAGS2_POLY
790
	rgoto	CS_MENU_R2P_SetParFlag
791
 
792
; --------------------------------------------------------------------------
228 tk 793
CS_MENU_P2R_BM_Vx_LEG
1 tk 794
	CS_MENU_P2R_VX_SEND_MACRO
795
	movlw	SID_I_M_V_FLAGS2_LEGATO
796
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
797
 
228 tk 798
CS_MENU_R2P_BM_Vx_LEG
1 tk 799
	rcall	CS_MENU_FSR0_Voice
800
	movlw	SID_I_M_V_FLAGS2_LEGATO
801
	rgoto	CS_MENU_R2P_SetParFlag
802
 
803
; --------------------------------------------------------------------------
804
CS_MENU_P2R_M_Vx_WTO
805
	CS_MENU_P2R_VX_SEND_MACRO
806
	movlw	SID_I_M_V_FLAGS2_WT_ONLY
807
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
808
 
809
CS_MENU_R2P_M_Vx_WTO
810
	rcall	CS_MENU_FSR0_Voice
811
	movlw	SID_I_M_V_FLAGS2_WT_ONLY
812
	rgoto	CS_MENU_R2P_SetParFlag
813
 
814
; --------------------------------------------------------------------------
228 tk 815
CS_MENU_P2R_BM_Vx_SUK
1 tk 816
	CS_MENU_P2R_VX_SEND_MACRO
817
	movlw	SID_I_M_V_FLAGS2_SUS_KEY
818
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
819
 
228 tk 820
CS_MENU_R2P_BM_Vx_SUK
1 tk 821
	rcall	CS_MENU_FSR0_Voice
822
	movlw	SID_I_M_V_FLAGS2_SUS_KEY
823
	rgoto	CS_MENU_R2P_SetParFlag
824
 
825
; --------------------------------------------------------------------------
826
CS_MENU_P2R_M_Vx_VAS
827
	rcall	CS_MENU_P2R_Vx
828
	;; re-init exclusive voice assignments
829
	goto	CS_MENU_MS_VoiceReInit
830
 
831
CS_MENU_R2P_M_Vx_VAS
832
	rgoto	CS_MENU_R2P_Vx
833
 
834
; --------------------------------------------------------------------------
835
CS_MENU_P2R_M_D_Vx_ASG
836
	rcall	CS_MENU_P2R_Vx
837
	;; update shadow buffer (so that the old assignment has no effect anymore)
838
	goto	CS_MENU_MS_UpdateShadow
839
 
840
CS_MENU_R2P_M_D_Vx_ASG
841
	rgoto	CS_MENU_R2P_Vx
842
 
843
; --------------------------------------------------------------------------
844
CS_MENU_P2R_B_Vx_MODE
845
	CS_MENU_P2R_VX_SEND_MACRO
846
	;; ensure that Legato and SusKey always activated
847
	movlw	(1 << SID_I_B_V_FLAGS2_LEGATO) | (1 << SID_I_B_V_FLAGS2_SUS_KEY)
848
	iorwf	INDF0, F
849
	;; switch WTO flag
850
	movlw	SID_I_B_V_FLAGS2_WT_ONLY
851
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
852
 
853
CS_MENU_R2P_B_Vx_MODE
854
	rcall	CS_MENU_FSR0_Voice
855
	movlw	SID_I_B_V_FLAGS2_WT_ONLY
856
	rgoto	CS_MENU_R2P_SetParFlag
857
 
858
; --------------------------------------------------------------------------
859
CS_MENU_P2R_B_Vx_SEQ_SPD
860
	CS_MENU_P2R_VX_SEND_MACRO
861
	movlw	0xc0
862
	andwf	INDF0, F
863
	movf	CS_MENU_PARAMETER_L, W
864
	andlw	0x3f
865
	iorwf	INDF0, F
866
	rgoto	CS_MENU_P2R_Hlp_ParSend
867
 
868
CS_MENU_R2P_B_Vx_SEQ_SPD
869
	rcall	CS_MENU_FSR0_Voice
870
	movf	INDF0, W
871
	andlw	0x3f
872
	rgoto	CS_MENU_R2P_SetPar
873
 
874
; --------------------------------------------------------------------------
875
CS_MENU_P2R_B_Vx_SEQ_S16
876
	CS_MENU_P2R_VX_SEND_MACRO
877
	movlw	SID_I_V_SEQ_SYNC16
878
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
879
 
880
CS_MENU_R2P_B_Vx_SEQ_S16
881
	rcall	CS_MENU_FSR0_Voice
882
	movlw	SID_I_V_SEQ_SYNC16
883
	rgoto	CS_MENU_R2P_SetParFlag
884
 
885
; --------------------------------------------------------------------------
886
CS_MENU_P2R_D_Vx_VAS
887
	rcall	CS_MENU_P2R_Vx_4U
888
	;; re-init voice assignments
889
	goto	CS_MENU_MS_VoiceReInit
890
 
891
CS_MENU_R2P_D_Vx_VAS
892
	rgoto	CS_MENU_R2P_Vx_4U
893
 
894
; --------------------------------------------------------------------------
895
CS_MENU_P2R_Fx_CHN
896
	CS_MENU_P2R_FX_SEND_MACRO
897
	movlw	0xf8
898
	andwf	INDF0, F
899
	movf	CS_MENU_PARAMETER_L, W
900
	andlw	0x07
901
	iorwf	INDF0, F
902
	rgoto	CS_MENU_P2R_Hlp_ParSend
903
 
904
CS_MENU_R2P_Fx_CHN
905
	rcall	CS_MENU_FSR0_Filter
906
	movf	INDF0, W
907
	andlw	0x07
908
	rgoto	CS_MENU_R2P_SetPar
909
 
910
; --------------------------------------------------------------------------
911
CS_MENU_P2R_Fx_MOD
912
	CS_MENU_P2R_FX_SEND_MACRO
913
	movlw	0x8f
914
	andwf	INDF0, F
915
	swapf	CS_MENU_PARAMETER_L, W
916
	andlw	0x70
917
	iorwf	INDF0, F
918
	rgoto	CS_MENU_P2R_Hlp_ParSend
919
 
920
CS_MENU_R2P_Fx_MOD
921
	rcall	CS_MENU_FSR0_Filter
922
	swapf	INDF0, W
923
	andlw	0x07
924
	rgoto	CS_MENU_R2P_SetPar
925
 
926
; --------------------------------------------------------------------------
927
CS_MENU_P2R_Fx_CUTOFF
928
	CS_MENU_P2R_FX_SEND_MACRO
929
	movff	CS_MENU_PARAMETER_L, INDF0	; send low byte
930
	rcall	CS_MENU_P2R_Hlp_ParSend
931
	movf	POSTINC0, W
932
	movlw	0xf0				; send high byte
933
	andwf	INDF0, F
934
	movf	CS_MENU_PARAMETER_H, W
935
	iorwf	INDF0, F
936
	rcall	CS_MENU_P2R_Hlp_ParSend
937
	movf	POSTDEC0, W
938
	return
939
 
940
CS_MENU_R2P_Fx_CUTOFF
941
	rcall	CS_MENU_FSR0_Filter
942
	movff	POSTINC0, CS_MENU_PARAMETER_L
943
	movf	POSTDEC0, W
944
	andlw	0x0f
945
	movwf	CS_MENU_PARAMETER_H
946
	return
947
 
948
; --------------------------------------------------------------------------
949
CS_MENU_P2R_Fx_RESON
950
CS_MENU_P2R_Fx_KTR
951
	CS_MENU_P2R_FX_SEND_MACRO
952
	movf	CS_MENU_PARAMETER_L, W
953
	movwf	INDF0
954
	rgoto	CS_MENU_P2R_Hlp_ParSend
955
 
956
CS_MENU_R2P_Fx_RESON
957
CS_MENU_R2P_Fx_KTR
958
	rcall	CS_MENU_FSR0_Filter
959
	movff	INDF0, CS_MENU_PARAMETER_L
960
	clrf	CS_MENU_PARAMETER_H
961
	return
962
 
963
; --------------------------------------------------------------------------
964
CS_MENU_P2R_Fx_EXT
965
	CS_MENU_P2R_FX_SEND_MACRO
966
	movlw	3
967
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
968
 
969
CS_MENU_R2P_Fx_EXT
970
	rcall	CS_MENU_FSR0_Filter
971
	movlw	3
972
	rgoto	CS_MENU_R2P_SetParFlag
973
 
974
; --------------------------------------------------------------------------
975
CS_MENU_P2R_Fx_3OF
976
CS_MENU_P2R_Fx_FIP
977
	CS_MENU_P2R_FX_SEND_MACRO
978
	movlw	7
979
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
980
 
981
CS_MENU_R2P_Fx_3OF
982
CS_MENU_R2P_Fx_FIP
983
	rcall	CS_MENU_FSR0_Filter
984
	movlw	7
985
	rgoto	CS_MENU_R2P_SetParFlag
986
 
987
; --------------------------------------------------------------------------
988
CS_MENU_P2R_LFOx
296 tk 989
	CS_MENU_P2R_LFOX_SEND_MACRO
1 tk 990
	rgoto	CS_MENU_P2R_PAR8
991
 
992
CS_MENU_R2P_LFOx
993
	rcall	CS_MENU_FSR0_LFO
994
	rgoto	CS_MENU_R2P_PAR8
995
 
996
; --------------------------------------------------------------------------
997
CS_MENU_P2R_LFOx_WAV
296 tk 998
	CS_MENU_P2R_LFOX_SEND_MACRO
1 tk 999
	movlw	0x0e
1000
	andwf	INDF0, F
1001
 
1002
	decf	CS_MENU_PARAMETER_L, W
1003
	swapf	WREG, W
1004
	andlw	0xf0
1005
	iorwf	INDF0, F
1006
	movf	CS_MENU_PARAMETER_L, W
1007
	skpz
1008
	bsf	INDF0, 0
1009
	rgoto	CS_MENU_P2R_Hlp_ParSend
1010
 
1011
CS_MENU_R2P_LFOx_WAV
1012
	rcall	CS_MENU_FSR0_LFO
1013
	swapf	INDF0, W
1014
	andlw	0x0f
1015
	addlw	1
1016
	btfss	INDF0, 0
1017
	movlw 0x00
1018
	rgoto	CS_MENU_R2P_SetPar
1019
 
1020
; --------------------------------------------------------------------------
1021
CS_MENU_P2R_LFOx_SNC
296 tk 1022
	CS_MENU_P2R_LFOX_SEND_MACRO
1 tk 1023
	;; controlled from trigger matrix (Note On Event)
1024
	;; index already in CS_MENU_PARAMETER_IX, add LFO offset
1025
	movf	CS_MENU_SELECTED_LFO, W
1026
	addwf	CS_MENU_PARAMETER_IX, F
1027
	movff	CS_MENU_SELECTED_TRG, TMP5	; store current trigger number
1028
	clrf	CS_MENU_SELECTED_TRG; (Note On)
1029
	rcall	CS_MENU_P2R_TRGx_Nx
1030
	movff	TMP5, CS_MENU_SELECTED_TRG	; restore old trigger number
1031
	return
1032
 
1033
CS_MENU_R2P_LFOx_SNC
1034
	;; controlled from trigger matrix (Note On Event)
1035
	;; index already in CS_MENU_PARAMETER_IX, add LFO offset
1036
	movf	CS_MENU_SELECTED_LFO, W
1037
	addwf	CS_MENU_PARAMETER_IX, F
1038
	movff	CS_MENU_SELECTED_TRG, TMP5	; store current trigger number
1039
	clrf	CS_MENU_SELECTED_TRG; (Note On)
1040
	call	CS_MENU_R2P_TRGx_Nx
1041
	movff	TMP5, CS_MENU_SELECTED_TRG	; restore old trigger number
1042
	return
1043
 
1044
; --------------------------------------------------------------------------
1045
CS_MENU_P2R_LFOx_SNC_M
296 tk 1046
	CS_MENU_P2R_LFOX_SEND_MACRO
1 tk 1047
	movlw	SID_I_LFO_MODE_SYNC_M
1048
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
1049
 
1050
CS_MENU_R2P_LFOx_SNC_M
1051
	call	CS_MENU_FSR0_LFO
1052
	movlw	SID_I_LFO_MODE_SYNC_M
1053
	rgoto	CS_MENU_R2P_SetParFlag
1054
 
1055
; --------------------------------------------------------------------------
1056
CS_MENU_P2R_LFOx_ONE
296 tk 1057
	CS_MENU_P2R_LFOX_SEND_MACRO
1 tk 1058
	movlw	SID_I_LFO_MODE_ONESHOT
1059
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
1060
 
1061
CS_MENU_R2P_LFOx_ONE
1062
	call	CS_MENU_FSR0_LFO
1063
	movlw	SID_I_LFO_MODE_ONESHOT
1064
	rgoto	CS_MENU_R2P_SetParFlag
1065
 
1066
; --------------------------------------------------------------------------
1067
CS_MENU_P2R_LFOx_CSN
296 tk 1068
	CS_MENU_P2R_LFOX_SEND_MACRO
1 tk 1069
	movlw	SID_I_LFO_MODE_CLKSYNC
1070
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
1071
 
1072
CS_MENU_R2P_LFOx_CSN
1073
	call	CS_MENU_FSR0_LFO
1074
	movlw	SID_I_LFO_MODE_CLKSYNC
1075
	rgoto	CS_MENU_R2P_SetParFlag
1076
 
1077
; --------------------------------------------------------------------------
1078
CS_MENU_P2R_ENVx
296 tk 1079
	CS_MENU_P2R_ENVX_SEND_MACRO
1 tk 1080
	rgoto	CS_MENU_P2R_PAR8
1081
 
1082
CS_MENU_R2P_ENVx
1083
	call	CS_MENU_FSR0_ENV
1084
	rgoto	CS_MENU_R2P_PAR8
1085
 
1086
; --------------------------------------------------------------------------
1087
CS_MENU_P2R_ENVx_LPB
296 tk 1088
	CS_MENU_P2R_ENVX_SEND_MACRO
1 tk 1089
	movlw	0xf8
1090
	andwf	INDF0, F
1091
	movf	CS_MENU_PARAMETER_L, W
1092
	andlw	0x07
1093
	iorwf	INDF0, F
1094
	rgoto	CS_MENU_P2R_Hlp_ParSend
1095
 
1096
CS_MENU_R2P_ENVx_LPB
1097
	call	CS_MENU_FSR0_ENV
1098
	movf	INDF0, W
1099
	andlw	0x07
1100
	rgoto	CS_MENU_R2P_SetPar
1101
 
1102
; --------------------------------------------------------------------------
1103
CS_MENU_P2R_ENVx_LPE
228 tk 1104
CS_MENU_P2R_ENVx_CAS
296 tk 1105
	CS_MENU_P2R_ENVX_SEND_MACRO
1 tk 1106
	movlw	0x8f
1107
	andwf	INDF0, F
1108
	swapf	CS_MENU_PARAMETER_L, W
1109
	andlw	0x70
1110
	iorwf	INDF0, F
1111
	rgoto	CS_MENU_P2R_Hlp_ParSend
1112
 
1113
CS_MENU_R2P_ENVx_LPE
228 tk 1114
CS_MENU_R2P_ENVx_CAS
1 tk 1115
	call	CS_MENU_FSR0_ENV
1116
	swapf	INDF0, W
1117
	andlw	0x07
1118
	rgoto	CS_MENU_R2P_SetPar
1119
 
1120
; --------------------------------------------------------------------------
1121
CS_MENU_P2R_ENVx_CSN
296 tk 1122
	CS_MENU_P2R_ENVX_SEND_MACRO
1 tk 1123
	movlw	SID_I_ENV_MODE_CLKSYNC
1124
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
1125
 
1126
CS_MENU_R2P_ENVx_CSN
1127
	call	CS_MENU_FSR0_ENV
1128
	movlw	SID_I_ENV_MODE_CLKSYNC
1129
	rgoto	CS_MENU_R2P_SetParFlag
1130
 
1131
; --------------------------------------------------------------------------
1132
CS_MENU_P2R_MODx
1133
	call	CS_MENU_FSR0_MOD
1134
	rgoto	CS_MENU_P2R_PAR8
1135
 
1136
CS_MENU_R2P_MODx
1137
	call	CS_MENU_FSR0_MOD
1138
	rgoto	CS_MENU_R2P_PAR8
1139
 
1140
; --------------------------------------------------------------------------
1141
CS_MENU_P2R_MODx_SRC
1142
	call	CS_MENU_FSR0_MOD
1143
	movf	CS_MENU_PARAMETER_L, W
1144
	addlw	-SID_MOD_SRC_NUM-1
1145
	BRA_IFSET WREG, 7, ACCESS, CS_MENU_P2R_MODx_SRC_Norm
1146
	addlw	0x80
1147
	movwf	INDF0
1148
	rgoto	CS_MENU_P2R_Hlp_ParSend
1149
CS_MENU_P2R_MODx_SRC_Norm
1150
	rgoto	CS_MENU_P2R_PAR8
1151
 
1152
CS_MENU_R2P_MODx_SRC
1153
	call	CS_MENU_FSR0_MOD
1154
	movf	INDF0, W
1155
	btfsc	INDF0, 7
1156
	addlw -0x80+SID_MOD_SRC_NUM
1157
 
1158
	rgoto	CS_MENU_R2P_SetPar
1159
 
1160
; --------------------------------------------------------------------------
1161
CS_MENU_P2R_MODx_OP
1162
	call	CS_MENU_FSR0_MOD
1163
	movlw	0xf0
1164
	andwf	INDF0, F
1165
	movf	CS_MENU_PARAMETER_L, W
1166
	iorwf	INDF0, F
1167
	rgoto	CS_MENU_P2R_Hlp_ParSend
1168
 
1169
CS_MENU_R2P_MODx_OP
1170
	call	CS_MENU_FSR0_MOD
1171
	movf	INDF0, W
1172
	andlw	0x0f
1173
	rgoto	CS_MENU_R2P_SetPar
1174
 
1175
; --------------------------------------------------------------------------
1176
CS_MENU_P2R_MODx_INV1
1177
	call	CS_MENU_FSR0_MOD
1178
	movlw	6
1179
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
1180
 
1181
CS_MENU_R2P_MODx_INV1
1182
	call	CS_MENU_FSR0_MOD
1183
	movlw	6
1184
	rgoto	CS_MENU_R2P_SetParFlag
1185
 
1186
; --------------------------------------------------------------------------
1187
CS_MENU_P2R_MODx_INV2
1188
	call	CS_MENU_FSR0_MOD
1189
	movlw	7
1190
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
1191
 
1192
CS_MENU_R2P_MODx_INV2
1193
	call	CS_MENU_FSR0_MOD
1194
	movlw	7
1195
	rgoto	CS_MENU_R2P_SetParFlag
1196
 
1197
; --------------------------------------------------------------------------
1198
_CS_MENU_P2R_MODx_Nx
1199
	rgoto	CS_MENU_P2R_MODx_Nx	; link to final code (ensures that jumptable still works with rgoto branches)
1200
_CS_MENU_R2P_MODx_Nx
1201
	rgoto	CS_MENU_R2P_MODx_Nx	; link to final code (ensures that jumptable still works with rgoto branches)
1202
 
1203
; --------------------------------------------------------------------------
1204
_CS_MENU_P2R_TRGx_Nx
1205
	rgoto	CS_MENU_P2R_TRGx_Nx	; link to final code (ensures that jumptable still works with rgoto branches)
1206
_CS_MENU_R2P_TRGx_Nx
1207
	rgoto	CS_MENU_R2P_TRGx_Nx	; link to final code (ensures that jumptable still works with rgoto branches)
1208
 
1209
; --------------------------------------------------------------------------
1210
CS_MENU_P2R_CHN
1211
	;; update channel stored in ENS structure
1212
	rcall	CS_MENU_P2R_ENSxIx_VAL
1213
 
1214
	;; update channel stored in CS structure (only for first instrument)
1215
	movf	CS_MENU_SELECTED_INS, W
1216
	bnz	CS_MENU_P2R_CHN_End
1217
	lfsr	FSR1, CS_MENU_SID_M_CHN
1218
	movf	CS_MENU_SID, W
1219
	andlw	0x03
1220
	addwf	FSR1L, F
1221
	movff	CS_MENU_PARAMETER_L, INDF1
1222
CS_MENU_P2R_CHN_End
1223
	return
1224
 
1225
CS_MENU_R2P_CHN
1226
	rgoto	CS_MENU_R2P_ENSxIx_VAL
1227
 
1228
; --------------------------------------------------------------------------
1229
CS_MENU_P2R_BNK
1230
	;; update bank stored in ENS structure
1231
	rcall	CS_MENU_P2R_ENSx_VAL
1232
 
1233
	;; update bank stored in CS structure
1234
	call	CS_MENU_MS_GetSIDBank
1235
	movff	CS_MENU_PARAMETER_L, INDF1
1236
	rcall	CS_MENU_P2R_CFG_Hlp_PatchUpdate
1237
 
1238
	;; 	rgoto	CS_MENU_R2P_BNK
1239
 
1240
CS_MENU_R2P_BNK
1241
	rgoto	CS_MENU_R2P_ENSx_VAL
1242
 
1243
; --------------------------------------------------------------------------
1244
CS_MENU_P2R_PAT
1245
	;; update bank stored in ENS structure
1246
	rcall	CS_MENU_P2R_ENSx_VAL
1247
 
1248
	;; update bank stored in CS structure
1249
	call	CS_MENU_MS_GetSIDPatch
1250
	movff	CS_MENU_PARAMETER_L, INDF1
1251
	rcall	CS_MENU_P2R_CFG_Hlp_PatchUpdate
1252
	;; 	rgoto	CS_MENU_R2P_PAT
1253
 
1254
CS_MENU_R2P_PAT
1255
	rgoto	CS_MENU_R2P_ENSx_VAL
1256
 
1257
; --------------------------------------------------------------------------
1258
CS_MENU_P2R_B0
1259
	movlw	0
1260
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
1261
 
1262
CS_MENU_R2P_B0
1263
	movlw	0
1264
	rgoto	CS_MENU_R2P_SetParFlag
1265
 
1266
; --------------------------------------------------------------------------
1267
CS_MENU_P2R_B1
1268
	movlw	1
1269
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
1270
 
1271
CS_MENU_R2P_B1
1272
	movlw	1
1273
	rgoto	CS_MENU_R2P_SetParFlag
1274
 
1275
; --------------------------------------------------------------------------
1276
CS_MENU_P2R_B2
1277
	movlw	2
1278
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
1279
 
1280
CS_MENU_R2P_B2
1281
	movlw	2
1282
	rgoto	CS_MENU_R2P_SetParFlag
1283
 
1284
; --------------------------------------------------------------------------
1285
CS_MENU_P2R_CLK_BPM
1286
	call	CS_MENU_FSR0_ENS
1287
	movf	CS_MENU_PARAMETER_L, W
1288
	addlw	50
1289
	skpnc
1290
	movlw	255
1291
	movwf	INDF0
1292
	goto	CS_MENU_MS_SendEnsParameter
1293
 
1294
CS_MENU_R2P_CLK_BPM
1295
	call	CS_MENU_FSR0_ENS
1296
	movf	INDF0, W
1297
	addlw	-50
1298
	skpc
1299
	movlw	0
1300
	rgoto	CS_MENU_R2P_SetPar
1301
 
1302
; --------------------------------------------------------------------------
1303
CS_MENU_P2R_CLK_SLAVE
1304
	call	CS_MENU_FSR0_ENS
1305
	movlw	~((1 << SID_ENS_CTRL1_CLK_SLAVE) | (1 << SID_ENS_CTRL1_CLK_AUTO))
1306
	andwf	INDF0, F
1307
	btfsc	CS_MENU_PARAMETER_L, 0
1308
	bsf	INDF0, SID_ENS_CTRL1_CLK_SLAVE
1309
	btfsc	CS_MENU_PARAMETER_L, 1
1310
	bsf	INDF0, SID_ENS_CTRL1_CLK_AUTO
1311
	;; forward to master/slave
1312
	goto	CS_MENU_MS_SendEnsParameter
1313
 
1314
CS_MENU_R2P_CLK_SLAVE
1315
	call	CS_MENU_FSR0_ENS
1316
	movlw	0
1317
	btfsc	INDF0, SID_ENS_CTRL1_CLK_SLAVE
1318
	iorlw 0x01
1319
	btfsc	INDF0, SID_ENS_CTRL1_CLK_AUTO
1320
	iorlw 0x02
1321
	rgoto	CS_MENU_R2P_SetPar
1322
 
1323
; --------------------------------------------------------------------------
1102 tk 1324
CS_MENU_P2R_CLK_OUT
1325
	call	CS_MENU_FSR0_ENS
1326
	bcf	INDF0, SID_ENS_CTRL1_CLK_OUT
1327
	btfsc	CS_MENU_PARAMETER_L, 0
1328
	bsf	INDF0, SID_ENS_CTRL1_CLK_OUT
1329
	;; forward to master/slave
1330
	goto	CS_MENU_MS_SendEnsParameter
1331
 
1332
CS_MENU_R2P_CLK_OUT
1333
	call	CS_MENU_FSR0_ENS
1334
	movlw	0
1335
	btfsc	INDF0, SID_ENS_CTRL1_CLK_OUT
1336
	movlw 1
1337
	rgoto	CS_MENU_R2P_SetPar
1338
 
1339
; --------------------------------------------------------------------------
1 tk 1340
CS_MENU_P2R_KNB_VALUE
1341
	movf	CS_MENU_PARAMETER_IX, W
1342
	call	SID_KNOB_GetPtr
1343
	movf	FSR1L, W
1344
	addlw	SID_Ix_Px_VALUE
1345
	movwf	FSR0L
1346
	movf	FSR1H, W
1347
	addlw	HIGH(SID_EDIT_BUFFER)-HIGH(SID_PATCH_BUFFER)
1348
	movwf	FSR0H
1349
	movff	CS_MENU_PARAMETER_L, INDF0
1350
 
1351
	;; special sending routine knob values
1352
	goto	CS_MENU_MS_SendKnob
1353
 
1354
CS_MENU_R2P_KNB_VALUE
1355
	movf	CS_MENU_PARAMETER_IX, W
1356
	call	SID_KNOB_GetPtr
1357
	movlw	HIGH(SID_EDIT_BUFFER)-HIGH(SID_PATCH_BUFFER)
1358
	addwf	FSR1H, F
1359
	movlw	SID_Ix_Px_VALUE
1360
	movf	PLUSW1, W
1361
	rgoto	CS_MENU_R2P_SetPar
1362
 
1363
; --------------------------------------------------------------------------
1364
CS_MENU_P2R_KNB_P
1365
	call	CS_MENU_FSR0_Knob
1366
	rcall	CS_MENU_P2R_PAR8
1367
	;; update knob depending on new Min/Max boundary
1368
	goto	CS_MENU_MS_UpdateKnob
1369
 
1370
CS_MENU_R2P_KNB_P
1371
	call	CS_MENU_FSR0_Knob
1372
	rgoto	CS_MENU_R2P_PAR8
1373
 
1374
; --------------------------------------------------------------------------
1375
CS_MENU_P2R_KNB_ASG
1376
	call	CS_MENU_FSR0_Knob
1377
	rcall	CS_MENU_P2R_PAR8
1378
	;; update shadow buffer (so that the old assignment has no effect anymore)
1379
	goto	CS_MENU_MS_UpdateShadow
1380
 
1381
CS_MENU_R2P_KNB_ASG
1382
	call	CS_MENU_FSR0_Knob
1383
	rgoto	CS_MENU_R2P_PAR8
1384
 
1385
; --------------------------------------------------------------------------
1386
CS_MENU_P2R_EXT_VALUE
1387
	;; convert 12bit -> 16bit
1388
	swapf	CS_MENU_PARAMETER_H, W
1389
	andlw	0xf0
1390
	movwf	PRODH
1391
	swapf	CS_MENU_PARAMETER_L, W
1392
	andlw	0x0f
1393
	iorwf	PRODH, F
1394
	swapf	CS_MENU_PARAMETER_L, W
1395
	andlw	0xf0
1396
	movwf	PRODL
1397
 
1398
	movff	PRODL, INDF0		; send low byte
1399
	rcall	CS_MENU_P2R_Hlp_ParSend
1400
	movf	POSTINC0, W
1401
	movff	PRODH, INDF0		; send high byte
1402
	rcall	CS_MENU_P2R_Hlp_ParSend
1403
	movf	POSTDEC0, W
1404
	return
1405
 
1406
CS_MENU_R2P_EXT_VALUE
1407
	;; convert 16bit -> 12bit
1408
	movff	POSTINC0, PRODL
1409
	movff	POSTDEC0, PRODH
1410
 
1411
	swapf	PRODH, W
1412
	andlw	0x0f
1413
	movwf	CS_MENU_PARAMETER_H
1414
	swapf	PRODH, W
1415
	andlw	0xf0
1416
	movwf	CS_MENU_PARAMETER_L
1417
	swapf	PRODL, W
1418
	andlw	0x0f
1419
	iorwf	CS_MENU_PARAMETER_L, F
1420
	return
1421
 
1422
; --------------------------------------------------------------------------
1423
CS_MENU_P2R_EXT_SWITCH
1424
	;; change address to custom switch register
1425
	movlw	SID_Ix_CUSTOM_SW
1426
	movwf	FSR0L
1427
	;; turn on/off switch flag which is stored in CS_MENU_PARAMETER_IX
1428
	movf	CS_MENU_PARAMETER_IX, W
1429
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
1430
 
1431
CS_MENU_R2P_EXT_SWITCH
1432
	;; change address to custom switch register
1433
	movlw	SID_Ix_CUSTOM_SW
1434
	movwf	FSR0L
1435
	;; flag number in CS_MENU_PARAMETER_IX
1436
	movf	CS_MENU_PARAMETER_IX, W
1437
	rgoto	CS_MENU_R2P_SetParFlag
1438
 
1439
; --------------------------------------------------------------------------
1440
CS_MENU_P2R_WTx_PAR
1441
	call	CS_MENU_FSR0_WT
1442
	rcall	CS_MENU_P2R_PAR8
1443
	;; update shadow buffer (so that the old assignment has no effect anymore)
1444
	goto	CS_MENU_MS_UpdateShadow
1445
 
1446
CS_MENU_R2P_WTx_PAR
1447
	call	CS_MENU_FSR0_WT
1448
	rgoto	CS_MENU_R2P_PAR8
1449
 
1450
; --------------------------------------------------------------------------
1451
CS_MENU_P2R_WTx_SID
1452
	call	CS_MENU_FSR0_WT
1453
	bcf	INDF0, 6
1454
	bcf	INDF0, 7
1455
	btfsc	CS_MENU_PARAMETER_L, 0
1456
	bsf	INDF0, 6
1457
	btfsc	CS_MENU_PARAMETER_L, 1
1458
	bsf	INDF0, 7
1459
	rgoto	CS_MENU_P2R_Hlp_ParSend
1460
 
1461
CS_MENU_R2P_WTx_SID
1462
	call	CS_MENU_FSR0_WT
1463
	movlw	0x00
1464
	btfsc	INDF0, 6
1465
	movlw 0x01
1466
	btfsc	INDF0, 7
1467
	iorlw 0x02
1468
	rgoto	CS_MENU_R2P_SetPar
1469
 
1470
; --------------------------------------------------------------------------
1471
CS_MENU_P2R_WTx_SPD
1472
	call	CS_MENU_FSR0_WT
1473
	movlw	0xc0
1474
	andwf	INDF0, F
1475
	movf	CS_MENU_PARAMETER_L, W
1476
	andlw	0x3f
1477
	iorwf	INDF0, F
1478
	rgoto	CS_MENU_P2R_Hlp_ParSend
1479
 
1480
CS_MENU_R2P_WTx_SPD
1481
	call	CS_MENU_FSR0_WT
1482
	movf	INDF0, W
1483
	andlw	0x3f
1484
	rgoto	CS_MENU_R2P_SetPar
1485
 
1486
; --------------------------------------------------------------------------
1487
CS_MENU_P2R_WTx_B6
1488
	call	CS_MENU_FSR0_WT
1489
	movlw	6
1490
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
1491
 
1492
CS_MENU_R2P_WTx_B6
1493
	call	CS_MENU_FSR0_WT
1494
	movlw	6
1495
	rgoto	CS_MENU_R2P_SetParFlag
1496
 
1497
; --------------------------------------------------------------------------
1498
CS_MENU_P2R_WTx_B7
1499
	call	CS_MENU_FSR0_WT
1500
	movlw	7
1501
	rgoto	CS_MENU_P2R_Hlp_ParSendFlag
1502
 
1503
CS_MENU_R2P_WTx_B7
1504
	call	CS_MENU_FSR0_WT
1505
	movlw	7
1506
	rgoto	CS_MENU_R2P_SetParFlag
1507
 
1508
; --------------------------------------------------------------------------
1509
CS_MENU_P2R_WTx_POS
1510
	call	CS_MENU_FSR0_WT
1511
	movlw	0x80
1512
	andwf	INDF0, F
1513
	movf	CS_MENU_PARAMETER_L, W
1514
	andlw	0x7f
1515
	iorwf	INDF0, F
1516
	rgoto	CS_MENU_P2R_Hlp_ParSend
1517
 
1518
CS_MENU_R2P_WTx_POS
1519
	call	CS_MENU_FSR0_WT
1520
	movf	INDF0, W
1521
	andlw	0x7f
1522
	rgoto	CS_MENU_R2P_SetPar
1523
 
1524
 
1525
; --------------------------------------------------------------------------
1526
CS_MENU_P2R_WTx_LOP
1527
	call	CS_MENU_FSR0_WT
1528
	decf	CS_MENU_PARAMETER_L, W
1529
	andlw	0x7f
1530
	movf	CS_MENU_PARAMETER_L, F
1531
	skpnz
1532
	movlw	0x80
1533
	movwf	INDF0
1534
	rgoto	CS_MENU_P2R_Hlp_ParSend
1535
 
1536
CS_MENU_R2P_WTx_LOP
1537
	call	CS_MENU_FSR0_WT
1538
	incf	INDF0, W
1539
	btfsc	INDF0, 7
1540
	movlw 0x00
1541
	rgoto	CS_MENU_R2P_SetPar
1542
 
1543
 
1544
; --------------------------------------------------------------------------
1545
CS_MENU_P2R_WTE_PAR
1546
	rgoto	CS_MENU_P2R_Hlp_WTP
1547
 
1548
CS_MENU_R2P_WTE_PAR
1549
	call	CS_MENU_FSR0_WTPos
1550
	skpz
1551
	goto	CS_MENU_R2P_PAR8
1552
	rgoto	CS_MENU_R2P_SetPar
1553
 
1554
 
1555
; --------------------------------------------------------------------------
1556
CS_MENU_P2R_WT_VAL
1557
	rcall	CS_MENU_P2RR2P_GetVAR
1558
	bcf	INDF0, CS_STAT2_WT_DEC_VIEW
1559
	btfsc	CS_MENU_PARAMETER_L, 0
1560
	bsf	INDF0, CS_STAT2_WT_DEC_VIEW
1561
	return
1562
 
1563
CS_MENU_R2P_WT_VAL
1564
	rcall	CS_MENU_P2RR2P_GetVAR
1565
	movlw	0x00
1566
	btfsc	INDF0, CS_STAT2_WT_DEC_VIEW
1567
	movlw 0x01
1568
	rgoto	CS_MENU_R2P_SetPar
1569
 
1570
; --------------------------------------------------------------------------
1571
CS_MENU_P2R_B_SEQ_VAL
1572
	rgoto	CS_MENU_P2R_B_SEQ_VAL_Sub
1573
 
1574
 
1575
CS_MENU_R2P_B_SEQ_VAL
1576
	rgoto	CS_MENU_R2P_B_SEQ_VAL_Sub
1577
 
1578
; --------------------------------------------------------------------------
1579
CS_MENU_P2R_ENSx_VAL
1580
	call	CS_MENU_FSR0_ENS
1581
	movf	CS_MENU_PARAMETER_L, W
1582
	movwf	INDF0
1583
	goto	CS_MENU_MS_SendEnsParameter
1584
 
1585
CS_MENU_R2P_ENSx_VAL
1586
	call	CS_MENU_FSR0_ENS
1587
	movf	INDF0, W
1588
	rgoto	CS_MENU_R2P_SetPar
1589
 
1590
; --------------------------------------------------------------------------
1591
CS_MENU_P2R_ENSxIx_VAL
1592
	call	CS_MENU_FSR0_ENS_Ix
1593
	movf	CS_MENU_PARAMETER_L, W
1594
	movwf	INDF0
1595
	goto	CS_MENU_MS_SendEnsParameter
1596
 
1597
CS_MENU_R2P_ENSxIx_VAL
1598
	call	CS_MENU_FSR0_ENS_Ix
1599
	movf	INDF0, W
1600
	rgoto	CS_MENU_R2P_SetPar
1601
 
1602
; --------------------------------------------------------------------------
1603
CS_MENU_P2R_ENSx_X2A
1604
	call	CS_MENU_FSR0_ENS_CTRL2
1605
	movf	CS_MENU_PARAMETER_IX, W		; contains x2A flag
1606
	call	MIOS_HLP_GetBitORMask
1607
	BRA_IFSET CS_MENU_PARAMETER_L, 0, ACCESS, CS_MENU_P2R_ENSx_X2A_1
1608
CS_MENU_P2R_ENSx_X2A_0
1609
	xorlw	0xff
1610
	andwf	INDF0, F
1611
	rgoto	CS_MENU_P2R_ENSx_X2A_Cont
1612
CS_MENU_P2R_ENSx_X2A_1
1613
	iorwf	INDF0, F
1614
CS_MENU_P2R_ENSx_X2A_Cont
1615
	;; forward to master/slave
1616
	goto	CS_MENU_MS_SendEnsParameter
1617
 
1618
CS_MENU_R2P_ENSx_X2A
1619
	call	CS_MENU_FSR0_ENS_CTRL2
1620
	movf	CS_MENU_PARAMETER_IX, W		; contains x2A flag
1621
	call	MIOS_HLP_GetBitORMask
1622
	andwf	INDF0, W
1623
	skpz
1624
	movlw	0x01
1625
	rgoto	CS_MENU_R2P_SetPar
1626
 
1627
 
1628
; --------------------------------------------------------------------------
1629
CS_MENU_P2R_ENSx_RESERVED
1630
	return
1631
 
1632
CS_MENU_R2P_ENSx_RESERVED
1633
	return
1634
 
1635
; --------------------------------------------------------------------------
1636
CS_MENU_P2R_ENSx_MONO
1637
	call	CS_MENU_FSR0_ENS
1638
	bcf	INDF0, SID_ENS_CTRL1_MONO
1639
	btfsc	CS_MENU_PARAMETER_L, 0
1640
	bsf	INDF0, SID_ENS_CTRL1_MONO
1641
	;; forward to master/slave
1642
	goto	CS_MENU_MS_SendEnsParameter
1643
 
1644
CS_MENU_R2P_ENSx_MONO
1645
	call	CS_MENU_FSR0_ENS
1646
	movlw	0
1647
	btfsc	INDF0, SID_ENS_CTRL1_MONO
1648
	movlw 1
1649
	rgoto	CS_MENU_R2P_SetPar
1650
 
1651
 
1652
; --------------------------------------------------------------------------
340 tk 1653
CS_MENU_P2R_ENSx_FILLOG
1654
	call	CS_MENU_FSR0_ENS
1655
	bcf	INDF0, SID_ENS_CTRL1_FIL_LOG
1656
	btfsc	CS_MENU_PARAMETER_L, 0
1657
	bsf	INDF0, SID_ENS_CTRL1_FIL_LOG
1658
	;; forward to master/slave
1659
	goto	CS_MENU_MS_SendEnsParameter
1660
 
1661
CS_MENU_R2P_ENSx_FILLOG
1662
	call	CS_MENU_FSR0_ENS
1663
	movlw	0
1664
	btfsc	INDF0, SID_ENS_CTRL1_FIL_LOG
1665
	movlw 1
1666
	rgoto	CS_MENU_R2P_SetPar
1667
 
1668
 
1669
; --------------------------------------------------------------------------
1670
CS_MENU_P2R_ENSx_DOR
1671
	call	CS_MENU_FSR0_ENS
1672
	bcf	INDF0, SID_ENS_CTRL1_DOR
1673
	btfsc	CS_MENU_PARAMETER_L, 0
1674
	bsf	INDF0, SID_ENS_CTRL1_DOR
1675
	;; forward to master/slave
1676
	goto	CS_MENU_MS_SendEnsParameter
1677
 
1678
CS_MENU_R2P_ENSx_DOR
1679
	call	CS_MENU_FSR0_ENS
1680
	movlw	0
1681
	btfsc	INDF0, SID_ENS_CTRL1_DOR
1682
	movlw 1
1683
	rgoto	CS_MENU_R2P_SetPar
1684
 
1685
 
1686
; --------------------------------------------------------------------------
1 tk 1687
CS_MENU_P2R_ENSx_SPV
653 tk 1688
	;; don't touch value if master SID not selected
1689
	movf	CS_MENU_SID, W
1690
	bnz	CS_MENU_P2R_ENSx_SPV_NotM
1691
CS_MENU_P2R_ENSx_SPV_M
1 tk 1692
	call	CS_MENU_FSR0_ENS
1693
	movlw	0xf8
1694
	andwf	INDF0, F
1695
	movf	CS_MENU_PARAMETER_L, W
1696
	iorwf	INDF0, F
653 tk 1697
	;; forward to all master and slaves (will only take effect if CS_MENU_SID == 0)
1698
	call	CS_MENU_MS_SendEnsParameterToAll
1699
CS_MENU_P2R_ENSx_SPV_NotM
1700
	;; re-init voice assignments
1701
	goto	CS_MENU_MS_VoiceReInit
1 tk 1702
 
1703
CS_MENU_R2P_ENSx_SPV
1704
	call	CS_MENU_FSR0_ENS
1705
	movf	INDF0, W
1706
	andlw	0x07
1707
	rgoto	CS_MENU_R2P_SetPar
1708
 
1709
 
1710
; --------------------------------------------------------------------------
1711
CS_MENU_P2R_ENSx_EXTINV
1712
	rcall	CS_MENU_R2P_ENSx_EXTINV_GetAddr
1713
	movf	CS_MENU_PARAMETER_IX, W
1714
	call	MIOS_HLP_GetBitANDMask
1715
	andwf	INDF0, F
1716
	xorlw	0xff
1717
	movf	CS_MENU_PARAMETER_L, F
1718
	skpz
1719
	iorwf	INDF0, F
1720
	;; forward to master/slave
1721
	goto	CS_MENU_MS_SendEnsParameter
1722
 
1723
CS_MENU_R2P_ENSx_EXTINV
1724
	rcall	CS_MENU_R2P_ENSx_EXTINV_GetAddr
1725
	movf	CS_MENU_PARAMETER_IX, W
1726
	call	MIOS_HLP_GetBitORMask
1727
	andwf	INDF0, W
1728
	skpz
1729
	movlw	0x01
1730
	rgoto	CS_MENU_R2P_SetPar
1731
 
1732
CS_MENU_R2P_ENSx_EXTINV_GetAddr
1733
	call	CS_MENU_FSR0_ENS
1734
	movf	FSR0L, W	; (CS_MENU_PARAMETER_IX and FSR0L contain offset to bit instead of address)
1735
	andlw	0xf0
1736
	addlw	SID_ENSx_AOUT_INVERTED
1737
	movwf	FSR0L
1738
	return
1739
 
1740
; --------------------------------------------------------------------------
1741
CS_MENU_P2R_303_CUTOFF
1742
	CS_MENU_P2R_FX_SEND_MACRO
1743
	;; scaled by factor 32 (2^5)
1744
	movf	CS_MENU_PARAMETER_L, W
1745
	mullw	32
1746
	movff	PRODL, INDF0
1747
	rcall	CS_MENU_P2R_Hlp_ParSend		; send low byte
1748
	movf	POSTINC0, W
1749
 
1750
	movf	CS_MENU_PARAMETER_L, W
1751
	mullw	32
1752
	movlw	0xf0
1753
	andwf	INDF0, F
1754
	movf	PRODH, W
1755
	iorwf	INDF0, F
1756
	rcall	CS_MENU_P2R_Hlp_ParSend		; send high byte
1757
	movf	POSTDEC0, W
1758
	return
1759
 
1760
CS_MENU_R2P_303_CUTOFF
1761
	call	CS_MENU_FSR0_Filter
1762
	swapf	POSTINC0, W
1763
	rrf	WREG, W
1764
	andlw	0x07
1765
	movwf	CS_MENU_PARAMETER_L
1766
 
1767
	swapf	POSTDEC0, W
1768
	rrf	WREG, W
1769
	andlw	0x78
1770
	iorwf	CS_MENU_PARAMETER_L, F
1771
	clrf	CS_MENU_PARAMETER_H
1772
	return
1773
 
1774
 
1775
; --------------------------------------------------------------------------
1776
CS_MENU_P2R_303_DEP
1777
	;; 7bit -> 8bit (+0x80, positive range only)
1778
	call	CS_MENU_FSR0_ENV
1779
	movf	CS_MENU_PARAMETER_L, W
1780
	addlw	0x80
1781
	btfss	WREG, 7
1782
	movlw 0x80
1783
	movwf	INDF0
1784
	rgoto	CS_MENU_P2R_Hlp_ParSend
1785
 
1786
CS_MENU_R2P_303_DEP
1787
	;; 8bit -> 7bit (-0x80, positive range only)
1788
	call	CS_MENU_FSR0_ENV
1789
	movf	INDF0, W
1790
	addlw	-0x80
1791
	btfsc	WREG, 7
1792
	movlw 0x00
1793
	rgoto	CS_MENU_R2P_SetPar
1794
 
1795
 
1796
; --------------------------------------------------------------------------
1797
CS_MENU_P2R_303_DEC
1798
	;; scaled by two
1799
	call	CS_MENU_FSR0_ENV
1800
	clrc
1801
	rlf	CS_MENU_PARAMETER_L, W
1802
	movwf	INDF0
1803
	rgoto	CS_MENU_P2R_Hlp_ParSend
1804
 
1805
CS_MENU_R2P_303_DEC
1806
	call	CS_MENU_FSR0_ENV
1807
	clrc
1808
	rrf	INDF0, W
1809
	rgoto	CS_MENU_R2P_SetPar
1810
 
1811
 
1812
; ==========================================================================
1813
; ==========================================================================
1814
;  Help Functions
1815
; ==========================================================================
1816
; ==========================================================================
1817
 
1818
; --------------------------------------------------------------------------
1819
;; get variable (value in WREG, pointer in FSR0)
1820
CS_MENU_P2RR2P_GetVAR
1821
	clrf	FSR0H
1822
	bcf	FSR0L, 7
1823
	movf	INDF0, W
1824
	return
1825
 
1826
; --------------------------------------------------------------------------
1827
;; set variable
1828
CS_MENU_P2RR2P_SetVAR
1829
	rcall	CS_MENU_P2RR2P_GetVAR
1830
	movff	CS_MENU_PARAMETER_L, INDF0
1831
	return
1832
 
1833
; --------------------------------------------------------------------------
1834
;; set common value
1835
CS_MENU_R2P_SetPar
1836
	movwf	CS_MENU_PARAMETER_L
1837
	clrf	CS_MENU_PARAMETER_H
1838
	return
1839
 
1840
; --------------------------------------------------------------------------
1841
;; update patch (used on BNK and PAT changes)
1842
CS_MENU_P2R_CFG_Hlp_PatchUpdate
1843
	call	CS_MENU_MS_GetSIDPatch
1844
	bcf	INDF1, 7	; force save of patch/bank
1845
	movff	INDF1, CS_MENU_PARAMETER_L
1846
	goto	CS_MENU_PatchUpdateSingle
1847
 
1848
 
1849
; --------------------------------------------------------------------------
1850
;; set flag (address in FSR0)
1851
CS_MENU_R2P_SetParFlag
1852
	call	MIOS_HLP_GetBitORMask
1853
	andwf	INDF0, W
1854
	movlw	0
1855
	skpz
1856
	movlw	1
1857
	rgoto	CS_MENU_R2P_SetPar
1858
 
1859
; --------------------------------------------------------------------------
1860
;; rotate the selected sequencer track
1861
CS_MENU_P2R_RotateSeqTrack
1862
	;; pointer to 16bit entry -> FSR0
1863
	call	CS_MENU_FSR0_WTPos
1864
 
1865
	;; re-arrange order of 4 bytes for better handling
1866
	movff	POSTINC0, TMP1	; gate shift register (Step 1-8)
1867
	movff	POSTINC0, TMP3	; accent shift register (Step 1-8)
1868
	movff	POSTINC0, TMP2	; gate shift register (Step 9-16)
1869
	movff	INDF0, TMP4	; accent shift register (Step 9-16)
1870
	movlw	-3		; (switch back to initial offset)
1871
	addwf	FSR0L, F
1872
 
1873
	;; direction depends on incrementer
1874
	BRA_IFCLR CS_MENU_ENC_INCREMENTER, 7, ACCESS, CS_MENU_P2R_RotateSeqTrack_R
1875
CS_MENU_P2R_RotateSeqTrack_L
1876
	;; rotate gates and accent to the left (by using rrf - no programming error, bits are mirrored)
1877
	clrc
1878
	rrf	TMP2, F
1879
	rrf	TMP1, F
1880
	skpnc
1881
	bsf	TMP2, 7
1882
 
1883
	clrc
1884
	rrf	TMP4, F
1885
	rrf	TMP3, F
1886
	skpnc
1887
	bsf	TMP4, 7
1888
	rgoto	CS_MENU_P2R_RotateSeqTrack_End
1889
 
1890
CS_MENU_P2R_RotateSeqTrack_R
1891
	;; rotate gates and accent to the right (by using rlf - no programming error, bits are mirrored)
1892
	clrc
1893
	rlf	TMP1, F
1894
	rlf	TMP2, F
1895
	skpnc
1896
	bsf	TMP1, 0
1897
 
1898
	clrc
1899
	rlf	TMP3, F
1900
	rlf	TMP4, F
1901
	skpnc
1902
	bsf	TMP3, 0
1903
	;; 	rgoto	CS_MENU_P2R_RotateSeqTrack_End
1904
CS_MENU_P2R_RotateSeqTrack_End
1905
 
1906
	;; copy-back results
1907
	movff	TMP1, INDF0	; gate shift register (Step 1-8)
1908
	rcall	CS_MENU_P2R_Hlp_ParSend
1909
	movff	TMP3, PREINC0	; accent shift register (Step 1-8)
1910
	rcall	CS_MENU_P2R_Hlp_ParSend
1911
	movff	TMP2, PREINC0	; gate shift register (Step 9-16)
1912
	rcall	CS_MENU_P2R_Hlp_ParSend
1913
	movff	TMP4, PREINC0	; accent shift register (Step 9-16)
1914
	rgoto	CS_MENU_P2R_Hlp_ParSend
1915
 
1916
 
1917
; ==========================================================================
1918
;  Function to send a parameter to all selected SIDs
1919
;  expecting value in INDF0
1920
; ==========================================================================
1921
CS_MENU_P2R_Hlp_ParSend
1922
	goto	CS_MENU_MS_SendParameter
1923
 
1924
 
1925
; ==========================================================================
1926
;  Function to copy CS_MENU_PARAMETER_L[0] to a given flag
1927
;; modified parameter is sent to all selected SIDs
1928
;  expecting address in of register which should be modified in FSR0
1929
; ==========================================================================
1930
CS_MENU_P2R_Hlp_ParSendFlag
1931
	BRA_IFSET CS_MENU_PARAMETER_L, 0, ACCESS, CS_MENU_P2R_Hlp_ParSendFlag_1
1932
 
1933
CS_MENU_P2R_Hlp_ParSendFlag_0
1934
	call	MIOS_HLP_GetBitANDMask
1935
	andwf	INDF0, F
1936
	rgoto	CS_MENU_P2R_Hlp_ParSend
1937
 
1938
CS_MENU_P2R_Hlp_ParSendFlag_1
1939
	call	MIOS_HLP_GetBitORMask
1940
	iorwf	INDF0, F
1941
	rgoto	CS_MENU_P2R_Hlp_ParSend
1942
 
1943
 
1944
; ==========================================================================
1945
;  Function to execute P2R filter handlers for all selected SIDs
1946
;  expecting pointer to handler function in TOS[LHU] (!)
1947
; ==========================================================================
1948
CS_MENU_P2R_Fx_Send
1949
	;; save TOS[LHU] (the return pointer) in TBLPTR[LHU]
1950
	movff	TOSL, TBLPTRL
1951
	movff	TOSH, TBLPTRH
1952
	movff	TOSU, TBLPTRU
1953
 
1954
	;; branch depending on engine
1955
	movff	SID_EDIT_BUFFER + SID_Ix_ENGINE, WREG
1956
	BRA_IFSET WREG, 1, ACCESS, CS_MENU_P2R_Fx_Send_DM
1957
CS_MENU_P2R_Fx_Send_LB
1958
	BRA_IFSET WREG, 0, ACCESS, CS_MENU_P2R_Fx_Send_B
1959
 
1960
CS_MENU_P2R_Fx_Send_L
1961
	movlw	SID_Ix_L_S1F_BASE
1962
	addwf	FSR0L, F
1963
	RCALL_IFSET CS_MENU_SELECTED_SID_LR, 0, ACCESS, CS_MENU_P2R_CallSub
1964
	movlw	SID_Ix_L_S2F_BASE-SID_Ix_L_S1F_BASE
1965
	addwf	FSR0L, F
1966
	RCALL_IFSET CS_MENU_SELECTED_SID_LR, 1, ACCESS, CS_MENU_P2R_CallSub
1967
 
1968
	;; jump back to the previous caller!
1969
	pop
1970
	return
1971
 
1972
 
1973
CS_MENU_P2R_Fx_Send_B		; bassline engine
1974
	rgoto	CS_MENU_P2R_Fx_Send_L	; same as for lead engine
1975
 
1976
 
1977
CS_MENU_P2R_Fx_Send_DM
1978
	BRA_IFSET WREG, 0, ACCESS, CS_MENU_P2R_Fx_Send_M
1979
 
1980
CS_MENU_P2R_Fx_Send_D		; drum engine
1981
	;; (same as for multi engine)
1982
CS_MENU_P2R_Fx_Send_M		; multi engine
1983
	rgoto	CS_MENU_P2R_Fx_Send_L	; same as for lead engine
1984
 
1985
 
1986
; ==========================================================================
1987
;  Function to execute P2R voice handlers for all selected voices and SIDs
1988
;  expecting pointer to handler function in TOS[LHU] (!)
1989
; ==========================================================================
1990
CS_MENU_P2R_Vx_Send
1991
	;; save TOS[LHU] (the return pointer) in TBLPTR[LHU]
1992
	movff	TOSL, TBLPTRL
1993
	movff	TOSH, TBLPTRH
1994
	movff	TOSU, TBLPTRU
1995
 
1996
	;; branch depending on engine
1997
	movff	SID_EDIT_BUFFER + SID_Ix_ENGINE, WREG
1998
	BRA_IFSET WREG, 1, ACCESS, CS_MENU_P2R_Vx_Send_DM
1999
CS_MENU_P2R_Vx_Send_LB
2000
	BRA_IFSET WREG, 0, ACCESS, CS_MENU_P2R_Vx_Send_B
2001
 
2002
CS_MENU_P2R_Vx_Send_L		; lead engine
2003
	BRA_IFCLR CS_MENU_SELECTED_SID_LR, 0, ACCESS, CS_MENU_P2R_Vx_Send_L_SR
2004
CS_MENU_P2R_Vx_Send_L_SL
2005
	movlw	SID_Ix_L_S1V1_BASE
2006
	addwf	CS_MENU_PARAMETER_IX, W
2007
	movwf	FSR0L
2008
	RCALL_IFSET CS_MENU_SELECTED_OSC_FLAGS, 0, ACCESS, CS_MENU_P2R_CallSub
2009
	movlw	SID_Ix_L_S1V2_BASE-SID_Ix_L_S1V1_BASE
2010
	addwf	FSR0L, F
2011
	RCALL_IFSET CS_MENU_SELECTED_OSC_FLAGS, 1, ACCESS, CS_MENU_P2R_CallSub
2012
	movlw	SID_Ix_L_S1V3_BASE-SID_Ix_L_S1V2_BASE
2013
	addwf	FSR0L, F
2014
	RCALL_IFSET CS_MENU_SELECTED_OSC_FLAGS, 2, ACCESS, CS_MENU_P2R_CallSub
2015
CS_MENU_P2R_Vx_Send_L_SR
2016
	BRA_IFCLR CS_MENU_SELECTED_SID_LR, 1, ACCESS, CS_MENU_P2R_Vx_Send_L_End
2017
	movlw	SID_Ix_L_S2V1_BASE
2018
	addwf	CS_MENU_PARAMETER_IX, W
2019
	movwf	FSR0L
2020
	RCALL_IFSET CS_MENU_SELECTED_OSC_FLAGS, 0, ACCESS, CS_MENU_P2R_CallSub
2021
	movlw	SID_Ix_L_S2V2_BASE-SID_Ix_L_S2V1_BASE
2022
	addwf	FSR0L, F
2023
	RCALL_IFSET CS_MENU_SELECTED_OSC_FLAGS, 1, ACCESS, CS_MENU_P2R_CallSub
2024
	movlw	SID_Ix_L_S2V3_BASE-SID_Ix_L_S2V2_BASE
2025
	addwf	FSR0L, F
2026
	RCALL_IFSET CS_MENU_SELECTED_OSC_FLAGS, 2, ACCESS, CS_MENU_P2R_CallSub
2027
CS_MENU_P2R_Vx_Send_L_End
2028
	;; jump back to the previous caller!
2029
	pop
2030
	return
2031
 
2032
 
2033
CS_MENU_P2R_Vx_Send_B		; bassline engine
2034
	BRA_IFCLR CS_MENU_SELECTED_SID_LR, 0, ACCESS, CS_MENU_P2R_Vx_Send_B_SR
2035
CS_MENU_P2R_Vx_Send_B_SL
2036
	movlw	SID_Ix_B_S1V1_BASE
2037
	addwf	CS_MENU_PARAMETER_IX, W
2038
	movwf	FSR0L
2039
	rcall	CS_MENU_P2R_CallSub
2040
CS_MENU_P2R_Vx_Send_B_SR
2041
	BRA_IFCLR CS_MENU_SELECTED_SID_LR, 1, ACCESS, CS_MENU_P2R_Vx_Send_B_End
2042
	movlw	SID_Ix_B_S2V1_BASE
2043
	addwf	CS_MENU_PARAMETER_IX, W
2044
	movwf	FSR0L
2045
	rcall	CS_MENU_P2R_CallSub
2046
CS_MENU_P2R_Vx_Send_B_End
2047
	;; jump back to the previous caller!
2048
	pop
2049
	return
2050
 
2051
 
2052
CS_MENU_P2R_Vx_Send_DM
2053
	BRA_IFSET WREG, 0, ACCESS, CS_MENU_P2R_Vx_Send_M
2054
 
2055
CS_MENU_P2R_Vx_Send_D		; drum engine
2056
	;; (same as for multi engine)
2057
CS_MENU_P2R_Vx_Send_M		; multi engine
2058
	call	CS_MENU_FSR0_Voice
2059
	rcall	CS_MENU_P2R_CallSub
2060
 
2061
	;; jump back to the previous caller!
2062
	pop
2063
	return
2064
 
2065
 
2066
 
2067
CS_MENU_P2R_CallSub
2068
	;; copy TBLPTR[LHU] to TOS[LHU] and return
2069
	IRQ_DISABLE
2070
	push
2071
	movf	TBLPTRL, W
2072
	movwf	TOSL
2073
	movf	TBLPTRH, W
2074
	movwf	TOSH
2075
	movf	TBLPTRU, W
2076
	movwf	TOSU
2077
	IRQ_ENABLE
2078
	return
2079
 
2080
 
2081
; ==========================================================================
296 tk 2082
;  Function to execute P2R LFO handlers for all selected SIDs
2083
;  expecting pointer to handler function in TOS[LHU] (!)
2084
; ==========================================================================
2085
CS_MENU_P2R_LFOx_Send
2086
	;; save TOS[LHU] (the return pointer) in TBLPTR[LHU]
2087
	movff	TOSL, TBLPTRL
2088
	movff	TOSH, TBLPTRH
2089
	movff	TOSU, TBLPTRU
2090
 
2091
	;; branch depending on engine
2092
	movff	SID_EDIT_BUFFER + SID_Ix_ENGINE, WREG
2093
	BRA_IFSET WREG, 1, ACCESS, CS_MENU_P2R_LFOx_Send_DM
2094
CS_MENU_P2R_LFOx_Send_LB
2095
	BRA_IFSET WREG, 0, ACCESS, CS_MENU_P2R_LFOx_Send_B
2096
 
2097
CS_MENU_P2R_LFOx_Send_L
2098
	call	CS_MENU_FSR0_LFO
2099
	rcall	CS_MENU_P2R_CallSub
2100
 
2101
	;; jump back to the previous caller!
2102
	pop
2103
	return
2104
 
2105
 
2106
CS_MENU_P2R_LFOx_Send_B		; bassline engine
2107
	BRA_IFCLR CS_MENU_SELECTED_SID_LR, 0, ACCESS, CS_MENU_P2R_LFOx_Send_B_SR
2108
CS_MENU_P2R_LFOx_Send_B_SL
2109
	movlw	SID_Ix_B_S1V1_BASE
2110
	addwf	CS_MENU_PARAMETER_IX, W
2111
	movwf	FSR0L
2112
	movf	CS_MENU_SELECTED_LFO, W
2113
	andlw	0x01
2114
	mullw	SID_Ix_B_Vx_LFO2_MODE-SID_Ix_B_Vx_LFO1_MODE
2115
	movf	PRODL, W
2116
	addwf	FSR0L, F
2117
	rcall	CS_MENU_P2R_CallSub
2118
CS_MENU_P2R_LFOx_Send_B_SR
2119
	BRA_IFCLR CS_MENU_SELECTED_SID_LR, 1, ACCESS, CS_MENU_P2R_LFOx_Send_B_End
2120
	movlw	SID_Ix_B_S2V1_BASE
2121
	addwf	CS_MENU_PARAMETER_IX, W
2122
	movwf	FSR0L
2123
	movf	CS_MENU_SELECTED_LFO, W
2124
	andlw	0x01
2125
	mullw	SID_Ix_B_Vx_LFO2_MODE-SID_Ix_B_Vx_LFO1_MODE
2126
	movf	PRODL, W
2127
	addwf	FSR0L, F
2128
	rcall	CS_MENU_P2R_CallSub
2129
CS_MENU_P2R_LFOx_Send_B_End
2130
	;; jump back to the previous caller!
2131
	pop
2132
	return
2133
 
2134
 
2135
CS_MENU_P2R_LFOx_Send_DM
2136
	BRA_IFSET WREG, 0, ACCESS, CS_MENU_P2R_LFOx_Send_M
2137
 
2138
CS_MENU_P2R_LFOx_Send_D		; drum engine
2139
	;; (same as for multi engine)
2140
CS_MENU_P2R_LFOx_Send_M		; multi engine
2141
	rgoto	CS_MENU_P2R_LFOx_Send_L	; same as for lead engine
2142
 
2143
 
2144
; ==========================================================================
2145
;  Function to execute P2R ENV handlers for all selected SIDs
2146
;  expecting pointer to handler function in TOS[LHU] (!)
2147
; ==========================================================================
2148
CS_MENU_P2R_ENVx_Send
2149
	;; save TOS[LHU] (the return pointer) in TBLPTR[LHU]
2150
	movff	TOSL, TBLPTRL
2151
	movff	TOSH, TBLPTRH
2152
	movff	TOSU, TBLPTRU
2153
 
2154
	;; branch depending on engine
2155
	movff	SID_EDIT_BUFFER + SID_Ix_ENGINE, WREG
2156
	BRA_IFSET WREG, 1, ACCESS, CS_MENU_P2R_ENVx_Send_DM
2157
CS_MENU_P2R_ENVx_Send_LB
2158
	BRA_IFSET WREG, 0, ACCESS, CS_MENU_P2R_ENVx_Send_B
2159
 
2160
CS_MENU_P2R_ENVx_Send_L
2161
	call	CS_MENU_FSR0_ENV
2162
	rcall	CS_MENU_P2R_CallSub
2163
 
2164
	;; jump back to the previous caller!
2165
	pop
2166
	return
2167
 
2168
 
2169
CS_MENU_P2R_ENVx_Send_B		; bassline engine
2170
	BRA_IFCLR CS_MENU_SELECTED_SID_LR, 0, ACCESS, CS_MENU_P2R_ENVx_Send_B_SR
2171
CS_MENU_P2R_ENVx_Send_B_SL
2172
	movlw	SID_Ix_B_S1V1_BASE
2173
	addwf	CS_MENU_PARAMETER_IX, W
2174
	movwf	FSR0L
2175
	rcall	CS_MENU_P2R_CallSub
2176
CS_MENU_P2R_ENVx_Send_B_SR
2177
	BRA_IFCLR CS_MENU_SELECTED_SID_LR, 1, ACCESS, CS_MENU_P2R_ENVx_Send_B_End
2178
	movlw	SID_Ix_B_S2V1_BASE
2179
	addwf	CS_MENU_PARAMETER_IX, W
2180
	movwf	FSR0L
2181
	rcall	CS_MENU_P2R_CallSub
2182
CS_MENU_P2R_ENVx_Send_B_End
2183
	;; jump back to the previous caller!
2184
	pop
2185
	return
2186
 
2187
 
2188
CS_MENU_P2R_ENVx_Send_DM
2189
	BRA_IFSET WREG, 0, ACCESS, CS_MENU_P2R_ENVx_Send_M
2190
 
2191
CS_MENU_P2R_ENVx_Send_D		; drum engine
2192
	;; (same as for multi engine)
2193
CS_MENU_P2R_ENVx_Send_M		; multi engine
2194
	rgoto	CS_MENU_P2R_ENVx_Send_L	; same as for lead engine
2195
 
2196
 
2197
 
2198
; ==========================================================================
1 tk 2199
;  special variant of MIOS_HLP_GetIndex_2bytes which allows to add 16bit values (PROD[LH])
2200
; ==========================================================================
2201
CS_MENU_P2RR2P_GetIndex_2bytes
2202
	movf	PRODL, W
2203
        addwf   TOSL, F
2204
	movf	PRODH, W
2205
	addwfc	TOSH, F
2206
#if PIC_DERIVATIVE_CODE_SIZE > 0x10000
2207
	movlw	0x00
2208
	addwfc	TOSU, F
2209
#endif
2210
        return
2211
 
2212
 
2213
; ==========================================================================
2214
;  memory intensive P2R/R2P routines for MOD and TRG nodes located here to
2215
;  ensure that the rgoto based jumptable still accesses code within 1024 byte range
2216
; ==========================================================================
2217
CS_MENU_P2R_MODx_Nx
2218
	;; NOTE: also used by CS_MENU_BUTTON_M_* routines to toggle modulation matrix node
2219
	;; bit number stored in CS_MENU_PARAMETER_IX
2220
 
2221
	;; get pointer to modulation nodes
2222
	call	CS_MENU_FSR0_MOD_TARG_L
2223
 
2224
	;; determine masks
2225
	movf	CS_MENU_PARAMETER_IX, W
2226
	call	MIOS_HLP_GetBitORMask
2227
	movwf	TMP1
2228
	movf	CS_MENU_PARAMETER_IX, W
2229
	call	MIOS_HLP_GetBitANDMask
2230
	movwf	TMP2
2231
 
2232
	;; copy bits to SID_Ix_MODx_TARG_[LR]
2233
	;; 	movf	TMP2, W
2234
	andwf	INDF0, F
2235
	movf	TMP1, W
2236
	btfsc	CS_MENU_PARAMETER_L, 0
2237
	iorwf	INDF0, F
2238
	rcall	CS_MENU_P2R_Hlp_ParSend
2239
 
2240
	movf	TMP2, W
2241
	andwf	PREINC0, F
2242
	movf	TMP1, W
2243
	btfsc	CS_MENU_PARAMETER_L, 1
2244
	iorwf	INDF0, F
2245
	rgoto	CS_MENU_P2R_Hlp_ParSend
2246
 
2247
 
2248
CS_MENU_R2P_MODx_Nx
2249
	;; NOTE: also used by CS_MENU_BUTTON_M_* routines to toggle modulation matrix node
2250
	;; bit number stored in CS_MENU_PARAMETER_IX
2251
 
2252
	;; get pointer to modulation nodes
2253
	call	CS_MENU_FSR0_MOD_TARG_L
2254
 
2255
	;; determine mask
2256
	movf	CS_MENU_PARAMETER_IX, W
2257
	call	MIOS_HLP_GetBitORMask
2258
	movwf	TMP1
2259
 
2260
	;; build up CS_MENU_PARAMETER_[LH]
2261
	clrf	CS_MENU_PARAMETER_L
2262
	clrf	CS_MENU_PARAMETER_H
2263
 
2264
	movf	POSTINC0, W
2265
	andwf	TMP1, W
2266
	skpz
2267
	bsf	CS_MENU_PARAMETER_L, 0
2268
 
2269
	movf	POSTDEC0, W
2270
	andwf	TMP1, W
2271
	skpz
2272
	bsf	CS_MENU_PARAMETER_L, 1
2273
 
2274
	return
2275
 
2276
CS_MENU_P2R_TRGx_Nx
2277
	;; also used by CS_MENU_P2R_LFOx_SNC
2278
	;; don't overwrite TMP5 !!!
2279
 
2280
	;; get pointer to trigger target
2281
	call	CS_MENU_FSR0_TRG
2282
 
2283
	;; determine masks
2284
	movf	CS_MENU_PARAMETER_IX, W
2285
	call	MIOS_HLP_GetBitORMask
2286
	movwf	TMP1
2287
	movf	CS_MENU_PARAMETER_IX, W
2288
	call	MIOS_HLP_GetBitANDMask
2289
	movwf	TMP2
2290
 
2291
	;; copy bit to SID_Ix_TRG_xxx_BASE
2292
	;; 	movf	TMP2, W
2293
	andwf	INDF0, F
2294
	movf	TMP1, W
2295
	btfsc	CS_MENU_PARAMETER_L, 0
2296
	iorwf	INDF0, F
2297
	rgoto	CS_MENU_P2R_Hlp_ParSend
2298
 
2299
 
2300
CS_MENU_R2P_TRGx_Nx
2301
	;; also used by CS_MENU_R2P_LFOx_SNC
2302
	;; don't overwrite TMP5 !!!
2303
 
2304
	;; get pointer to trigger target
2305
	call	CS_MENU_FSR0_TRG
2306
 
2307
	;; determine mask
2308
	movf	CS_MENU_PARAMETER_IX, W
2309
	call	MIOS_HLP_GetBitORMask
2310
	movwf	TMP1
2311
 
2312
	;; build up CS_MENU_PARAMETER_[LH]
2313
	clrf	CS_MENU_PARAMETER_L
2314
	clrf	CS_MENU_PARAMETER_H
2315
 
2316
	movf	INDF0, W
2317
	andwf	TMP1, W
2318
	skpz
2319
	bsf	CS_MENU_PARAMETER_L, 0
2320
 
2321
	return
2322
 
2323
; ==========================================================================
2324
;  Function to set a WT parameter
2325
; ==========================================================================
2326
CS_MENU_P2R_Hlp_WTP
2327
	;; store parameter
2328
	call	CS_MENU_FSR0_WTPos		; sets ZERO flag if value outside range
1003 tk 2329
#if 0
2330
	;; changes outside common range required due to W+16 function... :-/
1 tk 2331
	skpnz
2332
	return
1003 tk 2333
#endif
1 tk 2334
 
2335
	movf	CS_MENU_WT_POS, W
2336
	xorlw	0x80
2337
	bz	CS_MENU_P2R_Hlp_WTP_All
2338
CS_MENU_P2R_Hlp_WTP_Single
2339
	movff	CS_MENU_PARAMETER_L, INDF0
2340
	rgoto	CS_MENU_P2R_Hlp_ParSend
2341
 
2342
CS_MENU_P2R_Hlp_WTP_All
2343
	;; modify all entries from begin to end position
2344
	clrf	CS_MENU_WT_POS
2345
CS_MENU_P2R_Hlp_WTP_AllLoop
2346
	call	CS_MENU_FSR0_WTPos		; sets ZERO flag if value outside range
2347
	bz	CS_MENU_P2R_Hlp_WTP_AllLoopBreak
2348
	movff	CS_MENU_PARAMETER_L, INDF0
2349
	rcall	CS_MENU_P2R_Hlp_ParSend
2350
	incf	CS_MENU_WT_POS, F
2351
	BRA_IFCLR CS_MENU_WT_POS, 7, ACCESS, CS_MENU_P2R_Hlp_WTP_AllLoop
2352
CS_MENU_P2R_Hlp_WTP_AllLoopBreak
2353
	;; set back CS_MENU_WT_POS to original value (0x80)
2354
	movlw	0x80
2355
	movwf	CS_MENU_WT_POS
2356
	return
2357
 
2358
; ==========================================================================
2359
;  Function to set a SEQ parameter
2360
; ==========================================================================
2361
CS_MENU_P2R_B_SEQ_VAL_Sub
2362
	;; if WTPOS >= 0x10, modify all entries
2363
	movf	CS_MENU_WT_POS, W
2364
	andlw	0xf0
2365
	bz	CS_MENU_P2R_B_SEQ_VAL_Sub_Single
2366
 
2367
CS_MENU_P2R_B_SEQ_VAL_Sub_All
2368
	clrf	CS_MENU_WT_POS		; used as loop counter - 16 steps
2369
CS_MENU_P2R_B_SEQ_VAL_Sub_All_Lp
2370
	rcall	CS_MENU_P2R_B_SEQ_VAL_Sub_Single
2371
	incf	CS_MENU_WT_POS, F
2372
	BRA_IFCLR CS_MENU_WT_POS, 4, ACCESS, CS_MENU_P2R_B_SEQ_VAL_Sub_All_Lp
2373
 
2374
	;; CS_MENU_WT_POS is 0x10 again - thats fine!
2375
	return
2376
 
2377
 
2378
CS_MENU_P2R_B_SEQ_VAL_Sub_Single
2379
	;; determine pointer to parameter depending on CS_MENU_WT_SEQ/CS_MENU_WT_POS
2380
	call	CS_MENU_FSR0_WTPos
2381
 
2382
	;; branch depending on parameter part:
2383
	;; 0 = note, 1 = Octave, 2 = Slide/Gate, 3 = Accent, 4 = Parameter
2384
	movf	CS_MENU_PARAMETER_IX, W
2385
	bz	CS_MENU_P2R_B_SEQ_VAL_Note
2386
	addlw	-1
2387
	bz	CS_MENU_P2R_B_SEQ_VAL_Oct
2388
	addlw	-1
2389
	bz	CS_MENU_P2R_B_SEQ_VAL_S_G
2390
	addlw	-1
2391
	bz	CS_MENU_P2R_B_SEQ_VAL_Acc
2392
	rgoto	CS_MENU_P2R_B_SEQ_VAL_Par
2393
CS_MENU_P2R_B_SEQ_VAL_Note
2394
	movlw	0xf0
2395
	andwf	INDF0, F
2396
	movf	CS_MENU_PARAMETER_L, W
2397
	andlw	0x0f
2398
	iorwf	INDF0, F
2399
	rgoto	CS_MENU_P2R_Hlp_ParSend
2400
 
2401
CS_MENU_P2R_B_SEQ_VAL_Oct
2402
	movlw	0xcf
2403
	andwf	INDF0, F
2404
	swapf	CS_MENU_PARAMETER_L, W
2405
	andlw	0x30
2406
	btfsc	WREG, 5	; for mapping: 0=0, 1=1, 2=3, 3=2
2407
	btg	WREG, 4
2408
	iorwf	INDF0, F
2409
	rgoto	CS_MENU_P2R_Hlp_ParSend
2410
 
2411
CS_MENU_P2R_B_SEQ_VAL_S_G
2412
	movlw	0x3f
2413
	andwf	INDF0, F
2414
	swapf	CS_MENU_PARAMETER_L, W
2415
	rlf	WREG, W
2416
	rlf	WREG, W
2417
	andlw	0xc0
2418
	iorwf	INDF0, F
2419
	rgoto	CS_MENU_P2R_Hlp_ParSend
2420
 
2421
CS_MENU_P2R_B_SEQ_VAL_Acc
2422
	;; accent is located in upper bank
2423
	movlw	0x80
2424
	addwf	FSR0L, F
2425
 
2426
	bcf	INDF0, 7
2427
	btfsc	CS_MENU_PARAMETER_L, 0
2428
	bsf	INDF0, 7
2429
	rgoto	CS_MENU_P2R_Hlp_ParSend
2430
 
2431
CS_MENU_P2R_B_SEQ_VAL_Par
2432
	;; 7bit parameter is located in upper bank
2433
	movlw	0x80
2434
	addwf	FSR0L, F
2435
 
2436
	movlw	0x80
2437
	andwf	INDF0, F
2438
	movf	CS_MENU_PARAMETER_L, W
2439
	andlw	0x7f
2440
	iorwf	INDF0, F
2441
	rgoto	CS_MENU_P2R_Hlp_ParSend
2442
 
2443
 
2444
 
2445
CS_MENU_R2P_B_SEQ_VAL_Sub
2446
	;; determine pointer to parameter depending on CS_MENU_WT_SEQ/CS_MENU_WT_POS
2447
	call	CS_MENU_FSR0_WTPos
2448
 
2449
	;; branch depending on parameter part:
2450
	;; 0 = note, 1 = Octave, 2 = Slide/Gate, 3 = Accent, 4 = Parameter
2451
	movf	CS_MENU_PARAMETER_IX, W
2452
	bz	CS_MENU_R2P_B_SEQ_VAL_Note
2453
	addlw	-1
2454
	bz	CS_MENU_R2P_B_SEQ_VAL_Oct
2455
	addlw	-1
2456
	bz	CS_MENU_R2P_B_SEQ_VAL_S_G
2457
	addlw	-1
2458
	bz	CS_MENU_R2P_B_SEQ_VAL_Acc
2459
	rgoto	CS_MENU_R2P_B_SEQ_VAL_Par
2460
CS_MENU_R2P_B_SEQ_VAL_Note
2461
	movf	INDF0, W
2462
	andlw	0x0f
2463
	rgoto	CS_MENU_R2P_SetPar
2464
 
2465
CS_MENU_R2P_B_SEQ_VAL_Oct
2466
	swapf	INDF0, W
2467
	andlw	0x03
2468
	btfsc	WREG, 1	; for mapping: 0=0, 1=1, 2=3, 3=2
2469
	btg	WREG, 0
2470
	rgoto	CS_MENU_R2P_SetPar
2471
 
2472
CS_MENU_R2P_B_SEQ_VAL_S_G
2473
	swapf	INDF0, W
2474
	rrf	WREG, W
2475
	rrf	WREG, W
2476
	andlw	0x03
2477
	rgoto	CS_MENU_R2P_SetPar
2478
 
2479
CS_MENU_R2P_B_SEQ_VAL_Acc
2480
	;; accent is located in upper bank
2481
	movlw	0x80
2482
	addwf	FSR0L, F
2483
	movlw	0x00
2484
	btfsc	INDF0, 7
2485
	movlw 0x01
2486
	rgoto	CS_MENU_R2P_SetPar
2487
 
2488
CS_MENU_R2P_B_SEQ_VAL_Par
2489
	;; 7bit parameter is located in upper bank
2490
	movlw	0x80
2491
	addwf	FSR0L, F
2492
	movf	INDF0, W
2493
	andlw	0x7f
2494
	rgoto	CS_MENU_R2P_SetPar