Subversion Repositories svn.mios

Rev

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

Rev Author Line No. Line
73 tk 1
; $Id: cs_m_edit.inc 1176 2014-07-20 18:50:23Z tk $
2
;
97 tk 3
; MBSEQ Menu "Edit"
73 tk 4
;
5
; ==========================================================================
6
;
7
;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
8
;  Licensed for personal non-commercial use only.
9
;  All other rights reserved.
10
;
11
; ==========================================================================
12
 
13
 
14
;; --------------------------------------------------------------------------
97 tk 15
;;  This is the menu specific GP callback function called by cs_menu_button.inc
16
;;  when the GP hook has been installed
17
;;  Input:
18
;;     o GP Button number in MIOS_PARAMETER1 (0x00-0x0f)
19
;;     o Button value MIOS_PARAMETER2:
20
;;       - 1 if button has been released (=5V)
21
;;       - 0 if button has been pressed (=0V)
22
;;  Output:
23
;;     should return the GP LED values in CS_MENU_GP_OVERLAY_DOUT_SR[01]
73 tk 24
;; --------------------------------------------------------------------------
97 tk 25
CS_M_EDIT_GP_Callback
26
	;; do nothing if button has been depressed
73 tk 27
	btfsc	MIOS_PARAMETER2, 0
28
	return
29
 
97 tk 30
	;; branch depending on Edit Button status
73 tk 31
	SET_BSR	SEQ_BASE
97 tk 32
	BRA_IFSET SEQ_MODE1, SEQ_MODE1_EDIT_HOLD, BANKED, CS_M_EDIT_GP_Callback_Sel
33
CS_M_EDIT_GP_Callback_Normal
120 tk 34
	;; determine step number depending on SEQ_SELECTED_STEP_VIEW[1:0],
97 tk 35
	;; add offset to button number and store in SEQ_CURRENT_STEP and SEQ_EVNTS
120 tk 36
	swapf	SEQ_SELECTED_STEP_VIEW, W, BANKED
97 tk 37
	andlw	0x30
38
	addwf	MIOS_PARAMETER1, W
39
	movwf	SEQ_CURRENT_STEP, BANKED
40
	movwf	SEQ_EVNTS, BANKED
73 tk 41
 
97 tk 42
	;; determine store mask used for XOR operation in TMP1
43
	movf	MIOS_PARAMETER1, W
44
	call	MIOS_HLP_GetBitORMask
45
	movwf	TMP1
73 tk 46
 
97 tk 47
	;; using CS_STAT2_TRK_CHANGED flag to determine, if any track is selected (and not disabled)
48
	bcf	CS_STAT2, CS_STAT2_TRK_CHANGED
49
 
50
	clrf	SEQ_EVNTT, BANKED
51
CS_M_EDIT_GP_Callback_Loop
118 tk 52
	BRA_IFSET SEQ_MODE0, SEQ_MODE0_CHANGE_ALL_STEPS, BANKED, CS_M_EDIT_GP_Callback_Loop_All
97 tk 53
	;; check if track selected
54
	call	CS_M_HLP_ChkTrkSelected
55
	bnz	CS_M_EDIT_GP_Callback_Loop_Next
118 tk 56
CS_M_EDIT_GP_Callback_Loop_All
1174 tk 57
 
126 tk 58
	;; gate layer selected?
59
	BRA_IFCLR SEQ_SELECTED_LAYERS, 0, BANKED, CS_M_EDIT_GP_Callback_Loop_NotG
1174 tk 60
	;; NEW: gate and aux layer selected?
61
	;; -> go to new button handling which allows to set both flags with three button states
62
	BRA_IFSET SEQ_SELECTED_LAYERS, 1, BANKED, CS_M_EDIT_GP_Callback_Loop_GACrl
63
 
126 tk 64
CS_M_EDIT_GP_Callback_Loop_Gate
65
	;; get pointer to gate layer
66
	call	SEQ_FSR_TrgGate
1174 tk 67
	rgoto	CS_M_EDIT_GP_Callback_Loop_GateC;ont
97 tk 68
 
126 tk 69
CS_M_EDIT_GP_Callback_Loop_NotG
97 tk 70
 
126 tk 71
	;; aux layer selected?
72
	BRA_IFCLR SEQ_SELECTED_LAYERS, 1, BANKED, CS_M_EDIT_GP_Callback_Loop_NotA
73
CS_M_EDIT_GP_Callback_Loop_Aux
74
	;; get pointer to aux layer
75
	call	SEQ_FSR_TrgAux
97 tk 76
 
1174 tk 77
CS_M_EDIT_GP_Callback_Loop_GateC;ont
78
;; expecting base pointer to layer in FSR1, step in SEQ_EVNTS, step mask in TMP1
79
CS_M_EDIT_GP_Callback_Hlp_Stp
80
	;; add step offset
81
	rlf	SEQ_EVNTS, W, BANKED
82
	swapf	WREG, W
83
	andlw	0x07
84
	addwf	FSR1L, F
85
 
86
	;; if this is the first time: xor bit and remember state (so that all other tracks are changed to same state)
87
	BRA_IFSET CS_STAT2, CS_STAT2_TRK_CHANGED, ACCESS, CS_M_EDIT_GP_Callback_Hlp_StpNFr
88
CS_M_EDIT_GP_Callback_Hlp_Stp_Fr
89
	;; XOR
90
	movf	TMP1, W
91
	xorwf	INDF1, F
92
 
93
	;; remember state
94
	movf	INDF1, W
95
	andwf	TMP1, W
96
	bcf	TMP2, 0
97
	skpz
98
	bsf	TMP2, 0
99
 
100
	;; notify that trigger has been toggled
101
	bsf	CS_STAT2, CS_STAT2_TRK_CHANGED
102
 
103
CS_M_EDIT_GP_Callback_Hlp_StpNFr
104
	;; branch depending on 0/1 state of first modified step
105
	BRA_IFSET TMP2, 0, ACCESS, CS_M_EDIT_GP_Callback_Hlp_Stp_S1
106
CS_M_EDIT_GP_Callback_Hlp_Stp_S0
107
	comf	TMP1, W
108
	andwf	INDF1, F
109
	rgoto	CS_M_EDIT_GP_Callback_Hlp_StpEnd
110
 
111
CS_M_EDIT_GP_Callback_Hlp_Stp_S1
112
	movf	TMP1, W
113
	iorwf	INDF1, F
114
	;; 	rgoto	CS_M_EDIT_GP_Callback_Hlp_StpEnd
115
CS_M_EDIT_GP_Callback_Hlp_StpEnd
116
 
126 tk 117
CS_M_EDIT_GP_Callback_Loop_NotA
1174 tk 118
	rgoto	CS_M_EDIT_GP_Callback_Loop_Next
97 tk 119
 
1174 tk 120
 
121
 
122
	;; new: toggle gate/aux flags independent from layer with three button states
123
CS_M_EDIT_GP_Callback_Loop_GACrl
124
 
125
	;; if this is the first time: xor bit and remember state (so that all other tracks are changed to same state)
126
	BRA_IFSET CS_STAT2, CS_STAT2_TRK_CHANGED, ACCESS, CS_M_EDIT_GP_Callback_Loop_NFr
127
CS_M_EDIT_GP_Callback_Loop_Fr
128
	;; aux layer selected? -> clear aux and gate flag
129
	call	SEQ_FSR_TrgAux
130
	rlf	SEQ_EVNTS, W, BANKED
131
	swapf	WREG, W
132
	andlw	0x07
133
	addwf	FSR1L, F
134
	movf	INDF1, W
135
	andwf	TMP1, W
136
	bnz	CS_M_EDIT_GP_Callback_Loop_ClrGA
137
 
138
	;; gate layer selected? -> set aux flag
139
	call	SEQ_FSR_TrgGate
140
	rlf	SEQ_EVNTS, W, BANKED
141
	swapf	WREG, W
142
	andlw	0x07
143
	addwf	FSR1L, F
144
	movf	INDF1, W
145
	andwf	TMP1, W
146
	bnz	CS_M_EDIT_GP_Callback_Loop_SetA
147
 
148
	;; set gate flag, clear aux flag
149
CS_M_EDIT_GP_Callback_Loop_SetG
150
	bsf	TMP2, 0
151
	bcf	TMP2, 1
152
	rgoto	CS_M_EDIT_GP_Callback_Loop_NFr
153
 
154
	;; set aux + gate flag
155
CS_M_EDIT_GP_Callback_Loop_SetA
156
	bsf	TMP2, 0
157
	bsf	TMP2, 1
158
	rgoto	CS_M_EDIT_GP_Callback_Loop_NFr
159
 
160
	;; clear aux + gate flag
161
CS_M_EDIT_GP_Callback_Loop_ClrGA
162
	bcf	TMP2, 0
163
	bcf	TMP2, 1
164
	;; 	rgoto	CS_M_EDIT_GP_Callback_Loop_NFr
165
 
166
CS_M_EDIT_GP_Callback_Loop_NFr
167
	;; notify that trigger has been toggled
168
	bsf	CS_STAT2, CS_STAT2_TRK_CHANGED
169
 
170
	;;
171
	;; set/clear gate flag
172
	;;
173
	call	SEQ_FSR_TrgGate
174
	rlf	SEQ_EVNTS, W, BANKED
175
	swapf	WREG, W
176
	andlw	0x07
177
	addwf	FSR1L, F
178
 
179
	BRA_IFSET TMP2, 0, ACCESS, CS_M_EDIT_GP_Callback_Loop_G1
180
CS_M_EDIT_GP_Callback_Loop_G0
181
	comf	TMP1, W
182
	andwf	INDF1, F
183
	rgoto	CS_M_EDIT_GP_Callback_Loop_GC
184
 
185
CS_M_EDIT_GP_Callback_Loop_G1
186
	movf	TMP1, W
187
	iorwf	INDF1, F
188
	;; 	rgoto	CS_M_EDIT_GP_Callback_Loop_GC
189
CS_M_EDIT_GP_Callback_Loop_GC
190
 
191
 
192
	;;
193
	;; set/clear aux flag
194
	;;
195
	call	SEQ_FSR_TrgAux
196
	rlf	SEQ_EVNTS, W, BANKED
197
	swapf	WREG, W
198
	andlw	0x07
199
	addwf	FSR1L, F
200
 
201
	BRA_IFSET TMP2, 1, ACCESS, CS_M_EDIT_GP_Callback_Loop_A1
202
CS_M_EDIT_GP_Callback_Loop_A0
203
	comf	TMP1, W
204
	andwf	INDF1, F
205
	rgoto	CS_M_EDIT_GP_Callback_Loop_AC
206
 
207
CS_M_EDIT_GP_Callback_Loop_A1
208
	movf	TMP1, W
209
	iorwf	INDF1, F
210
	;; 	rgoto	CS_M_EDIT_GP_Callback_Loop_AC
211
CS_M_EDIT_GP_Callback_Loop_AC
212
 
97 tk 213
CS_M_EDIT_GP_Callback_Loop_Next
214
	incf	SEQ_EVNTT, F, BANKED
215
	BRA_IFCLR SEQ_EVNTT, 4, BANKED, CS_M_EDIT_GP_Callback_Loop
216
 
217
	;; print "track(s) disabled" message when no trigger has been toggled
218
	GOTO_IFCLR CS_STAT2, CS_STAT2_TRK_CHANGED, ACCESS, SEQ_LCD_MsgTrkDisabled
219
 
220
	rgoto	CS_M_EDIT_GP_Callback_End
221
 
222
 
223
CS_M_EDIT_GP_Callback_Sel
118 tk 224
	;; clear "all steps" flag
225
	bcf	SEQ_MODE0, SEQ_MODE0_CHANGE_ALL_STEPS, BANKED
226
 
97 tk 227
	;; if multi selection not set (will be set after the first selection), clear all track selections
228
	BRA_IFSET SEQ_MODE1, SEQ_MODE1_EDIT_HOLD_MULTISEL, BANKED, CS_M_EDIT_GP_Callback_SelNot1st
229
CS_M_EDIT_GP_Callback_Sel1st
230
	bsf	SEQ_MODE1, SEQ_MODE1_EDIT_HOLD_MULTISEL, BANKED	; arm multiselection flag
231
	clrf	SEQ_SELECTED_TRKS_0, BANKED
232
	clrf	SEQ_SELECTED_TRKS_1, BANKED
233
CS_M_EDIT_GP_Callback_SelNot1st
234
 
235
	;; toggle track selection depending on button number
236
	movf	MIOS_PARAMETER1, W
237
	call	MIOS_HLP_GetBitORMask
238
	btfss	MIOS_PARAMETER1, 3
320 tk 239
	xorwf	SEQ_SELECTED_TRKS_0, BANKED
240
	btfsc	MIOS_PARAMETER1, 3
241
	xorwf	SEQ_SELECTED_TRKS_1, BANKED
242
 
243
	;; if no track selected anymore: set track which corresponds to button
244
	movf	SEQ_SELECTED_TRKS_0, W, BANKED
245
	bnz	CS_M_EDIT_GP_Callback_SelOk
246
	movf	SEQ_SELECTED_TRKS_1, W, BANKED
247
	bnz	CS_M_EDIT_GP_Callback_SelOk
248
CS_M_EDIT_GP_Callback_SelFix
249
	movf	MIOS_PARAMETER1, W
250
	call	MIOS_HLP_GetBitORMask
251
	btfss	MIOS_PARAMETER1, 3
97 tk 252
	iorwf	SEQ_SELECTED_TRKS_0, BANKED
253
	btfsc	MIOS_PARAMETER1, 3
254
	iorwf	SEQ_SELECTED_TRKS_1, BANKED
320 tk 255
CS_M_EDIT_GP_Callback_SelOk
97 tk 256
 
257
	;; select display view of track
258
	movff	MIOS_PARAMETER1, SEQ_SELECTED_TRK
259
 
411 tk 260
	;; request display re-initialisation
73 tk 261
	bsf	CS_STAT, CS_STAT_DISPLAY_INIT_REQ
97 tk 262
	;; 	rgoto	CS_M_EDIT_GP_Callback_End
263
 
264
CS_M_EDIT_GP_Callback_End
126 tk 265
 	rgoto	CS_M_EDIT_UpdateGPLEDs
97 tk 266
 
126 tk 267
 
97 tk 268
;; --------------------------------------------------------------------------
269
CS_M_EDIT_UpdateGPLEDs
270
	;; branch depending on Edit Button status
271
	SET_BSR	SEQ_BASE
272
	BRA_IFSET SEQ_MODE1, SEQ_MODE1_EDIT_HOLD, BANKED, CS_M_EDIT_UpdateGPLEDs_Sel
273
CS_M_EDIT_UpdateGPLEDs_Normal
274
	;; don't flash LEDs
275
	bsf	MB_STAT, MB_STAT_DONT_FLASH_R_GP_DOUT
276
	bsf	MB_STAT, MB_STAT_DONT_FLASH_L_GP_DOUT
277
 
1176 tk 278
	;; base pointer to trigger layer depending on selected track
97 tk 279
	call	CS_M_HLP_GetSelectedTrk
280
	SET_BSR	SEQ_BASE
281
	movwf	SEQ_EVNTT, BANKED
282
 
1176 tk 283
	;; branch depending on layer selection
284
	decf	SEQ_SELECTED_LAYERS, W, BANKED
285
	andlw	0x03
286
	bz	CS_M_EDIT_UpdateGPLEDs_Gate
287
	addlw	-1
288
	bz	CS_M_EDIT_UpdateGPLEDs_Aux
289
 
290
CS_M_EDIT_UpdateGPLEDs_GateAux
1174 tk 291
	;; get pointer to gate layer
292
	call	SEQ_FSR_TrgGate
293
	rlf	SEQ_SELECTED_STEP_VIEW, W, BANKED
294
	andlw	0x06
295
	addwf	FSR1L, F
97 tk 296
 
1174 tk 297
	;; copy pattern to SEQ_GP_LED_[LR]_A
298
	movff	POSTINC1, CS_MENU_GP_OVERLAY_DOUT_SR0_A
299
	movff	POSTINC1, CS_MENU_GP_OVERLAY_DOUT_SR1_A
300
 
301
	;; get pointer to aux layer
302
	call	SEQ_FSR_TrgAux
120 tk 303
	rlf	SEQ_SELECTED_STEP_VIEW, W, BANKED
97 tk 304
	andlw	0x06
305
	addwf	FSR1L, F
306
 
1174 tk 307
	;; copy pattern to SEQ_GP_LED_[LR]_B
308
	movff	POSTINC1, CS_MENU_GP_OVERLAY_DOUT_SR0_B
309
	movff	POSTINC1, CS_MENU_GP_OVERLAY_DOUT_SR1_B
97 tk 310
 
73 tk 311
	return
312
 
1176 tk 313
CS_M_EDIT_UpdateGPLEDs_Gate
314
	call	SEQ_FSR_TrgGate
315
	rgoto	CS_M_EDIT_UpdateGPLEDs_Gate_Cont
73 tk 316
 
1176 tk 317
CS_M_EDIT_UpdateGPLEDs_Aux
318
	call	SEQ_FSR_TrgAux
319
	;; 	rgoto	CS_M_EDIT_UpdateGPLEDs_Gate_Cont
320
 
321
CS_M_EDIT_UpdateGPLEDs_Gate_Cont
322
	rlf	SEQ_SELECTED_STEP_VIEW, W, BANKED
323
	andlw	0x06
324
	addwf	FSR1L, F
325
 
326
	;; copy pattern to SEQ_GP_LED_[LR]_A
327
	movff	POSTINC1, CS_MENU_GP_OVERLAY_DOUT_SR0_A
328
	movff	POSTINC1, CS_MENU_GP_OVERLAY_DOUT_SR1_A
329
 
330
	rgoto	CS_M_EDIT_UpdateGPLEDs_End
331
 
332
 
97 tk 333
CS_M_EDIT_UpdateGPLEDs_Sel
334
	;; flash LEDs
335
	bcf	MB_STAT, MB_STAT_DONT_FLASH_R_GP_DOUT
336
	bcf	MB_STAT, MB_STAT_DONT_FLASH_L_GP_DOUT
337
 
118 tk 338
	;; if all flag set: light up all tracks
339
	BRA_IFCLR SEQ_MODE0, SEQ_MODE0_CHANGE_ALL_STEPS, BANKED, CS_M_EDIT_UpdateGPLEDs_Sel_NotAll
340
CS_M_EDIT_UpdateGPLEDs_Sel_All
341
	;; light up all tracks
1174 tk 342
	setf	CS_MENU_GP_OVERLAY_DOUT_SR0_A
343
	setf	CS_MENU_GP_OVERLAY_DOUT_SR1_A
1176 tk 344
	rgoto	CS_M_EDIT_UpdateGPLEDs_End
118 tk 345
 
346
CS_M_EDIT_UpdateGPLEDs_Sel_NotAll
97 tk 347
	;; light up selected tracks
1174 tk 348
	movff	SEQ_SELECTED_TRKS_0, CS_MENU_GP_OVERLAY_DOUT_SR0_A
349
	movff	SEQ_SELECTED_TRKS_1, CS_MENU_GP_OVERLAY_DOUT_SR1_A
350
 
1176 tk 351
CS_M_EDIT_UpdateGPLEDs_End
1174 tk 352
	;; copy A into B LED layer (no dimming used)
353
	movff	CS_MENU_GP_OVERLAY_DOUT_SR0_A, CS_MENU_GP_OVERLAY_DOUT_SR0_B
354
	movff	CS_MENU_GP_OVERLAY_DOUT_SR1_A, CS_MENU_GP_OVERLAY_DOUT_SR1_B
355
 
97 tk 356
	return
357
 
358
 
73 tk 359
;; --------------------------------------------------------------------------
360
;;  Menu Init routine is called when menu page should be initialized
361
;; --------------------------------------------------------------------------
97 tk 362
CS_M_EDIT_Init
411 tk 363
	;; install callback function for general purpose buttons
97 tk 364
	TABLE_ADDR CS_M_EDIT_GP_Callback
365
	call	CS_MENU_SetMenuGPCallbackHook
366
 
367
	;; (LEDs updated in CS_M_EDIT_Tick)
73 tk 368
	return
369
 
97 tk 370
 
73 tk 371
;; --------------------------------------------------------------------------
372
;;  Menu Tick routine is called on every refresh cycle
373
;; --------------------------------------------------------------------------
97 tk 374
CS_M_EDIT_Tick
375
	;; update LEDs
376
	call	CS_M_EDIT_UpdateGPLEDs
377
 
378
	;; layout:
379
	;; 00000000001111111111222222222233333333334444444444555555555566666666667777777777
380
	;; 01234567890123456789012345678901234567890123456789012345678901234567890123456789
381
	;; <--------------------------------------><-------------------------------------->
382
	;; BD    EDIT          Step  1-16          Trigger View: Gate
383
	;; 00000001111111111111222222222233333333334444444444444455555566666666667777777777
384
	;;   *    o    o    o    *    o    o    o    *    o    o    o    *    o    o    o
385
 
386
	;; for 2x16 LCD:
387
	;; 0000000000111111
388
	;; 0123456789012345
389
	;; <-------------->
390
	;; BD     1-16 Gate
391
	;; 0000001111111111
392
	;; *ooo*ooo*ooo*ooo
393
	;; 2222222222333333
394
 
395
 
396
	;; print segments 0-7
73 tk 397
	movf	CS_MENU_REFRESH_ITEM_CTR, W
97 tk 398
	andlw	0xf8
73 tk 399
	skpz
97 tk 400
	rgoto	CS_M_EDIT_Tick_Lower
401
 
402
;; ---
403
CS_M_EDIT_Tick_Upper
404
	movf	CS_MENU_REFRESH_ITEM_CTR, W
405
	andlw	0x07
406
	JUMPTABLE_2BYTES_UNSECURE
407
	rgoto	CS_M_EDIT_Tick_0
408
	rgoto	CS_M_EDIT_Tick_1
409
	rgoto	CS_M_EDIT_Tick_2
410
	rgoto	CS_M_EDIT_Tick_3
411
	rgoto	CS_M_EDIT_Tick_4
412
	rgoto	CS_M_EDIT_Tick_5
413
	rgoto	CS_M_EDIT_Tick_6
414
	rgoto	CS_M_EDIT_Tick_7
415
 
416
CS_M_EDIT_Tick_0
417
	;; print name of selected track
418
	movlw	0x00 + 0
419
	call	MIOS_LCD_CursorSet
420
 
421
	call	CS_M_HLP_GetSelectedTrk
99 tk 422
	call	CS_M_HLP_PrnTrkNameOrRec	; (6 characters)
97 tk 423
 
424
	rgoto	CS_M_EDIT_Tick_Cont
425
 
426
CS_M_EDIT_Tick_1
427
#if DEFAULT_LCD_WIDTH == 80
451 tk 428
	call	SEQ_LCD_PrintStringAfterCall
429
	STRING	14, 0x00 + 6, "EDIT          "
97 tk 430
#endif
431
	rgoto	CS_M_EDIT_Tick_Cont
432
 
433
CS_M_EDIT_Tick_2
434
#if DEFAULT_LCD_WIDTH == 80
451 tk 435
	call	SEQ_LCD_PrintStringAfterCall
436
	STRING	5, 0x00 + 20, "Step "
97 tk 437
#else
438
	movlw	0x00 + 6
439
	call	MIOS_LCD_CursorSet
440
#endif
441
	;; print step view
442
	SET_BSR	SEQ_BASE
120 tk 443
	swapf	SEQ_SELECTED_STEP_VIEW, W, BANKED	; (switches between A/B/C/D view)
97 tk 444
	andlw	0x30
445
	movwf	PRODL
446
	addlw	1
447
	call	MIOS_LCD_PrintBCD2
448
	movlw	'-'
449
	call	MIOS_LCD_PrintChar
450
	incf	PRODL, W
451
	addlw	15
452
	call	MIOS_LCD_PrintBCD2
453
 
454
	rgoto	CS_M_EDIT_Tick_Cont
455
 
456
CS_M_EDIT_Tick_3
457
#if DEFAULT_LCD_WIDTH == 80
458
	movlw	0x00 + 30
459
	call	MIOS_LCD_CursorSet
460
	movlw	10
461
	call	SEQ_LCD_PrintSpaces
462
#endif
463
	rgoto	CS_M_EDIT_Tick_Cont
464
 
465
 
466
CS_M_EDIT_Tick_4
467
#if DEFAULT_LCD_WIDTH == 80
451 tk 468
	call	SEQ_LCD_PrintStringAfterCall
469
	STRING	14, 0x80 + 0, "Trigger View: "
97 tk 470
#endif
471
	rgoto	CS_M_EDIT_Tick_Cont
472
 
473
CS_M_EDIT_Tick_5
474
#if DEFAULT_LCD_WIDTH == 80
475
	movlw	0x80 + 14
476
#else
477
	movlw	0x00 + 12
478
#endif
479
	call	MIOS_LCD_CursorSet
480
 
481
	;; print name of selected trigger layer
482
	call	CS_M_HLP_GetSelectedTrk
483
	movff	WREG, SEQ_EVNTT
484
 
126 tk 485
	;; branch depending on selected layer(s)
486
	SET_BSR	SEQ_BASE
487
	decf	SEQ_SELECTED_LAYERS, W, BANKED
488
	andlw	0x03
97 tk 489
	bz	CS_M_EDIT_Tick_5_Gate
126 tk 490
	addlw	-1
491
	bz	CS_M_EDIT_Tick_5_Aux
492
	rgoto	CS_M_EDIT_Tick_5_GateAux
493
 
494
CS_M_EDIT_Tick_5_Gate
495
	movlw	16			; will print "Gate "
496
	call	SEQ_TRG_PrnType		; (5 characters)
497
	rgoto	CS_M_EDIT_Tick_Cont
498
 
97 tk 499
CS_M_EDIT_Tick_5_Aux
500
	call	SEQ_FSR_TrkAssgn	; get aux assignment
501
	movf	INDF1, W		; print type
502
	call	SEQ_TRG_PrnType		; (5 characters)
503
	rgoto	CS_M_EDIT_Tick_Cont
504
 
126 tk 505
CS_M_EDIT_Tick_5_GateAux
506
	movlw	17			; will print "G/Aux"
97 tk 507
	call	SEQ_TRG_PrnType		; (5 characters)
508
	rgoto	CS_M_EDIT_Tick_Cont
509
 
510
 
511
CS_M_EDIT_Tick_6
512
#if DEFAULT_LCD_WIDTH == 80
513
	movlw	0x80 + 59
514
#else
515
	movlw	0x00 + 17
516
#endif
517
	call	MIOS_LCD_CursorSet
518
	movlw	11
519
	call	SEQ_LCD_PrintSpaces
520
	rgoto	CS_M_EDIT_Tick_Cont
521
 
522
CS_M_EDIT_Tick_7
523
#if DEFAULT_LCD_WIDTH == 80
524
	;; fill with spaces
525
	call	CS_M_HLP_Print10Spaces
526
#endif
527
	rgoto	CS_M_EDIT_Tick_Cont
528
 
529
 
530
;; ---
531
CS_M_EDIT_Tick_Lower
532
 
533
	;; time to init trigger special chars (if required - function breaks if charset already uploaded)
534
	movlw	CS_MENU_CHARSET_ARROWS
535
	call	CS_SPECIAL_CHARS_Init
536
 
537
	;; print step trigger/auxiliary
538
 
539
	;; determine cursor position
540
	movf	CS_MENU_REFRESH_ITEM_CTR, W
541
	addlw	-8
542
#if DEFAULT_LCD_WIDTH == 80
543
	andlw	0x07
544
	mullw	5
545
	movf	CS_MENU_REFRESH_ITEM_CTR, W
546
	addlw	-8
547
	btfsc	WREG, 3
548
	bsf	PRODL, 7	; switch to right display if item number >= 8
549
	movf	PRODL, W
550
#endif
551
	addlw	0x40		; offset to lower line
552
	call	MIOS_LCD_CursorSet
553
 
554
#if DEFAULT_LCD_WIDTH == 80
555
	;; print two spaces
556
	movlw	2
557
	call	SEQ_LCD_PrintSpaces
558
#endif
559
 
560
	;; print triggers of current step
561
	SET_BSR	SEQ_BASE
120 tk 562
	swapf	SEQ_SELECTED_STEP_VIEW, W, BANKED	; (switches between A/B/C/D view)
97 tk 563
	andlw	0x30
564
	addwf	CS_MENU_REFRESH_ITEM_CTR, W
565
	addlw	-8
566
	movwf	SEQ_EVNTS, BANKED
567
	movff	SEQ_SELECTED_TRK, SEQ_EVNTT
568
 
569
	;; determine special character
570
	;; (we have 4 for no selection, gate, aux, gate/aux
571
	call	SEQ_FSR_TrgGate
572
	call	SEQ_TRG_GetStepBit
573
	andlw	0x01
574
	movwf	TMP1
575
	call	SEQ_FSR_TrgAux
576
	call	SEQ_TRG_GetStepBit
577
	andlw	0x01
578
	skpz
579
	bsf	TMP1, 1
580
 
581
	;; print special character (offset 2 in CS_MENU_CHARSET_ARROWS)
582
	movf	TMP1, W
583
	addlw	2
584
	call	MIOS_LCD_PrintChar
585
 
586
#if DEFAULT_LCD_WIDTH == 80
587
	;; print two spaces
588
	movlw	' '
589
	call	MIOS_LCD_PrintChar
590
#endif
591
	;; 	rgoto	CS_M_EDIT_Tick_Cont
592
 
593
CS_M_EDIT_Tick_Cont
594
	;; Tick function will be called 24 times
595
	incf	CS_MENU_REFRESH_ITEM_CTR, F
596
	movlw	24-1
597
	cpfsgt	CS_MENU_REFRESH_ITEM_CTR, ACCESS
598
	rgoto CS_M_EDIT_Tick_End
599
	clrf	CS_MENU_REFRESH_ITEM_CTR
600
	;; 	rgoto	CS_M_EDIT_Tick_End
601
 
602
CS_M_EDIT_Tick_End
73 tk 603
	return