Subversion Repositories svn.mios

Rev

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

Rev Author Line No. Line
44 tk 1
; $Id: cs_menu_exec.inc 44 2008-01-30 21:39:30Z tk $
1 tk 2
;
3
; SID Control Surface Menu Execute 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
; ==========================================================================
16
;  refered by cs_menu_tables.inc
17
; ==========================================================================
18
; ==========================================================================
19
 
20
; ==========================================================================
21
;  All supported EXEC_* indices
22
; ==========================================================================
23
EXEC_NOP	EQU	0x00
24
EXEC_MENU	EQU	0x01
25
EXEC_MENU_SAVE	EQU	0x02
26
EXEC_MENU_SAVE_ENS EQU	0x03
27
EXEC_SELPAR	EQU	0x04
28
EXEC_TOGPAR	EQU	0x05
29
EXEC_RND	EQU	0x06
30
EXEC_DRM_RND	EQU	0x07
31
EXEC_SAVE_PATCH	EQU	0x08
32
EXEC_SAVE_ENS	EQU	0x09
33
EXEC_EDIT_SEQ	EQU	0x0a
34
EXEC_SEQ_CPY	EQU	0x0b
35
EXEC_SEQ_PST	EQU	0x0c
36
EXEC_SEQ_CLR	EQU	0x0d
37
 
38
 
39
; ==========================================================================
40
;  The EXEC handler
41
;; IN: EXEC_xxx ID in WREG
42
; ==========================================================================
43
CS_MENU_EXEC_Handler
44
	JUMPTABLE_2BYTES (0x0d+1)	; entries
45
	rgoto	CS_MENU_EXEC_NOP
46
	rgoto	CS_MENU_EXEC_Menu
47
	rgoto	CS_MENU_EXEC_Menu_Save
48
	rgoto	CS_MENU_EXEC_Menu_SaveEns
49
	rgoto	CS_MENU_EXEC_SelPar
50
	rgoto	CS_MENU_EXEC_TogPar
51
	rgoto	CS_MENU_EXEC_Rnd
52
	rgoto	CS_MENU_EXEC_DrmRnd
53
	rgoto	CS_MENU_EXEC_SavePatch
54
	rgoto	CS_MENU_EXEC_SaveEns
55
	rgoto	CS_MENU_EXEC_EditSeq
56
	rgoto	CS_MENU_EXEC_SEQ_CPY
57
	rgoto	CS_MENU_EXEC_SEQ_PST
58
	rgoto	CS_MENU_EXEC_SEQ_CLR
59
 
60
 
61
; ==========================================================================
62
;  Dummy function, can be called if nothing has to be done
63
; ==========================================================================
64
CS_MENU_EXEC_NOP
65
	return
66
 
67
; ==========================================================================
68
;  Use this function to change to a menu
69
; ==========================================================================
70
CS_MENU_EXEC_Menu
71
	;; was previousliy located in CS_MENU_Page_Init
72
	;; now done here, so that the cursor doesn't change when we are within a menu page and LCD initialisation is requested
73
	btfss	CS_STAT, CS_STAT_MODIFY_PARAMETER
74
	clrf CS_MENU_CURSOR_POS
75
	btfss	CS_STAT, CS_STAT_MODIFY_PARAMETER
76
	clrf CS_MENU_PAGE_OFFSET
77
 
78
	movf	FSR0L, W
79
	andlw	0x7f
80
	rgoto	CS_MENU_EXEC_Hlp_ChangeMenu
81
 
82
 
83
; ==========================================================================
84
;  Dummy function, can be called if nothing has to be done
85
; ==========================================================================
86
CS_MENU_EXEC_Nothing
87
	return
88
 
89
; ==========================================================================
90
;  Use this function to change to the save patch menu
91
; ==========================================================================
92
CS_MENU_EXEC_Menu_Save
93
	;; was previousliy located in CS_MENU_Page_Init
94
	;; now done here, so that the cursor doesn't change when we are within a menu page and LCD initialisation is requested
95
	btfss	CS_STAT, CS_STAT_MODIFY_PARAMETER
96
	clrf CS_MENU_CURSOR_POS
97
	btfss	CS_STAT, CS_STAT_MODIFY_PARAMETER
98
	clrf CS_MENU_PAGE_OFFSET
99
 
100
	;; copy current patch/bank number to SAVE_PATCH and SAVE_BANK and change menu
101
	call	CS_MENU_MS_GetSIDNumber
102
	call	CS_MENU_MS_GetSIDPatch; sets FSR1 to patch register
103
	movf	INDF1, W
104
	andlw	0x7f
105
	movwf	CS_MENU_SAVE_PATCH
106
	call	CS_MENU_MS_GetSIDBank; sets FSR1 to bank register
107
	movf	INDF1, W
108
	andlw	0x07
109
	movwf	CS_MENU_SAVE_BANK
110
 
111
	call	CS_MENU_GetMenuID_SAV
112
	rgoto	CS_MENU_EXEC_Hlp_ChangeMenu
113
 
114
 
115
; ==========================================================================
116
;  Use this function to change to the save ensemble menu
117
; ==========================================================================
118
CS_MENU_EXEC_Menu_SaveEns
119
	;; was previousliy located in CS_MENU_Page_Init
120
	;; now done here, so that the cursor doesn't change when we are within a menu page and LCD initialisation is requested
121
	btfss	CS_STAT, CS_STAT_MODIFY_PARAMETER
122
	clrf CS_MENU_CURSOR_POS
123
	btfss	CS_STAT, CS_STAT_MODIFY_PARAMETER
124
	clrf CS_MENU_PAGE_OFFSET
125
 
126
	;; copy current ensemble number to SAVE_ENS and change menu
127
	movff	SID_ENSEMBLE, CS_MENU_SAVE_ENS
128
 
129
	movlw	CS_MENU_E_SAV
130
	rgoto	CS_MENU_EXEC_Hlp_ChangeMenu
131
 
132
 
133
; ==========================================================================
134
;  Sequencer Copy Function
135
; ==========================================================================
136
TEXT_SEQ_CPY_OK    STRING 16, 0x40, "----- COPY -----"
137
 
138
CS_MENU_EXEC_SEQ_CPY
139
	;; notify that buffer filled
140
	bsf	CS_STAT2, CS_STAT2_COPY_BUFFER_FILLED
141
 
142
	;; branch depending on bassline/drum engine
143
	;; function only used by these engines, therefore this can be simplified:
144
	movff	SID_EDIT_BUFFER + SID_Ix_ENGINE, WREG
145
	andlw	0x03
146
	xorlw	0x02
147
	bz	CS_MENU_EXEC_SEQ_CPY_D
148
 
149
CS_MENU_EXEC_SEQ_CPY_B
150
	;; copy 2*16 bytes
151
	lfsr	FSR1, CS_COPY_PASTE_BUFFER_BEGIN
152
	lfsr	FSR0, SID_EDIT_BUFFER + SID_Ix_B_SEQUENCES
153
	swapf	CS_MENU_WT_SEQ, W
154
	andlw	0x70
155
	iorwf	FSR0L, F
156
 
157
	clrf	CS_MENU_PARAMETER_IX		; using *_IX as loop counter
158
CS_MENU_EXEC_SEQ_CPY_B_Loop
159
	movf	CS_MENU_PARAMETER_IX, W
160
	movff	PLUSW0, PLUSW1		; note
161
 
162
	;; switch to parameter bank
163
	movlw	0x10
164
	addwf	FSR1L, F
165
	movlw	0x80
166
	addwf	FSR0L, F
167
 
168
	movf	CS_MENU_PARAMETER_IX, W
169
	movff	PLUSW0, PLUSW1		; parameter
170
 
171
	;; switch back to note bank
172
	movlw	-0x10
173
	addwf	FSR1L, F
174
	movlw	-0x80
175
	addwf	FSR0L, F
176
 
177
	incf	CS_MENU_PARAMETER_IX, F
178
	BRA_IFCLR CS_MENU_PARAMETER_IX, 4, ACCESS, CS_MENU_EXEC_SEQ_CPY_B_Loop
179
 
180
	rgoto	CS_MENU_EXEC_SEQ_CPY_Cont
181
 
182
 
183
CS_MENU_EXEC_SEQ_CPY_D
184
	;; copy 2*16 bytes
185
	lfsr	FSR1, CS_COPY_PASTE_BUFFER_BEGIN
186
	lfsr	FSR0, SID_EDIT_BUFFER + SID_Ix_D_SEQUENCES
187
	movf	CS_MENU_WT_SEQ, W
188
	mullw	0x20
189
	movf	PRODL, W
190
	addwf	FSR0L, F
191
 
192
	clrf	CS_MENU_PARAMETER_IX	; using *_IX as loop counter
193
CS_MENU_EXEC_SEQ_CPY_D_Loop
194
	movff	POSTINC0, POSTINC1
195
	incf	CS_MENU_PARAMETER_IX, F
196
	BRA_IFCLR CS_MENU_PARAMETER_IX, 5, ACCESS, CS_MENU_EXEC_SEQ_CPY_D_Loop
197
 
198
	;; 	rgoto	CS_MENU_EXEC_SEQ_CPY_Cont
199
 
200
CS_MENU_EXEC_SEQ_CPY_Cont
201
 
202
	;; print message
203
	TABLE_ADDR TEXT_SEQ_CPY_OK
204
	rgoto	CS_MENU_EXEC_CpyPstClr_Msg
205
 
206
	return
207
 
208
; ==========================================================================
209
;  Sequencer Paste Function
210
; ==========================================================================
211
TEXT_SEQ_PST_EMPTY STRING 16, 0x40, "- Buffer Empty -"
212
TEXT_SEQ_PST_OK    STRING 16, 0x40, "---- PASTE ---- "
213
 
214
CS_MENU_EXEC_SEQ_PST
215
	;; print message if copy buffer not filled
216
	BRA_IFCLR CS_STAT2, CS_STAT2_COPY_BUFFER_FILLED, ACCESS, CS_MENU_EXEC_SEQ_PST_Empty
217
 
218
	;; branch depending on bassline/drum engine
219
	;; function only used by these engines, therefore this can be simplified:
220
	movff	SID_EDIT_BUFFER + SID_Ix_ENGINE, WREG
221
	andlw	0x03
222
	xorlw	0x02
223
	bz	CS_MENU_EXEC_SEQ_PST_D
224
 
225
CS_MENU_EXEC_SEQ_PST_B
226
	;; paste 2*16 bytes
227
	lfsr	FSR0, SID_EDIT_BUFFER + SID_Ix_B_SEQUENCES
228
	swapf	CS_MENU_WT_SEQ, W
229
	andlw	0x70
230
	iorwf	FSR0L, F
231
 
232
	clrf	CS_MENU_PARAMETER_IX	; using *_IX as loop counter
233
CS_MENU_EXEC_SEQ_PST_B_Loop
234
	lfsr	FSR1, CS_COPY_PASTE_BUFFER_BEGIN + 0x00
235
	movf	CS_MENU_PARAMETER_IX, W
236
	movff	PLUSW1, INDF0
237
	call	CS_MENU_MS_SendParameter
238
 
239
	movlw	0x80		; switch to parameter bank
240
	addwf	FSR0L, F
241
 
242
	lfsr	FSR1, CS_COPY_PASTE_BUFFER_BEGIN + 0x10
243
	movf	CS_MENU_PARAMETER_IX, W
244
	movff	PLUSW1, INDF0
245
	call	CS_MENU_MS_SendParameter
246
 
247
	movlw	-0x80+1		; switch back to note bank and increment
248
	addwf	FSR0L, F
249
 
250
	incf	CS_MENU_PARAMETER_IX, F
251
	BRA_IFCLR CS_MENU_PARAMETER_IX, 4, ACCESS, CS_MENU_EXEC_SEQ_PST_B_Loop
252
 
253
	rgoto	CS_MENU_EXEC_SEQ_PST_Cont
254
 
255
 
256
CS_MENU_EXEC_SEQ_PST_D
257
	;; paste 2*16 bytes
258
	lfsr	FSR0, SID_EDIT_BUFFER + SID_Ix_D_SEQUENCES
259
	movf	CS_MENU_WT_SEQ, W
260
	mullw	0x20
261
	movf	PRODL, W
262
	addwf	FSR0L, F
263
 
264
	clrf	CS_MENU_PARAMETER_IX	; using *_IX as loop counter
265
CS_MENU_EXEC_SEQ_PST_D_Loop
266
	lfsr	FSR1, CS_COPY_PASTE_BUFFER_BEGIN
267
	movf	CS_MENU_PARAMETER_IX, W
268
	movff	PLUSW1, INDF0
269
	call	CS_MENU_MS_SendParameter
270
	movf	POSTINC0, W	; (increment)
271
	incf	CS_MENU_PARAMETER_IX, F
272
	BRA_IFCLR CS_MENU_PARAMETER_IX, 5, ACCESS, CS_MENU_EXEC_SEQ_PST_D_Loop
273
 
274
	;; 	rgoto	CS_MENU_EXEC_SEQ_PST_Cont
275
 
276
CS_MENU_EXEC_SEQ_PST_Cont
277
	;; print message
278
	TABLE_ADDR TEXT_SEQ_PST_OK
279
	rgoto	CS_MENU_EXEC_CpyPstClr_Msg
280
 
281
 
282
CS_MENU_EXEC_SEQ_PST_Empty
283
	TABLE_ADDR TEXT_SEQ_PST_EMPTY
284
	rgoto	CS_MENU_EXEC_CpyPstClr_Msg
285
 
286
 
287
; ==========================================================================
288
;  Sequencer Clear Function
289
; ==========================================================================
290
TEXT_SEQ_CLR_OK    STRING 16, 0x40, "---- Clear ---- "
291
 
292
CS_MENU_EXEC_SEQ_CLR
293
	;; branch depending on bassline/drum engine
294
	;; function only used by these engines, therefore this can be simplified:
295
	movff	SID_EDIT_BUFFER + SID_Ix_ENGINE, WREG
296
	andlw	0x03
297
	xorlw	0x02
298
	bz	CS_MENU_EXEC_SEQ_CLR_D
299
 
300
CS_MENU_EXEC_SEQ_CLR_B
301
	;; clear 2*16 bytes
302
	lfsr	FSR0, SID_EDIT_BUFFER + SID_Ix_B_SEQUENCES
303
	swapf	CS_MENU_WT_SEQ, W
304
	andlw	0x70
305
	iorwf	FSR0L, F
306
 
307
	clrf	CS_MENU_PARAMETER_IX	; using *_IX as loop counter
308
CS_MENU_EXEC_SEQ_CLR_B_Loop
309
	movlw	0x80
310
	movwf	INDF0
311
	call	CS_MENU_MS_SendParameter
312
 
313
	movlw	0x80		; switch to parameter bank
314
	addwf	FSR0L, F
315
 
316
	movlw	0x40
317
	movwf	INDF0
318
	call	CS_MENU_MS_SendParameter
319
 
320
	movlw	-0x80+1		; switch back to note bank and increment
321
	addwf	FSR0L, F
322
 
323
	incf	CS_MENU_PARAMETER_IX, F
324
	BRA_IFCLR CS_MENU_PARAMETER_IX, 4, ACCESS, CS_MENU_EXEC_SEQ_CLR_B_Loop
325
 
326
	rgoto	CS_MENU_EXEC_SEQ_CLR_Cont
327
 
328
 
329
CS_MENU_EXEC_SEQ_CLR_D
330
	;; clear 2*16 bytes
331
	lfsr	FSR0, SID_EDIT_BUFFER + SID_Ix_D_SEQUENCES
332
	movf	CS_MENU_WT_SEQ, W
333
	mullw	0x20
334
	movf	PRODL, W
335
	addwf	FSR0L, F
336
 
337
	clrf	CS_MENU_PARAMETER_IX	; using *_IX as loop counter
338
CS_MENU_EXEC_SEQ_CLR_D_Loop
339
	clrf	INDF0
340
	call	CS_MENU_MS_SendParameter
341
	movf	POSTINC0, W	; (increment)
342
	incf	CS_MENU_PARAMETER_IX, F
343
	BRA_IFCLR CS_MENU_PARAMETER_IX, 5, ACCESS, CS_MENU_EXEC_SEQ_CLR_D_Loop
344
 
345
	;; 	rgoto	CS_MENU_EXEC_SEQ_CLR_Cont
346
 
347
CS_MENU_EXEC_SEQ_CLR_Cont
348
	;; print message
349
	TABLE_ADDR TEXT_SEQ_CLR_OK
350
	rgoto	CS_MENU_EXEC_CpyPstClr_Msg
351
 
352
 
353
; ==========================================================================
354
;  Use this function to select/deselect a parameter
355
;  (depending on CS_STAT.CS_STAT_MODIFY_PARAMETER)
356
; ==========================================================================
357
CS_MENU_EXEC_SelPar
358
	;; don't select if no menu item
359
	movf	CS_MENU_ENTRIES, W
360
	cpfslt	CS_MENU_CURSOR_POS, ACCESS
361
	return
362
 
363
	;; set the "modify parameter" flag
364
	bsf	CS_STAT, CS_STAT_MODIFY_PARAMETER
365
	;; clear counter so that cs_menu_timer.inc counts from zero and the menu entry is marked for a short time
366
	clrf	CS_CURSOR_CTR
367
	;; clear "CS_STAT_CURSOR_FLASH" bit (see cs_menu.inc for the handling)
368
	bcf	CS_STAT, CS_STAT_CURSOR_FLASH
369
	;; request a display update
370
	bsf	CS_STAT, CS_STAT_DISPLAY_UPDATE_REQ	; (see cs_menu.inc)
371
 
372
	;; copy new max value to CS_MENU_PARAMETER_MAX_[LH]
373
	call	CS_MENU_Hlp_GetCursorPosEntry
374
	movlw	CS_MENU_ENTRY_MAX_OFFSET
375
	call	CS_MENU_Hlp_GetPointer
376
 
377
	;; read and copy
378
	tblrd*+
379
	movff	TABLAT, CS_MENU_PARAMETER_MAX_L
380
	tblrd*+
381
	movff	TABLAT, CS_MENU_PARAMETER_MAX_H
382
 
383
	;; new max value: set encoder speed
384
	movlw	0
385
	rcall	CS_MENU_EncSpeedSet
386
 
387
	;; update parameter value
388
	goto	CS_MENU_EncParameterSet
389
 
390
 
391
; ==========================================================================
392
;  Use this function to select/deselect a parameter and to toggle it
393
;  (usefull for on/off switches)
394
; ==========================================================================
395
CS_MENU_EXEC_TogPar
396
	;; don't toggle if no menu item
397
	movf	CS_MENU_ENTRIES, W
398
	cpfslt	CS_MENU_CURSOR_POS, ACCESS
399
	return
400
 
401
	;; select parameter
402
	rcall	CS_MENU_EXEC_SelPar
403
 
404
	;; increment it, wrap at max value (we expect values < 0x100)
405
	incf	CS_MENU_PARAMETER_L, F
406
	incf	CS_MENU_PARAMETER_MAX_L, W
407
	cpfslt	CS_MENU_PARAMETER_L, ACCESS
408
	clrf CS_MENU_PARAMETER_L
409
 
410
	;; transfer to register
411
	rcall	CS_MENU_ParameterUpdate
412
 
413
	;; deselect item
414
	rgoto	CS_MENU_EXEC_Hlp_Deselect
415
 
416
 
417
; ==========================================================================
418
;  Use this function to trigger the random generator
419
; ==========================================================================
420
CS_MENU_EXEC_Rnd
421
	;; generate depending on cursor position
422
	movf	CS_MENU_PARAMETER_IX, W
423
	call	SID_RND_GeneratePart
424
	;; transfer to SID and exit
425
	goto	CS_MENU_MS_Send_EditBuffer
426
 
427
; ==========================================================================
428
;  Use this function to trigger the random generator
429
; ==========================================================================
430
CS_MENU_EXEC_DrmRnd
431
	;; generate depending on current instrument
432
	movf	CS_MENU_SELECTED_INS, W
433
	call	SID_RND_GenerateOsc_D_Gen
434
 
435
	;; transfer specific part to SID
436
	lfsr	FSR0, SID_EDIT_BUFFER + SID_Ix_D_I1_BASE
437
	movf	CS_MENU_SELECTED_INS, W
438
	mullw	SID_Ix_D_I2_BASE-SID_Ix_D_I1_BASE
439
	movf	PRODL, W
440
	addwf	FSR0L, F
441
	movlw	10		; 10 bytes to send
442
	movwf	TMP1
443
CS_MENU_EXEC_DrmRnd_SendLoop
444
	call	CS_MENU_MS_SendParameter
445
	movf	POSTINC0, W	; (increment)
446
	decfsz	TMP1, F
447
	rgoto	CS_MENU_EXEC_DrmRnd_SendLoop
448
	return
449
 
450
 
451
; ==========================================================================
452
;  Use this function to save the current patch to CS_MENU_SAVE_PATCH
453
; ==========================================================================
454
CS_MENU_EXEC_SavePatch
455
	;; check if saving allowed
456
	movff	CS_MENU_SAVE_PATCH, SID_PATCH
457
	movff	CS_MENU_SAVE_BANK, SID_BANK
458
 
459
	;; patch 0, Bank 0 always allowed
460
	movf	SID_BANK, W
461
	iorwf	SID_PATCH, W
462
	bz	CS_MENU_EXEC_SavePatch_Ok
463
 
464
	call	SID_PBANK_CheckPatchValid
465
	bz	CS_MENU_EXEC_SavePatch_Ok
466
CS_MENU_EXEC_SavePatch_Inv
467
CS_MENU_EXEC_SaveEns_Inv	; re-used for invalid ensembles
468
	TABLE_ADDR TEXT_SAVE_PATCH_INV
469
	rgoto	CS_MENU_EXEC_SavePatch_Msg
470
 
471
CS_MENU_EXEC_SavePatch_Ok
472
 
473
	;; NEW in MBSID V2: go into name editor
474
	;; patch can be stored from there!
475
	clrf	CS_MENU_NAME_POS
476
	;; enable "edit name" mode
477
	bsf	CS_STAT, CS_STAT_MODIFY_NAME
478
	;; enter parameter mode
479
	goto	CS_MENU_EXEC_SelPar
480
 
481
 
482
	;; patch editor will jump back to this label
483
CS_MENU_EXEC_SavePatch_Final
484
	;; print "save patch" at the second line
485
	TABLE_ADDR TEXT_SAVE_PATCH_OK
486
	rcall	CS_MENU_EXEC_SavePatch_Msg
487
	;; save patch
488
	call	CS_MENU_SavePatch
489
	;; reset menu
490
	bcf	CS_STAT, CS_STAT_MODIFY_PARAMETER
491
	rgoto	CS_MENU_EXEC_Menu_Save
492
 
493
TEXT_SAVE_PATCH_OK STRING 16, 0x40, "-- Save Patch --"
494
TEXT_SAVE_PATCH_INV STRING 16, 0x40, "- not possible -"
495
 
496
 
497
CS_MENU_EXEC_SavePatch_Msg
498
CS_MENU_EXEC_CpyPstClr_Msg
499
	call	MIOS_LCD_PrintMessage
500
	;; fill with spaces
501
	movlw	40-16
502
	call	SID_LCD_PrintSpaces
503
	movlw	64		; short message
504
	goto	MIOS_LCD_MessageStart
505
 
506
 
507
; ==========================================================================
508
;  Use this function to save the current ensemble
509
; ==========================================================================
510
CS_MENU_EXEC_SaveEns
511
	;; check if saving allowed
512
	;; ensemble 0 always alowed
513
	movf	CS_MENU_SAVE_ENS, W
514
	bz	CS_MENU_EXEC_SaveEns_Ok
515
 
516
	call	SID_EBANK_CheckValid
517
	bz	CS_MENU_EXEC_SaveEns_Ok
518
	rgoto	CS_MENU_EXEC_SaveEns_Inv	; (ok - reuse!)
519
 
520
CS_MENU_EXEC_SaveEns_Ok
521
	;; print "save ensemble" at the second line
522
	TABLE_ADDR TEXT_SAVE_ENS_OK
523
	rcall	CS_MENU_EXEC_SaveEns_Msg
524
	;; select new one
525
	movff	CS_MENU_SAVE_ENS, SID_ENSEMBLE
526
	;; save ensemble
527
	call	CS_MENU_SaveEns
528
	;; reset menu
529
	rgoto	CS_MENU_EXEC_Menu_SaveEns
530
 
531
TEXT_SAVE_ENS_OK STRING 19, 0x40, "-- Save Ensemble --"
532
 
533
 
534
CS_MENU_EXEC_SaveEns_Msg
535
	call	MIOS_LCD_PrintMessage
536
	;; fill with spaces
537
	movlw	40-19
538
	call	SID_LCD_PrintSpaces
539
	movlw	64		; short message
540
	goto	MIOS_LCD_MessageStart
541
 
542
 
543
; ==========================================================================
544
;  Enter the "edit sequence" function
545
; ==========================================================================
546
CS_MENU_EXEC_EditSeq
547
	;; clear name position
548
	clrf	CS_MENU_NAME_POS
549
	;; enable "edit name" mode, start with gate layer
550
	bsf	CS_STAT3, CS_STAT3_MODIFY_SEQ
551
	;; disable rotate function by default
552
	bcf	CS_STAT3, CS_STAT3_MODIFY_SEQ_ROTATE
553
	;; enter parameter mode
554
	goto	CS_MENU_EXEC_SelPar
555
 
556
; ==========================================================================
557
;  This help function is used to change to another menu if
558
;  "parameter modify" mode not active
559
;  if currently a parameter is modified, change to parameter select
560
;  mode instead
561
;  IN: new menu ID in WREG
562
; ==========================================================================
563
CS_MENU_EXEC_Hlp_ChangeMenu
564
	BRA_IFCLR CS_STAT, CS_STAT_MODIFY_PARAMETER, ACCESS, CS_MENU_EXEC_Hlp_ChangeMenu_Now
565
 
566
CS_MENU_EXEC_Hlp_Deselect	; used by CS_MENU_EXEC_TogPar and CS_MENU_Select_NameFunc_Save
567
	;; we are in "modify parameter" mode, clear flag and update screen
568
	;; the user has to press the exec button once more to leave the menu
569
	bcf	CS_STAT, CS_STAT_MODIFY_PARAMETER
570
	bcf	CS_STAT, CS_STAT_MODIFY_NAME
571
	bcf	CS_STAT3, CS_STAT3_MODIFY_SEQ
572
	bcf	CS_STAT, CS_STAT_BIG_MSG
573
	;; request update of display
574
	bsf	CS_STAT, CS_STAT_DISPLAY_UPDATE_REQ
575
	;; clear counter so that cs_menu_timer.inc counts from zero and the menu entry is marked for a short time
576
	clrf	CS_CURSOR_CTR
577
	;; clear "CS_STAT_CURSOR_FLASH" bit (see cs_menu.inc for the handling)
578
	bcf	CS_STAT, CS_STAT_CURSOR_FLASH
579
	;; set encoder speed
580
	movlw	0
581
	rcall	CS_MENU_EncSpeedSet
582
	;; update parameter
583
	rcall	CS_MENU_EncParameterSet
584
	;; update parameter max value and exit
585
	rgoto	CS_MENU_EncMaxSet
586
 
587
CS_MENU_EXEC_Hlp_ChangeMenu_Now
588
	movwf	CS_MENU
589
	bsf	CS_STAT, CS_STAT_DISPLAY_INIT_REQ
590
	;; set encoder speed and exit
591
	movlw	0
592
	rgoto	CS_MENU_EncSpeedSet
593
 
594
 
595
; ==========================================================================
596
;  directly called from cs_menu_tables.inc
597
;  Use this function to change to the main page
598
; ==========================================================================
599
CS_MENU_EXEC_GoToMain
600
	movlw	CS_MENU_MAIN
601
	rgoto	CS_MENU_EXEC_Hlp_ChangeMenu
602
 
603
; ==========================================================================
604
;  directly called from cs_menu.inc and cs_menu_tables.inc
605
;  Use this function to change to the root menu
606
; ==========================================================================
607
CS_MENU_EXEC_GoToRoot
608
	;; was previousliy located in CS_MENU_Page_Init
609
	;; now done here, so that the cursor doesn't change when we are within a menu page and LCD initialisation is requested
610
	btfss	CS_STAT, CS_STAT_MODIFY_PARAMETER
611
	clrf CS_MENU_CURSOR_POS
612
	btfss	CS_STAT, CS_STAT_MODIFY_PARAMETER
613
	clrf CS_MENU_PAGE_OFFSET
614
 
615
	movlw	CS_MENU_ROOT
616
	rgoto	CS_MENU_EXEC_Hlp_ChangeMenu
617
 
618
; ==========================================================================
619
;  directly called from cs_menu.inc
620
;  Use this function to change to the ensemble root menu
621
; ==========================================================================
622
CS_MENU_EXEC_GoToEnsRoot
623
	;; was previousliy located in CS_MENU_Page_Init
624
	;; now done here, so that the cursor doesn't change when we are within a menu page and LCD initialisation is requested
625
	btfss	CS_STAT, CS_STAT_MODIFY_PARAMETER
626
	clrf CS_MENU_CURSOR_POS
627
	btfss	CS_STAT, CS_STAT_MODIFY_PARAMETER
628
	clrf CS_MENU_PAGE_OFFSET
629
 
630
	movlw	CS_MENU_E_ROOT
631
	rgoto	CS_MENU_EXEC_Hlp_ChangeMenu
632