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: sid_lcd.inc 44 2008-01-30 21:39:30Z tk $
1 tk 2
;
3
; MIDIbox SID LCD routines
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
;;  Shortcut to MIOS_LCD_PrintChar (can be called with rcall which consumes only 2 bytes)
15
;; --------------------------------------------------------------------------
16
SID_LCD_PrintChar
17
	goto	MIOS_LCD_PrintChar
18
 
19
;; --------------------------------------------------------------------------
20
;;  This functions prints x chars
21
;;  IN:  character in PRODL, number of chars in WREG
22
;;  OUT: x chars
23
;;  USES: PRODH
24
;; --------------------------------------------------------------------------
25
SID_LCD_PrintChars
26
	movwf	PRODH
27
SID_LCD_PrintCharsLoop
28
	movf	PRODL, W
29
	rcall	SID_LCD_PrintChar
30
	decfsz	PRODH, F
31
	rgoto	SID_LCD_PrintCharsLoop
32
	return
33
 
34
;; --------------------------------------------------------------------------
35
;;  This functions prints x spaces
36
;;  IN:  number of spaces in WREG
37
;;  OUT: x spaces
38
;;  USES: PROD[LH]
39
;; --------------------------------------------------------------------------
40
SID_LCD_PrintSpaces
41
	movwf	PRODH
42
	movlw	' '
43
	movwf	PRODL
44
	rgoto	SID_LCD_PrintCharsLoop
45
 
46
;; --------------------------------------------------------------------------
47
;;  help function to print an ensemble number
48
;;  IN: ensemble in SID_ENSEMBLE
49
;;  OUT: 4 characters
50
;; --------------------------------------------------------------------------
51
 
52
SID_LCD_PrintEnsembleNumber
53
	movff	SID_ENSEMBLE, PRODL
54
 
55
SID_LCD_PrintEnsembleNumberPRODL	; label for cs_menu_print.inc to store CS_MENU_SAVE_ENS in PRODL
56
	movlw	'E'
57
	call	SID_LCD_PrintChar
58
 
59
	;; print ensemble number, padded with 0
60
	incf	PRODL, W
61
	clrf	MIOS_PARAMETER1
62
	call	MIOS_HLP_Dec2BCD
63
	movf	MIOS_PARAMETER2, W
64
	call	MIOS_LCD_PrintHex1
65
	movf	MIOS_PARAMETER1, W
66
	goto	MIOS_LCD_PrintHex2
67
 
68
;; --------------------------------------------------------------------------
69
;;  help function to print a patch number
70
;;  + '*' if patch or BankStick not accessible
71
;;  IN: bank in SID_BANK, patch in SID_PATCH
72
;;  OUT: 4 characters
73
;; --------------------------------------------------------------------------
74
SID_LCD_PrintPatchNumber
75
	;; print bank character
76
	movf	SID_BANK, W
77
	addlw	'A'
78
	rcall	SID_LCD_PrintChar
79
 
80
	;; print patch number, padded with 0
81
	incf	SID_PATCH, W
82
	clrf	MIOS_PARAMETER1
83
	call	MIOS_HLP_Dec2BCD
84
	movf	MIOS_PARAMETER2, W
85
	call	MIOS_LCD_PrintHex1
86
	movf	MIOS_PARAMETER1, W
87
	goto	MIOS_LCD_PrintHex2
88
 
89
 
90
;; --------------------------------------------------------------------------
91
;;  help function to print the engine name
92
;;  IN: engine number (0-3) in WREG
93
;;  OUT: 2 characters
94
;; --------------------------------------------------------------------------
95
SID_LCD_PrintEngine
96
	andlw	0x03
97
	TABLE_ADDR_MUL_W SID_LCD_PrintEngine_Tab, 2
98
	movlw	2
99
	goto	MIOS_LCD_PrintPreconfString
100
 
101
SID_LCD_PrintEngine_Tab
102
	db	"Ld", "Bs", "Dr", "Ml"
103
 
104
;; --------------------------------------------------------------------------
105
;;  help function to print the patch name
106
;;  USES: TMP1
107
;; --------------------------------------------------------------------------
108
SID_LCD_PrintPatch
109
	call	CS_MENU_MS_GetSIDBank
110
	movwf	SID_BANK
111
	call	CS_MENU_MS_GetSIDPatch
112
	movwf	SID_PATCH
113
 
114
	movf	SID_BANK, W
115
	bnz	SID_LCD_PrintPatch_BSCheck
116
	movf	SID_PATCH, W
117
	bz	SID_LCD_PrintPatch_NoBSCheck
118
SID_LCD_PrintPatch_BSCheck
119
	call	SID_PBANK_CheckPatchValid
120
	bz	SID_LCD_PrintPatch_BSCheck_Ok
121
	xorlw	2
122
	bz	SID_LCD_PrintPatchNoPtch
123
	rgoto	SID_LCD_PrintPatchNoBS
124
 
125
SID_LCD_PrintPatch_BSCheck_Ok
126
SID_LCD_PrintPatch_NoBSCheck
127
	lfsr	FSR0, SID_EDIT_BUFFER
128
	movlw	SID_Ix_NAME_x
129
	addwf	FSR0L, F
130
	clrf	TMP1
131
	movf	POSTINC0, W
132
	bz	SID_LCD_PrintPatchEmpty
133
 
134
SID_LCD_PrintPatchLoop1
135
	andlw	0x7f
136
	skpnz
137
	movlw	' '
138
	rcall	SID_LCD_PrintChar
139
	movf	POSTINC0, W
140
	incf	TMP1, F
141
	BRA_IFCLR TMP1, 4, ACCESS, SID_LCD_PrintPatchLoop1
142
	return
143
 
144
TEXT_EMPTY_PATCH_0 da "<empty>         "
145
SID_LCD_PrintPatchEmpty
146
	TABLE_ADDR TEXT_EMPTY_PATCH_0
147
SID_LCD_PrintPatchNoBS_Cont
148
	movlw	0x10
149
	goto	MIOS_LCD_PrintPreconfString
150
 
151
 
152
TEXT_EMPTY_PATCH_1 da "<No BankStick>  "
153
SID_LCD_PrintPatchNoBS
154
	TABLE_ADDR TEXT_EMPTY_PATCH_1
155
	rgoto	SID_LCD_PrintPatchNoBS_Cont
156
 
157
TEXT_EMPTY_PATCH_2 da "<only 32k BS>   "
158
SID_LCD_PrintPatchNoPtch
159
	TABLE_ADDR TEXT_EMPTY_PATCH_2
160
	rgoto	SID_LCD_PrintPatchNoBS_Cont
161
 
162
;; --------------------------------------------------------------------------
163
;;  help function to print the patch name directly from EEPROM (used by SAV menu)
164
;;  IN: patch in SID_PATCH, bank in SID_BANK
165
;;  USES: TMP1
166
;; --------------------------------------------------------------------------
167
SID_LCD_PrintPatchEE
168
	movf	SID_BANK, W	; always allow to store in bank #0
169
	bz	SID_LCD_PrintPatchEE_Ok
170
 
171
	;; notify if no bankstick (or invalid patch)
172
	call	SID_PBANK_CheckPatchValid
173
	bz	SID_LCD_PrintPatchEE_Ok
174
	xorlw	2
175
	bz	SID_LCD_PrintPatchNoPtch
176
	rgoto	SID_LCD_PrintPatchNoBS
177
 
178
SID_LCD_PrintPatchEE_Ok
179
	clrf	EEADR		; Patch Name is stored at offset 0
180
	clrf	EEADRH
181
	clrf	TMP1
182
	call	SID_PBANK_Read
183
	andlw	0x7f
184
	bz	SID_LCD_PrintPatchEmpty
185
 
186
SID_LCD_PrintPatchEELoop
187
	rcall	SID_LCD_PrintChar
188
	call	SID_PBANK_Read
189
	andlw	0x7f
190
	skpnz
191
	movlw	' '
192
	incf	TMP1, F
193
	BRA_IFCLR TMP1, 4, ACCESS, SID_LCD_PrintPatchEELoop
194
	return
195
 
196
 
197
;; --------------------------------------------------------------------------
198
;;  This function prints the parameter name (20 characters)
199
;;  called by CS_MENU_ParameterUpdate when Knob/WT parameter assignments are changed
200
;;  to print a temporary message
201
;;  IN: parameter number in WREG
202
;;  USES: PROD[LH], TMP[1234]
203
;; --------------------------------------------------------------------------
204
SID_LCD_LongParName
205
	movwf	TMP1		; temporary store number in TMP1
206
 
207
	;; print number at left side
208
	call	MIOS_LCD_PrintBCD3
209
	movlw	'|'
210
	rcall	SID_LCD_PrintChar
211
 
212
	;; get left/right string part from parameter table (-> sid_par_table.inc)
213
	movf	TMP1, W
214
	movff	SID_EDIT_BUFFER + SID_Ix_ENGINE, TABLAT
215
	call	SID_PAR_TABLE_GetPtr	; expecting engine in TABLAT[1:0]
216
	tblrd*+
217
	movff	TABLAT, TMP2		; left string -> TMP2
218
	tblrd*+
219
	movff	TABLAT, TMP3		; right string -> TMP3
220
 
221
	;; print parameter name (8 characters)
222
	movf	TMP2, W
223
	TABLE_ADDR_MUL_W SID_PAR_S_TABLE, SID_PAR_S_TABLE_WIDTH
224
	movlw	8
225
	call	MIOS_LCD_PrintPreconfString
226
 
227
	;; print space
228
	movlw	' '
229
	rcall	SID_LCD_PrintChar
230
 
231
	;; print target (7 characters)
232
	movf	TMP3, W
233
	JUMPTABLE_2BYTES 19 ; entries
234
	rgoto	SID_LCD_LongParName_NOP
235
	rgoto	SID_LCD_LongParName_OSC
236
	rgoto	SID_LCD_LongParName_FIL
237
	rgoto	SID_LCD_LongParName_KNOB
238
	rgoto	SID_LCD_LongParName_EXT
239
	rgoto	SID_LCD_LongParName_OSC123
240
	rgoto	SID_LCD_LongParName_MOD
241
	rgoto	SID_LCD_LongParName_LFO
242
	rgoto	SID_LCD_LongParName_ENV
243
	rgoto	SID_LCD_LongParName_WT
244
	rgoto	SID_LCD_LongParName_OSC_INS
245
	rgoto	SID_LCD_LongParName_LFO1_INS
246
	rgoto	SID_LCD_LongParName_LFO2_INS
247
	rgoto	SID_LCD_LongParName_ENV_INS
248
	rgoto	SID_LCD_LongParName_OSC_BL
249
	rgoto	SID_LCD_LongParName_LFO_BL
250
	rgoto	SID_LCD_LongParName_ENV_BL
251
	rgoto	SID_LCD_LongParName_DRM_CUR
252
	rgoto	SID_LCD_LongParName_DRM_INS
253
 
254
 
255
SID_LCD_LongParName_NOP
256
	;; print 7 spaces
257
	movlw	7
258
	rgoto	SID_LCD_PrintSpaces
259
 
260
SID_LCD_LongParName_OSC
261
	;; print "OSC    "
262
	movlw	'O'
263
	rcall	SID_LCD_PrintChar
264
	movlw	'S'
265
	rcall	SID_LCD_PrintChar
266
	movlw	'C'
267
	rcall	SID_LCD_PrintChar
268
	movlw	4
269
	rgoto	SID_LCD_PrintSpaces
270
 
271
 
272
SID_LCD_LongParName_FIL_STR
273
	db	"Filter "
274
SID_LCD_LongParName_FIL
275
	;; "Filter "
276
	TABLE_ADDR SID_LCD_LongParName_FIL_STR
277
	movlw	7
278
	goto	MIOS_LCD_PrintPreconfString
279
 
280
SID_LCD_LongParName_KNOB_TAB
281
	db	'1', '2', '3', '4', '5', 'V', 'P', 'A'
282
SID_LCD_LongParName_KNOB
283
	;; print "KNOB#. "
284
	movlw	'K'
285
	rcall	SID_LCD_PrintChar
286
	movlw	'N'
287
	rcall	SID_LCD_PrintChar
288
	movlw	'O'
289
	rcall	SID_LCD_PrintChar
290
	movlw	'B'
291
	rcall	SID_LCD_PrintChar
292
	movlw	'#'
293
	rcall	SID_LCD_PrintChar
294
	movf	TMP1, W
295
	andlw	0x07
296
	TABLE_ADDR_MUL_W SID_LCD_LongParName_KNOB_TAB, 1
297
	tblrd*+
298
	movf	TABLAT, W
299
	rcall	SID_LCD_PrintChar
300
	movlw	' '
301
	rgoto	SID_LCD_PrintChar
302
 
303
SID_LCD_LongParName_EXT
304
	;; print "EXT#.  "
305
	movlw	'E'
306
	rcall	SID_LCD_PrintChar
307
	movlw	'X'
308
	rcall	SID_LCD_PrintChar
309
	movlw	'T'
310
	rcall	SID_LCD_PrintChar
311
	movlw	'#'
312
	rcall	SID_LCD_PrintChar
313
	movf	TMP1, W
314
	andlw	0x07
315
	addlw	1
316
	call	MIOS_LCD_PrintBCD1
317
	movlw	2
318
	rgoto	SID_LCD_PrintSpaces
319
 
320
SID_LCD_LongParName_OSC123
321
	;; print "OSC#123" or "OSC#.  "
322
	movlw	'O'
323
	rcall	SID_LCD_PrintChar
324
	movlw	'S'
325
	rcall	SID_LCD_PrintChar
326
	movlw	'C'
327
	rcall	SID_LCD_PrintChar
328
	movlw	'#'
329
	rcall	SID_LCD_PrintChar
330
	movf	TMP1, W
331
	andlw	0x03
332
	bz	SID_LCD_LongParName_OSC123_All
333
	call	MIOS_LCD_PrintBCD1
334
	movlw	2
335
	rgoto	SID_LCD_PrintSpaces
336
SID_LCD_LongParName_OSC123_All
337
	movlw	'1'
338
	rcall	SID_LCD_PrintChar
339
	movlw	'2'
340
	rcall	SID_LCD_PrintChar
341
	movlw	'3'
342
	rgoto	SID_LCD_PrintChar
343
 
344
SID_LCD_LongParName_MOD
345
	;; print "MOD#.  "
346
	movlw	'M'
347
	rcall	SID_LCD_PrintChar
348
	movlw	'O'
349
	rcall	SID_LCD_PrintChar
350
	movlw	'D'
351
	rcall	SID_LCD_PrintChar
352
	movlw	'#'
353
	rcall	SID_LCD_PrintChar
354
	movf	TMP1, W
355
	andlw	0x07
356
	addlw	1
357
	call	MIOS_LCD_PrintBCD1
358
	movlw	2
359
	rgoto	SID_LCD_PrintSpaces
360
 
361
SID_LCD_LongParName_LFO
362
	;; print "LFO#.  "
363
	movlw	'L'
364
	rcall	SID_LCD_PrintChar
365
	movlw	'F'
366
	rcall	SID_LCD_PrintChar
367
	movlw	'O'
368
	rcall	SID_LCD_PrintChar
369
	movlw	'#'
370
	rcall	SID_LCD_PrintChar
371
	movf	TMP1, W
372
	andlw	0x07
373
	addlw	1
374
	call	MIOS_LCD_PrintBCD1
375
	movlw	2
376
	rgoto	SID_LCD_PrintSpaces
377
 
378
SID_LCD_LongParName_ENV
379
	;; print "ENV#.  "
380
	movlw	'E'
381
	rcall	SID_LCD_PrintChar
382
	movlw	'N'
383
	rcall	SID_LCD_PrintChar
384
	movlw	'V'
385
	rcall	SID_LCD_PrintChar
386
	movlw	'#'
387
	rcall	SID_LCD_PrintChar
388
	swapf	TMP1, W
389
	andlw	0x01
390
	addlw	1
391
	call	MIOS_LCD_PrintBCD1
392
	movlw	2
393
	rgoto	SID_LCD_PrintSpaces
394
 
395
SID_LCD_LongParName_WT
396
	;; print "WT#.   "
397
	movlw	'W'
398
	rcall	SID_LCD_PrintChar
399
	movlw	'T'
400
	rcall	SID_LCD_PrintChar
401
	movlw	'#'
402
	rcall	SID_LCD_PrintChar
403
	movf	TMP1, W
404
	andlw	0x03
405
	addlw	1
406
	call	MIOS_LCD_PrintBCD1
407
	movlw	3
408
	rgoto	SID_LCD_PrintSpaces
409
 
410
SID_LCD_LongParName_OSC_INS
411
	;; print "OSC All", "OSC Cur" or "OSC  Ix" (x=num)
412
	movlw	'O'
413
	rcall	SID_LCD_PrintChar
414
	movlw	'S'
415
	rcall	SID_LCD_PrintChar
416
	movlw	'C'
417
	rcall	SID_LCD_PrintChar
418
	movlw	' '
419
	rcall	SID_LCD_PrintChar
420
	rgoto	SID_LCD_LongParName_INS_Hlp
421
 
422
SID_LCD_LongParName_LFO1_INS
423
	;; print "LFO1All", "LFO1Cur" or "LFO1 Ix" (x=num)
424
	movlw	'L'
425
	rcall	SID_LCD_PrintChar
426
	movlw	'F'
427
	rcall	SID_LCD_PrintChar
428
	movlw	'O'
429
	rcall	SID_LCD_PrintChar
430
	movlw	'1'
431
	rcall	SID_LCD_PrintChar
432
	rgoto	SID_LCD_LongParName_INS_Hlp
433
 
434
SID_LCD_LongParName_LFO2_INS
435
	;; print "LFO2All", "LFO2Cur" or "LFO2 Ix" (x=num)
436
	movlw	'L'
437
	rcall	SID_LCD_PrintChar
438
	movlw	'F'
439
	rcall	SID_LCD_PrintChar
440
	movlw	'O'
441
	rcall	SID_LCD_PrintChar
442
	movlw	'2'
443
	rcall	SID_LCD_PrintChar
444
	rgoto	SID_LCD_LongParName_INS_Hlp
445
 
446
SID_LCD_LongParName_ENV_INS
447
	;; print "ENV All", "ENV Cur" or "ENV  Ix" (x=num)
448
	movlw	'E'
449
	rcall	SID_LCD_PrintChar
450
	movlw	'N'
451
	rcall	SID_LCD_PrintChar
452
	movlw	'V'
453
	rcall	SID_LCD_PrintChar
454
	movlw	' '
455
	rcall	SID_LCD_PrintChar
456
	rgoto	SID_LCD_LongParName_INS_Hlp
457
 
458
SID_LCD_LongParName_OSC_BL
459
	;; print "BL   LR", "BL  Cur", "BL   L-" or "BL   -R"
460
	movlw	'B'
461
	rcall	SID_LCD_PrintChar
462
	movlw	'L'
463
	rcall	SID_LCD_PrintChar
464
	movlw	' '
465
	rcall	SID_LCD_PrintChar
466
	movlw	' '
467
	rcall	SID_LCD_PrintChar
468
	rgoto	SID_LCD_LongParName_BL_Hlp
469
 
470
SID_LCD_LongParName_LFO_BL
471
	;; print "LFOx LR", "LFOxCur", "LFOx L-" or "LFOx -R"
472
	movlw	'L'
473
	rcall	SID_LCD_PrintChar
474
	movlw	'F'
475
	rcall	SID_LCD_PrintChar
476
	movlw	'O'
477
	rcall	SID_LCD_PrintChar
478
	movlw	'1'
479
	btfsc	TMP1, 2
480
	movlw '2'
481
	rcall	SID_LCD_PrintChar
482
	rgoto	SID_LCD_LongParName_BL_Hlp
483
 
484
SID_LCD_LongParName_ENV_BL
485
	;; print "ENV  LR", "ENV Cur", "ENV  L-" or "ENV  -R"
486
	movlw	'E'
487
	rcall	SID_LCD_PrintChar
488
	movlw	'N'
489
	rcall	SID_LCD_PrintChar
490
	movlw	'V'
491
	rcall	SID_LCD_PrintChar
492
	movlw	' '
493
	rcall	SID_LCD_PrintChar
494
	rgoto	SID_LCD_LongParName_BL_Hlp
495
 
496
 
497
SID_LCD_LongParName_DRM_CUR
498
	;; print "Drum Cur"
499
	rcall	SID_LCD_LongParName_DRM_Hlp_Drum
500
	rgoto	SID_LCD_LongParName_DRM_Hlp_C
501
 
502
SID_LCD_LongParName_DRM_INS
503
	;; print "Drum xx" (x=num)
504
	rcall	SID_LCD_LongParName_DRM_Hlp_Drum
505
	movlw	' '
506
	rcall	SID_LCD_PrintChar
507
	movf	TMP1, W
508
	andlw	0x0f
509
	addlw	1
510
	goto	MIOS_LCD_PrintBCD2
511
 
512
 
513
 
514
;; ---
515
;; ---
516
;; ---
517
SID_LCD_LongParName_INS_Hlp
518
	movf	TMP1, W
519
	andlw	0x07
520
	bz	SID_LCD_LongParName_INS_Hlp_A
521
	addlw	-1
522
	bz	SID_LCD_LongParName_INS_Hlp_C
523
SID_LCD_LongParName_INS_Hlp_N
524
	movlw	' '
525
	rcall	SID_LCD_PrintChar
526
	movlw	'I'
527
	rcall	SID_LCD_PrintChar
528
	movf	TMP1, W
529
	andlw	0x07
530
	addlw	-1
531
	goto	MIOS_LCD_PrintBCD1
532
 
533
SID_LCD_LongParName_INS_Hlp_A
534
	movlw	'A'
535
	rcall	SID_LCD_PrintChar
536
	movlw	'l'
537
	rcall	SID_LCD_PrintChar
538
	movlw	'l'
539
	rgoto	SID_LCD_PrintChar
540
 
541
 
542
SID_LCD_LongParName_BL_Hlp
543
	movf	TMP1, W
544
	andlw	0x03
545
	bz	SID_LCD_LongParName_BL_Hlp_A
546
	addlw	-1
547
	bz	SID_LCD_LongParName_BL_Hlp_C
548
SID_LCD_LongParName_BL_Hlp_LR
549
	movlw	' '
550
	rcall	SID_LCD_PrintChar
551
	movlw	'-'
552
	btfss	TMP1, 0
553
	movlw 'L'
554
	rcall	SID_LCD_PrintChar
555
	movlw	'-'
556
	btfsc	TMP1, 0
557
	movlw 'R'
558
	rgoto	SID_LCD_PrintChar
559
 
560
SID_LCD_LongParName_BL_Hlp_A
561
	movlw	' '
562
	rcall	SID_LCD_PrintChar
563
	movlw	'L'
564
	rcall	SID_LCD_PrintChar
565
	movlw	'R'
566
	rgoto	SID_LCD_PrintChar
567
 
568
SID_LCD_LongParName_INS_Hlp_C
569
SID_LCD_LongParName_BL_Hlp_C
570
SID_LCD_LongParName_DRM_Hlp_C
571
	movlw	'C'
572
	rcall	SID_LCD_PrintChar
573
	movlw	'u'
574
	rcall	SID_LCD_PrintChar
575
	movlw	'r'
576
	rgoto	SID_LCD_PrintChar
577
 
578
 
579
SID_LCD_LongParName_DRM_Hlp_Drum
580
	movlw	'D'
581
	rcall	SID_LCD_PrintChar
582
	movlw	'r'
583
	rcall	SID_LCD_PrintChar
584
	movlw	'u'
585
	rcall	SID_LCD_PrintChar
586
	movlw	'm'
587
	rgoto	SID_LCD_PrintChar