source: buchla-68k/ram/ptdkey.c@ 7c0efb6

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

Fixed ptdkey.c.

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