source: buchla-68k/ram/ptdkey.c@ 6262b5c

Last change on this file since 6262b5c was 6262b5c, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Added include files for global functions and variables.

  • Property mode set to 100644
File size: 21.4 KB
Line 
1/*
2 =============================================================================
3 ptdkey.c -- MIDAS-VII patch display data entry functions
4 Version 29 -- 1988-12-08 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGPD 0
9#define DEBUGVP 0
10#define DUMPDEF 0
11#define DUMPSTM 0
12
13#include "all.h"
14
15extern void UpdVid(int16_t row, int16_t col, int8_t *str, uint16_t atr);
16extern void ctcon(void);
17extern void dspdest(int8_t *buf, struct patch *pp);
18extern void dspdfst(int8_t *buf, uint16_t val);
19extern void movectc(int16_t r, int16_t c);
20
21#if DEBUGPD
22short debugpd = 1;
23short snappb = 0;
24#endif
25
26#if DEBUGVP
27short debugvp = 1;
28#endif
29
30#if DUMPDEF
31short dumpdef = 0;
32#endif
33
34#if DUMPSTM
35short dumpstm = 0;
36#endif
37
38#if (DEBUGPD|DEBUGVP|DUMPDEF|DUMPSTM)
39extern short debugsw;
40#endif
41
42extern int16_t asig, astat;
43
44extern uint16_t dpepred, dpecpos, dpesucc;
45
46extern int16_t ptegood, ptedfok, ptestok, ptedsok, ptedtok;
47
48extern int16_t ptedef, ptestm, ptespec, ptesuba, ptedat1, ptedat2;
49
50extern int16_t ptedftp, ptedfst, ptedest, ptedata;
51
52extern int16_t pteset, ptbflag, ptemenu;
53
54extern int16_t ptepred, ptecpos, ptesucc;
55
56extern int16_t stccol, stcrow;
57
58extern int8_t ptdebuf[50];
59
60extern struct patch ptebuf;
61
62/*
63
64*/
65
66int16_t dsdecol[5][2][2] = { /* destination data entry column table */
67
68 6, 8, 19, 21, /* 0 -- key, rel -- key number */
69 7, 8, 20, 21, /* 1 -- trg -- trigger number */
70 8, 8, 21, 21, /* 2 -- pls -- pulse number */
71 10, 10, 23, 23, /* 3 -- key, rel -- port number */
72 12, 13, 25, 26 /* 4 -- key, rel -- channel number */
73};
74
75int16_t des2fmt[] = { /* destination type to data entry format */
76
77 -1, 0, 1, 2, 3, 4, 4, 5,
78 4, 4, 6, 9, 6, 6, 6, 10,
79 9, 9, 10, 10, 10, 10, 7, 7,
80 7, 7, 8
81};
82
83int16_t dtabl7[] = { 11, 1, 2, 3, 10 }; /* aux datum format table */
84
85int16_t dtabl9[] = { 11, 1, 2, 3, 9 }; /* FPU datum format table */
86
87/*
88
89*/
90
91/*
92 =============================================================================
93 SnapPTV() -- snap dump patch variables
94 =============================================================================
95*/
96
97void SnapPTV(int8_t *s)
98{
99 register uint16_t stim;
100 register int16_t i;
101 int8_t dbuf[50];
102
103 printf("\n%s(): called SnapPTV()\n", s);
104
105 memcpy(dbuf, ptdebuf, 48);
106
107 for (i = 0; i < 48; i++)
108 if (dbuf[i] EQ '\0')
109 dbuf[i] = ' ';
110 else if (dbuf[i] & 0x0080)
111 dbuf[i] = '~';
112
113 dbuf[48] = '\0';
114
115 printf(" ptdebuf = \"%s\"\n", dbuf);
116
117 printf(" pte $%04.4X $%04.4X $%04.4X $%04.4X $%04.4X $%04.4X\n",
118 ptedef, ptestm, ptespec, ptesuba, ptedat1, ptedat2);
119
120 printf(" ptb $%04.4X $%04.4X $%04.4X $%04.4X $%04.4X $%04.4X\n",
121 ptebuf.defnum, ptebuf.stmnum, ptebuf.paspec,
122 ptebuf.pasuba, ptebuf.padat1, ptebuf.padat2);
123
124 printf(" pte dftp: %2d dfst: %2d dest: %2d data: %2d menu: %2d\n",
125 ptedftp, ptedfst, ptedest, ptedata, ptemenu);
126
127 printf(" pte good: %d dfok: %d stok: %d dsok: %d dtok: %d set: %d flag: %d\n",
128 ptegood, ptedfok, ptestok, ptedsok, ptedtok, pteset, ptbflag);
129
130 printf(" pte pred: %3d cpos: %3d succ: %3d\n",
131 ptepred, ptecpos, ptesucc);
132
133/*
134
135*/
136
137#if DUMPDEF
138
139 if (dumpdef) {
140
141 printf(" dpe pred: %3d cpos: %3d succ: %3d\n",
142 dpepred, dpecpos, dpesucc);
143
144 for (stim = 0; stim < NDEFSTMS; stim++) {
145
146 if (defptr[stim]) {
147
148 printf(" defptr[$%04.4X] = %3d%s\n",
149 stim, defptr[stim],
150 ((TRG_MASK & ptedef) EQ stim) ?
151 " <-- ptedef" : "");
152 }
153 }
154 }
155#endif
156
157#if DUMPSTM
158 if (dumpstm) {
159
160 for (stim = 0; stim < NDEFSTMS; stim++)
161 if (stmptr[stim])
162 printf(" stmptr[$%04.4X] = %3d%s\n",
163 stim, stmptr[stim],
164 ((TRG_MASK & ptestm) EQ stim) ?
165 " <-- ptestm" : "");
166 }
167#endif
168
169 printf("\n");
170}
171
172/*
173
174*/
175
176/*
177 =============================================================================
178 buf2pte() -- pack the patch buffer
179 =============================================================================
180*/
181
182void buf2pte(void)
183{
184 ptebuf.defnum = ptedef;
185 ptebuf.stmnum = ptestm;
186 ptebuf.paspec = ptespec;
187 ptebuf.pasuba = ptesuba;
188 ptebuf.padat1 = ptedat1;
189 ptebuf.padat2 = ptedat2;
190
191 pteset = TRUE;
192
193#if DEBUGPD
194 if (debugsw AND debugpd) {
195
196 if (snappb)
197 SnapPTV("buf2pte");
198
199 printf("buf2pte(): ptebuf setup\n");
200 }
201#endif
202
203}
204
205/*
206
207*/
208
209/*
210 =============================================================================
211 voidpb() -- void the patch buffer
212 =============================================================================
213*/
214
215void voidpb(void)
216{
217 memset(ptdebuf, ' ', 50); /* clear data entry buffer */
218
219 ptebuf.defnum = ptedef = NULL_DEF; /* blank definer */
220 ptebuf.stmnum = ptestm = 0x0000;
221 ptebuf.paspec = ptespec = 0x0000;
222 ptebuf.pasuba = ptesuba = 0x0000;
223 ptebuf.padat1 = ptedat1 = 0x0000;
224 ptebuf.padat2 = ptedat2 = 0x0000;
225
226 ptbflag = FALSE;
227
228 pteset = FALSE;
229
230 ptegood = FALSE;
231
232 ptedfok = TRUE; /* definer is OK until it's screwed up */
233 ptestok = FALSE;
234 ptedsok = FALSE;
235 ptedtok = FALSE;
236
237 ptedfst = -1;
238 ptedest = -1;
239 ptedata = -1;
240
241#if DEBUGVP
242 if (debugsw AND debugvp) {
243
244 if (snappb)
245 SnapPTV("voidpb");
246
247 printf("voidpb(): patch buffer VOIDED\n");
248 }
249#endif
250
251}
252
253/*
254
255*/
256
257/*
258 =============================================================================
259
260 =============================================================================
261*/
262
263void setptcv(void)
264{
265 register uint16_t spec;
266
267 ptedest = des2fmt[spec = ptespec & PE_SPEC];
268
269 switch (ptedest) { /* setup datum entry format */
270
271 case 0: /* key */
272 case 2: /* pulse */
273
274 ptedata = 8;
275 break;
276
277 case 1: /* trigger */
278
279 ptedata = 9;
280 break;
281
282 case 3: /* led */
283
284 ptedata = 14;
285 break;
286/*
287
288*/
289 case 4: /* seq, reg */
290
291 if (spec EQ PA_SLIN)
292 ptedata = 13;
293 else if (spec EQ PA_SCTL)
294 ptedata = 9;
295 else
296 ptedata = 12;
297
298 break;
299
300 case 5: /* tuning */
301
302 ptedata = 18;
303 break;
304
305 case 6: /* inst, wave, config */
306
307 if (spec EQ PA_INST)
308 ptedata = 15;
309 else if (spec EQ PA_CNFG)
310 ptedata = 17;
311 else
312 ptedata = 16;
313
314 break;
315
316 case 7: /* aux, rate, inten, dpth */
317 case 8: /* vout */
318
319 ptedata = dtabl7[ptedat1];
320 break;
321
322 case 9: /* osc, ind, frq */
323 case 10: /* level, filtr, fil q, loctn, dynmc */
324
325 if (spec EQ PA_OSC)
326 ptedata = ptedat1 + 4;
327 else
328 ptedata = dtabl9[ptedat1];
329
330 break;
331
332 default: /* something weird got in here somehow ... */
333
334#if DEBUGPD
335 if (debugsw AND debugpd)
336 printf("setptcv(): BAD ptedest ($%04.4X), spec = $%04.4X\n",
337 ptedest, spec);
338#endif
339
340 ptedata = -1;
341 break;
342 }
343}
344
345/*
346
347*/
348
349/*
350 =============================================================================
351 pte2buf() -- convert ptebuf to ptdebuf format and load edit variables
352 =============================================================================
353*/
354
355void pte2buf(void)
356{
357 register uint16_t spec;
358
359 memset(ptdebuf, ' ', 50);
360
361 ptbflag = TRUE;
362
363 if (pteset) { /* if ptebuf is valid ... */
364
365 ptedef = ptebuf.defnum; /* ... setup the edit variables */
366 ptestm = ptebuf.stmnum;
367 ptespec = ptebuf.paspec;
368 ptesuba = ptebuf.pasuba;
369 ptedat1 = ptebuf.padat1;
370 ptedat2 = ptebuf.padat2;
371
372 setptcv(); /* setup control variables */
373
374 dspdfst(&ptdebuf[ 2], ptedef); /* setup the patch buffer */
375 dspdfst(&ptdebuf[15], ptestm);
376 dspdest(&ptdebuf[28], &ptebuf);
377 ptdebuf[ 0] = ' ';
378 ptdebuf[ 1] = ' ';
379 ptdebuf[14] = ' ';
380 ptdebuf[27] = ' ';
381
382/*
383
384*/
385 ptegood = TRUE; /* validate the patch buffer */
386 ptedfok = TRUE;
387 ptestok = TRUE;
388 ptedsok = TRUE;
389 ptedtok = TRUE;
390
391#if DEBUGPD
392 if (debugsw AND debugpd) {
393
394 if (snappb)
395 SnapPTV("pte2buf");
396
397 printf("pte2buf(): patch buffer LOADED\n");
398 }
399#endif
400
401 } else {
402
403 voidpb(); /* void the patch buffer */
404
405#if DEBUGPD
406 if (debugsw AND debugpd)
407 printf("pte2buf(): patch buffer VOIDED\n");
408#endif
409
410 }
411}
412
413/*
414
415*/
416
417/*
418 =============================================================================
419 ptde_ds() -- digit data entry for definer / stimulus fields
420 =============================================================================
421*/
422
423void ptde_ds(int16_t n, int16_t key)
424{
425 register int16_t chan, port, stim;
426 int8_t buf[8], buf2[8];
427
428 if (n ? ptestok : ptedfok) {
429
430 if ((n EQ 0) AND (ptedef EQ 0xFFFF))
431 return;
432
433 port = ((n ? ptestm : ptedef) >> 11) & 0x0003;
434 chan = ((n ? ptestm : ptedef) >> 7) & 0x000F;
435 stim = (n ? ptestm : ptedef) & 0x007F;
436
437 if ((port EQ 0) OR (port EQ 1) OR ((port EQ 2) AND (chan < 2))) {
438
439 /* Key / Rel */
440
441 if (inrange(stccol, dsdecol[0][n][0], dsdecol[0][n][1]) OR
442 inrange(stccol, dsdecol[3][n][0], dsdecol[3][n][1]) OR
443 inrange(stccol, dsdecol[4][n][0], dsdecol[4][n][1])) {
444
445 if (stccol EQ dsdecol[3][n][1]) {
446
447 if ((key < 1) OR (key > 3))
448 return;
449
450 if (key EQ 3) {
451
452 buf[0] = 'L';
453 UpdVid(7, n ? 25 : 12, " ", PTDATR);
454
455 if (n)
456 ptestm &= 0xF87F;
457 else
458 ptedef &= 0xF87F;
459
460 } else {
461
462 sprintf(buf2, "%02d", 1 + chan);
463 buf[0] = key + '0';
464 UpdVid(7, n ? 25 : 12, buf2, PTDATR);
465 }
466/*
467
468*/
469 port = key - 1;
470
471 if (n)
472 ptestm = (ptestm & 0xE7FF) | (port << 11);
473 else
474 ptedef = (ptestm & 0xE7FF) | (port << 11);
475
476 } else {
477
478 buf[0] = key + '0';
479 }
480
481 ptdebuf[stccol] = buf[0];
482 buf[1] = '\0';
483
484 UpdVid(7, stccol, buf, PTDATR);
485
486 if (stccol EQ dsdecol[4][n][1]) {
487
488 ctcon();
489 return;
490 }
491
492 if ((stccol EQ dsdecol[0][n][1]) OR
493 (stccol EQ dsdecol[3][n][1]))
494 ++stccol;
495
496 movectc(stcrow, ++stccol);
497 }
498
499 return;
500/*
501
502*/
503 } else if ((port EQ 2) AND (chan EQ 2)) {
504
505 /* Trig */
506
507 if (inrange(stccol, dsdecol[1][n][0], dsdecol[1][n][1])) {
508
509 ptdebuf[stccol] = key + '0';
510 buf[0] = key + '0';
511 buf[1] = '\0';
512
513 UpdVid(7, stccol, buf, PTDATR);
514
515 if (stccol EQ dsdecol[1][n][1]) {
516
517 ctcon();
518 return;
519 }
520
521 movectc(stcrow, ++stccol);
522 }
523
524 return;
525
526 } else if ((port EQ 2) AND (chan EQ 3)) {
527
528 /* Pulse */
529
530 if (stccol EQ dsdecol[2][n][1]) {
531
532 if ((key < 1) OR (key > 2))
533 return;
534
535 ptdebuf[stccol] = key + '0';
536 buf[0] = key + '0';
537 buf[1] = '\0';
538
539 UpdVid(7, stccol, buf, PTDATR);
540 ctcon();
541 }
542
543 return;
544 }
545 }
546}
547
548/*
549
550*/
551
552/*
553 =============================================================================
554 ptdkey() -- patch digit data entry function
555 =============================================================================
556*/
557
558void ptdkey(int16_t k)
559{
560 register int16_t key, val, vg;
561 int8_t buf[8];
562
563 if (NOT astat) /* only do this on key closures */
564 return;
565
566 if (NOT ptbflag) /* load up the edit buffer */
567 pte2buf();
568
569 key = asig - 60;
570
571 if (inrange(stccol, 2, 13)) { /* DEFINER */
572
573 ptde_ds(0, key);
574 return;
575
576 } else if (inrange(stccol, 15, 26)) { /* STIMULUS */
577
578 ptde_ds(1, key);
579 return;
580/*
581
582*/
583 } else if (inrange(stccol, 28, 40)) { /* DESTINATION */
584
585 if (ptedsok) {
586
587 switch (ptedest) {
588
589 case 0: /* key */
590
591 if (inrange(stccol, 30, 32) OR
592 (stccol EQ 34) OR
593 inrange(stccol, 36, 37)) {
594
595 if (stccol EQ 34) {
596
597 if ((key < 1) OR (key > 3))
598 return;
599
600 if (key EQ 3)
601 buf[0] = 'L';
602 else
603 buf[0] = key + '0';
604
605 } else {
606
607 buf[0] = key + '0';
608 }
609
610 ptdebuf[stccol] = buf[0];
611 buf[1] = '\0';
612
613 UpdVid(7, stccol, buf, PTDATR);
614
615 if ((stccol EQ 32) OR (stccol EQ 34))
616 ++stccol;
617
618 if (stccol EQ 37)
619 ctcon();
620 else
621 movectc(stcrow, ++stccol);
622 }
623
624 return;
625/*
626
627*/
628 case 1: /* trg */
629
630 if (inrange(stccol, 36, 37)) {
631
632 ptdebuf[stccol] = key + '0';
633 buf[0] = key + '0';
634 buf[1] = '\0';
635
636 UpdVid(7, stccol, buf, PTDATR);
637
638 if (stccol EQ 37)
639 ctcon();
640 else
641 movectc(stcrow, ++stccol);
642 }
643
644 return;
645
646 case 2: /* pls */
647
648 if (stccol EQ 34) {
649
650 if ((key < 1) OR (key > 2))
651 return;
652
653 ptdebuf[stccol] = key + '0';
654 buf[0] = key + '0';
655 buf[1] = '\0';
656
657 UpdVid(7, stccol, buf, PTDATR);
658 ctcon();
659 }
660
661 return;
662/*
663
664*/
665 case 3: /* led */
666
667 if (stccol EQ 32) {
668
669 if (key > 6)
670 return;
671
672 ptdebuf[stccol] = key + 'A';
673 buf[0] = key + 'A';
674 buf[1] = '\0';
675
676 UpdVid(7, stccol, buf, PTDATR);
677 ctcon();
678 }
679
680 return;
681
682 case 4: /* seqlin, seqctl, regset, regadd */
683
684 if (inrange(stccol, 32, 33)) {
685
686 ptdebuf[stccol] = key + '0';
687 buf[0] = key + '0';
688 buf[1] = '\0';
689
690 UpdVid(7, stccol, buf, PTDATR);
691
692 if (stccol EQ 33)
693 ctcon();
694 else
695 movectc(stcrow, ++stccol);
696 }
697
698 return;
699/*
700
701*/
702 case 5: /* tune */
703 case 7: /* aux, rate, inten, depth */
704
705 return;
706
707 case 8: /* v out */
708
709 if (stccol EQ 32) {
710
711 if ((key < 1) OR (key > 5))
712 return;
713
714 ptdebuf[stccol] = key + '0';
715 buf[0] = key + '0';
716 buf[1] = '\0';
717
718 UpdVid(7, stccol, buf, PTDATR);
719 movectc(DATAROW, 34);
720 }
721
722 return;
723
724 case 9: /* osc, index, freq */
725
726 if (stccol EQ 32) {
727
728 if ((key < 1) OR (key > 4))
729 return;
730
731 ptdebuf[stccol] = key + '0';
732 buf[0] = key + '0';
733 buf[1] = '\0';
734
735 UpdVid(7, stccol, buf, PTDATR);
736 movectc(DATAROW, 34);
737 return;
738 }
739
740 /* FALL-THROUGH to handle v/g in columns 39..40 */
741/*
742
743*/
744 case 6: /* inst, wava, wavb, conf */
745 case 10: /* level, filtr, fil q, loctn, dynmc */
746
747 if (inrange(stccol, 39, 40)) {
748
749 vg = (ptesuba >> 8) & 0x00FF;
750
751 if (stccol EQ 39) {
752
753 if ((key EQ 8) OR (key EQ 9)) {
754
755 if (vg > 11) {
756
757 vg -= 12;
758 val = 'V';
759
760 } else {
761
762 vg += 12;
763 val = 'G';
764 }
765
766 ptesuba = (ptesuba & 0x00FF) |
767 (vg << 8);
768
769 } else {
770
771 return;
772 }
773/*
774
775*/
776 } else { /* column 40 */
777
778 if ( ((vg EQ 0) OR (vg EQ 12)) AND
779 ((key EQ 0) OR (key EQ 1) OR (key EQ 2)) )
780 key += 10;
781 else if (key EQ 0)
782 return;
783
784 val = key + ((key > 9) ? '\242' :'0') ;
785
786 --key;
787
788 if (vg > 11)
789 vg = key + 12;
790 else
791 vg = key;
792
793 ptesuba = (ptesuba & 0x00FF) |
794 (vg << 8);
795 }
796
797 ptdebuf[stccol] = val;
798 buf[0] = val;
799 buf[1] = '\0';
800
801 UpdVid(7, stccol, buf, PTDATR);
802
803 if (stccol EQ 40)
804 ctcon();
805 else
806 movectc(stcrow, ++stccol);
807 }
808
809 return;
810
811 default: /* Eh ? */
812
813 return;
814 }
815 }
816/*
817
818*/
819 } else if (inrange(stccol, 42, 46)) { /* DATUM */
820
821 switch (ptedata) {
822
823 case 1: /* multiplier -- +1.00 */
824
825 switch (stccol) {
826
827 case 42: /* + | - */
828
829 if (key EQ 8)
830 buf[0] = '-';
831 else if (key EQ 9)
832 buf[0] = '+';
833 else
834 return;
835
836 break;
837
838 case 43: /* 0 | 1 */
839
840 if ((key EQ 0) OR (key EQ 1))
841 buf[0] = key + '0';
842 else
843 return;
844
845 break;
846
847 case 45: /* 0..9 */
848 case 46: /* 0..9 */
849
850 buf[0] = key + '0';
851 break;
852
853 case 44: /* . */
854 default:
855
856 return;
857 }
858/*
859
860*/
861 buf[1] = '\0';
862 ptdebuf[stccol] = buf[0];
863
864 UpdVid(7, stccol, buf, PTDATR);
865
866 if (stccol EQ 43)
867 ++stccol;
868
869 if (stccol EQ 46)
870 ctcon();
871 else
872 movectc(stcrow, ++stccol);
873
874 return;
875/*
876
877*/
878 case 2: /* time -- 32767 */
879
880 if ((stccol EQ 42) AND (key > 3))
881 return;
882
883 buf[0] = key + '0';
884 buf[1] = '\0';
885 ptdebuf[stccol] = buf[0];
886
887 UpdVid(7, stccol, buf, PTDATR);
888
889 if (stccol EQ 46)
890 ctcon();
891 else
892 movectc(stcrow, ++stccol);
893
894 return;
895
896/*
897
898*/
899 case 3: /* value -- +10.00 */
900
901 switch (stccol) {
902
903 case 42:
904
905 if (key EQ 8) {
906
907 if (ptdebuf[42] EQ '\240')
908 buf[0] = '\241';
909 else if (ptdebuf[42] EQ '\241')
910 buf[0] = '\241';
911 else
912 buf[0] = '-';
913
914 } else if (key EQ 9) {
915
916 if (ptdebuf[42] EQ '\240')
917 buf[0] = '\240';
918 else if (ptdebuf[42] EQ '\241')
919 buf[0] = '\240';
920 else
921 buf[0] = '+';
922
923 } else if (key EQ 0) {
924
925 if (ptdebuf[42] EQ '\240')
926 buf[0] = '+';
927 else if (ptdebuf[42] EQ '\241')
928 buf[0] = '-';
929 else
930 return;
931
932 } else if (key EQ 1) {
933
934 if (ptdebuf[42] EQ '\240')
935 buf[0] = '\240';
936 else if (ptdebuf[42] EQ '\241')
937 buf[0] = '\241';
938 else if (ptdebuf[42] EQ '+')
939 buf[0] = '\240';
940 else if (ptdebuf[42] EQ '-')
941 buf[0] = '\241';
942 else
943 return;
944
945 } else
946 return;
947
948 break;
949/*
950
951*/
952 case 43:
953 case 45:
954 case 46:
955
956 buf[0] = key + '0';
957 break;
958
959 case 44:
960 default:
961 return;
962 }
963
964 buf[1] = '\0';
965 ptdebuf[stccol] = buf[0];
966
967 UpdVid(7, stccol, buf, PTDATR);
968
969 if (stccol EQ 43)
970 ++stccol;
971
972 if (stccol EQ 46)
973 ctcon();
974 else
975 movectc(stcrow, ++stccol);
976
977 return;
978/*
979
980*/
981 case 4: /* interval -- +1200 */
982
983 if (stccol EQ 42) {
984
985 if (key EQ 8)
986 buf[0] = '-';
987 else if (key EQ 9)
988 buf[0] = '+';
989 else
990 return;
991
992 } else if (stccol EQ 43) {
993
994 if (key > 1)
995 return;
996 else
997 buf[0] = key + '0';
998
999 } else {
1000
1001 buf[0] = key + '0';
1002 }
1003
1004 ptdebuf[stccol] = buf[0];
1005 buf[1] = '\0';
1006
1007 UpdVid(7, stccol, buf, PTDATR);
1008
1009 if (stccol EQ 46)
1010 ctcon();
1011 else
1012 movectc(stcrow, ++stccol);
1013
1014 return;
1015/*
1016
1017*/
1018 case 5: /* ratio -- 9/9 */
1019
1020 switch (stccol) {
1021
1022 case 42:
1023 case 44:
1024
1025 buf[0] = key +'0';
1026 break;
1027
1028 case 43:
1029 case 45:
1030 case 46:
1031
1032 return;
1033 }
1034
1035 ptdebuf[stccol] = buf[0];
1036 buf[1] = '\0';
1037
1038 UpdVid(7, stccol, buf, PTDATR);
1039
1040 if (stccol EQ 42)
1041 ++stccol;
1042
1043 if (stccol EQ 44)
1044 ctcon();
1045 else
1046 movectc(stcrow, ++stccol);
1047
1048 return;
1049/*
1050
1051*/
1052 case 6: /* frequency -- 15.9 */
1053
1054 switch (stccol) {
1055
1056 case 42:
1057
1058 if (key > 1)
1059 return;
1060
1061 /* FALL-THROUGH */
1062
1063 case 43:
1064 case 45:
1065
1066 buf[0] = key + '0';
1067 break;
1068
1069 case 44:
1070 case 46:
1071
1072 return;
1073 }
1074
1075 ptdebuf[stccol] = buf[0];
1076 buf[1] = '\0';
1077
1078 UpdVid(7, stccol, buf, PTDATR);
1079
1080 if (stccol EQ 43)
1081 ++stccol;
1082
1083 if (stccol EQ 45)
1084 ctcon();
1085 else
1086 movectc(stcrow, ++stccol);
1087
1088 return;
1089/*
1090
1091*/
1092 case 7: /* pitch -- 9C#99 */
1093
1094 switch (stccol) {
1095
1096 case 43:
1097
1098 if (key > 6)
1099 return;
1100
1101 buf[0] = key + 'A';
1102 break;
1103
1104 case 44:
1105
1106 if (key EQ 7)
1107 buf[0] = ' ';
1108 else if (key EQ 8)
1109 buf[0] = '\251';
1110 else if (key EQ 9)
1111 buf[0] = '\250';
1112 else
1113 return;
1114
1115 break;
1116
1117 case 42:
1118 case 45:
1119 case 46:
1120
1121 buf[0] = key + '0';
1122 break;
1123 }
1124
1125 ptdebuf[stccol] = buf[0];
1126 buf[1] = '\0';
1127
1128 UpdVid(7, stccol, buf, PTDATR);
1129
1130 if (stccol EQ 46)
1131 ctcon();
1132 else
1133 movectc(stcrow, ++stccol);
1134
1135 return;
1136/*
1137
1138*/
1139 case 8: /* trans | stop | start */
1140
1141 switch (key) {
1142
1143 case 7: /* trans */
1144
1145 strcpy(buf, "Trans");
1146 ptedat2 = 0;
1147 break;
1148
1149 case 8: /* stop */
1150
1151 strcpy(buf, "Stop ");
1152 ptedat2 = 1;
1153 break;
1154
1155 case 9: /* start */
1156
1157 strcpy(buf, "Start");
1158 ptedat2 = 2;
1159 break;
1160
1161 default:
1162
1163 return;
1164 }
1165
1166 strcpy(&ptdebuf[42], buf);
1167 UpdVid(7, 42, buf, PTDATR);
1168 movectc(stcrow, 46);
1169 return;
1170/*
1171
1172*/
1173 case 9: /* stop | start */
1174
1175 if (key EQ 8) { /* stop */
1176
1177 strcpy(buf, "Stop ");
1178 ptedat2 = 0;
1179
1180 } else if (key EQ 9) { /* start */
1181
1182 strcpy(buf, "Start");
1183 ptedat2 = 1;
1184
1185 } else {
1186
1187 return;
1188 }
1189
1190 strcpy(&ptdebuf[42], buf);
1191 UpdVid(7, 42, buf, PTDATR);
1192 movectc(stcrow, 46);
1193 return;
1194
1195 case 10: /* off | on */
1196
1197 if (key EQ 8) { /* off */
1198
1199 strcpy(buf, "Off ");
1200 ptedat2 = 0;
1201
1202 } else if (key EQ 9) { /* on */
1203
1204 strcpy(buf, "On ");
1205 ptedat2 = 1;
1206
1207 } else {
1208
1209 return;
1210 }
1211
1212 strcpy(&ptdebuf[42], buf);
1213 UpdVid(7, 42, buf, PTDATR);
1214 movectc(stcrow, 46);
1215 return;
1216/*
1217
1218*/
1219 case 11: /* source */
1220
1221 return;
1222
1223 case 12: /* register | value */
1224
1225 switch (stccol) {
1226
1227 case 42:
1228
1229 if (key EQ 7)
1230 buf[0] = 'R';
1231 else if (key EQ 8 AND ((PE_SPEC & ptespec) NE PA_RSET))
1232 buf[0] = '-';
1233 else if (key EQ 9)
1234 buf[0] = '+';
1235 else
1236 return;
1237
1238 break;
1239
1240 case 43:
1241 case 44:
1242
1243 buf[0] = key + '0';
1244 break;
1245
1246 default:
1247
1248 return;
1249 }
1250
1251 ptdebuf[stccol] = buf[0];
1252 buf[1] = '\0';
1253
1254 UpdVid(7, stccol, buf, PTDATR);
1255
1256 if (stccol EQ 44)
1257 ctcon();
1258 else
1259 movectc(stcrow, ++stccol);
1260
1261 return;
1262/*
1263
1264*/
1265 case 13: /* sequence line */
1266
1267 if (stccol > 44)
1268 return;
1269
1270 buf[0] = key + '0';
1271 ptdebuf[stccol] = buf[0];
1272 buf[1] = '\0';
1273
1274 UpdVid(7, stccol, buf, PTDATR);
1275
1276 if (stccol EQ 44)
1277 ctcon();
1278 else
1279 movectc(stcrow, ++stccol);
1280
1281 return;
1282
1283 case 14: /* LED controls */
1284
1285 if ((key > 3) OR (stccol EQ 46))
1286 return;
1287
1288 if ((stccol EQ 45) AND (0 EQ (ptesuba & 0x0001)))
1289 return;
1290
1291 buf[0] = key + '0';
1292 buf[1] = '\0';
1293 ptdebuf[stccol] = buf[0];
1294
1295 UpdVid(7, stccol, buf, PTDATR);
1296
1297 if (((ptesuba & 0x0001) AND (stccol EQ 45)) OR
1298 ((0 EQ ptesuba & 0x0001) AND (stccol EQ 44)))
1299 ctcon();
1300 else
1301 movectc(stcrow, ++stccol);
1302
1303 return;
1304/*
1305
1306*/
1307 case 15: /* instrument number */
1308
1309 if (stccol > 43)
1310 return;
1311
1312 if ((stccol EQ 42) AND (key > 4))
1313 return;
1314
1315 buf[0] = key + '0';
1316 buf[1] = '\0';
1317 ptdebuf[stccol] = buf[0];
1318
1319 UpdVid(7, stccol, buf, PTDATR);
1320
1321 if (stccol EQ 43)
1322 ctcon();
1323 else
1324 movectc(stcrow, ++stccol);
1325
1326 return;
1327/*
1328
1329*/
1330 case 16: /* waveshape number */
1331
1332 if (stccol > 43)
1333 return;
1334
1335 if ((stccol EQ 42) AND (key > 2))
1336 return;
1337
1338 buf[0] = key + '0';
1339 buf[1] = '\0';
1340 ptdebuf[stccol] = buf[0];
1341
1342 UpdVid(7, stccol, buf, PTDATR);
1343
1344 if (stccol EQ 43)
1345 ctcon();
1346 else
1347 movectc(stcrow, ++stccol);
1348
1349 return;
1350
1351 case 17: /* configuration number */
1352
1353 if (stccol > 43)
1354 return;
1355
1356 if ((stccol EQ 42) AND (key > 1))
1357 return;
1358
1359 buf[0] = key + '0';
1360 buf[1] = '\0';
1361 ptdebuf[stccol] = buf[0];
1362
1363 UpdVid(7, stccol, buf, PTDATR);
1364
1365 if (stccol EQ 43)
1366 ctcon();
1367 else
1368 movectc(stcrow, ++stccol);
1369
1370 return;
1371/*
1372
1373*/
1374 case 18: /* tuning table number */
1375
1376 if (stccol > 42)
1377 return;
1378
1379 buf[0] = key + '0';
1380 buf[1] = '\0';
1381 ptdebuf[stccol] = buf[0];
1382
1383 UpdVid(7, stccol, buf, PTDATR);
1384
1385 ctcon();
1386 return;
1387
1388 default:
1389
1390 return;
1391 }
1392 }
1393}
1394
Note: See TracBrowser for help on using the repository browser.