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

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

Added missing includes and declarations.

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