1 | /*
|
---|
2 | =============================================================================
|
---|
3 | ptselbx.c -- MIDAS-VII Patch editor box selection functions
|
---|
4 | Version 45 -- 1988-12-08 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #define DEBUGIT 0
|
---|
9 | #define SNAPDUMP 0
|
---|
10 |
|
---|
11 | #include "ram.h"
|
---|
12 |
|
---|
13 | #if SNAPDUMP
|
---|
14 | short snapit = 0;
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | #if (SNAPDUMP|DEBUGIT)
|
---|
18 | short debug01 = 1;
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | #define HT_0 0x01 /* definer, stimulus */
|
---|
22 | #define HT_1 0x02 /* source */
|
---|
23 | #define HT_2 0x04 /* destination */
|
---|
24 | #define HT_3 0x08 /* oscillator */
|
---|
25 | #define HT_4 0x10 /* level, index, freq, location, filter */
|
---|
26 | #define HT_5 0x20 /* filq, dynamc, vout, depth, rate, inten, aux */
|
---|
27 | #define HT_OFF 0x00 /* no submenu highlighted */
|
---|
28 |
|
---|
29 | int16_t ptegood; /* pte buffer -- entire entry valid flag */
|
---|
30 |
|
---|
31 | int16_t ptedfok; /* pte buffer -- def valid flag */
|
---|
32 | int16_t ptestok; /* pte buffer -- stm valid flag */
|
---|
33 | int16_t ptedsok; /* pte buffer -- destination valid flag */
|
---|
34 | int16_t ptedtok; /* pte buffer -- datum valid flag */
|
---|
35 |
|
---|
36 | int16_t ptedef; /* pte buffer -- definer number */
|
---|
37 | int16_t ptestm; /* pte buffer -- stimulus number */
|
---|
38 | int16_t ptespec; /* pte buffer -- address type */
|
---|
39 | int16_t ptesuba; /* pte buffer -- sub-address */
|
---|
40 | int16_t ptedat1; /* pte buffer -- data word 1 */
|
---|
41 | int16_t ptedat2; /* pte buffer -- data word 2 */
|
---|
42 |
|
---|
43 | int16_t ptedftp; /* definer / stimulus entry flag */
|
---|
44 |
|
---|
45 | int16_t ptedfst; /* current definer/stimulus data entry format */
|
---|
46 | int16_t ptedest; /* current destination data entry format */
|
---|
47 | int16_t ptedata; /* current datum data entry format */
|
---|
48 |
|
---|
49 | int16_t ptemenu; /* current submenu highlighting */
|
---|
50 |
|
---|
51 | int16_t pteset; /* pte buffer setup flag */
|
---|
52 | int16_t ptbflag; /* pdbuf setup flag */
|
---|
53 |
|
---|
54 | int16_t ptecpos; /* current patch entry index */
|
---|
55 | int16_t ptepred; /* predecessor entry index */
|
---|
56 | int16_t ptesucc; /* successor entry index */
|
---|
57 |
|
---|
58 | struct patch ptebuf; /* pte buffer -- patch table format */
|
---|
59 |
|
---|
60 | int8_t ptdebuf[50]; /* patch edit buffer */
|
---|
61 |
|
---|
62 | int8_t *rawdfst[] = { /* def/stm field initial contents */
|
---|
63 |
|
---|
64 | "Key 001 1 01",
|
---|
65 | "Rel 001 1 01",
|
---|
66 | "Trig 01 ",
|
---|
67 | "Pulse 1 "
|
---|
68 | };
|
---|
69 |
|
---|
70 | int8_t *rawdest[] = { /* destination field initial contents */
|
---|
71 |
|
---|
72 | "??????? 00 ??", /* ?????? 00 */
|
---|
73 | "K 001 1 01 ", /* PA_KEY 01 */
|
---|
74 | "Trigger 01 ", /* PA_TRG 02 */
|
---|
75 | "Pulse 1 ", /* PA_PLS 03 */
|
---|
76 | "LED A ", /* PA_LED 04 */
|
---|
77 | "Seq 01 Lin ", /* PA_SLIN 05 */
|
---|
78 | "Seq 01 Ctl ", /* PA_SCTL 06 */
|
---|
79 | "Tune Table ", /* PA_TUNE 07 */
|
---|
80 | "Reg 01 Set ", /* PA_RSET 08 */
|
---|
81 | "Reg 01 Add ", /* PA_RADD 09 */
|
---|
82 | "Instrument V1", /* PA_INST 10 */
|
---|
83 | "Osc 1 Int V1", /* PA_OSC 11 */
|
---|
84 | "WaveshapeA V1", /* PA_WAVA 12 */
|
---|
85 | "WaveshapeB V1", /* PA_WAVB 13 */
|
---|
86 | "Configure V1", /* PA_CNFG 14 */
|
---|
87 | "Level Srce V1", /* PA_LEVL 15 */
|
---|
88 | "Ind 1 Srce V1", /* PA_INDX 16 */
|
---|
89 | "Frq 1 Srce V1", /* PA_FREQ 17 */
|
---|
90 | "Filtr Srce V1", /* PA_FILT 18 */
|
---|
91 | "Fil Q Srce V1", /* PA_FILQ 19 */
|
---|
92 | "Loctn Srce V1", /* PA_LOCN 20 */
|
---|
93 | "Dynmc Srce V1", /* PA_DYNM 21 */
|
---|
94 | "Aux Srce ", /* PA_AUX 22 */
|
---|
95 | "Rate Srce ", /* PA_RATE 23 */
|
---|
96 | "Inten Srce ", /* PA_INTN 24 */
|
---|
97 | "Depth Srce ", /* PA_DPTH 25 */
|
---|
98 | "Vlt 1 Srce " /* PA_VOUT 26 */
|
---|
99 | };
|
---|
100 |
|
---|
101 | int8_t *rawmode[] = { "Frq ", "Pch ", "Int ", "Rat " }; /* oscillator modes */
|
---|
102 | int8_t *rawmdat[] = { "00.1 ", "0C 00", "+0000", "1/1 " }; /* oscillator data */
|
---|
103 |
|
---|
104 | int16_t omtabl[] = { PSO_FRQ, PSO_PCH, PSO_INT, PSO_RAT }; /* oscillator modes */
|
---|
105 | int16_t omdtab[] = { 2, 320, 0, 0 }; /* oscillator data */
|
---|
106 | int16_t omftab[] = { 6, 7, 4, 5 }; /* mode data format */
|
---|
107 |
|
---|
108 | int8_t *rawfpud[] = { "PchWh", "+0.00", "00001", "\2400.00", "Start" };
|
---|
109 |
|
---|
110 | int16_t fpudtab[] = { SM_HTPW, 0, 1, 0, 1 };
|
---|
111 | int16_t fpuetab[] = { 11, 1, 2, 3, 9 };
|
---|
112 |
|
---|
113 | int16_t dfsttab[] = { 0x0000, 0x8000, 0x1100, 0x1180 };
|
---|
114 |
|
---|
115 | int16_t defcols[] = { 2, 6, 7, 8}; /* def data entry columns */
|
---|
116 | int16_t stmcols[] = { 15, 19, 20, 21}; /* stm data entry columns */
|
---|
117 |
|
---|
118 | int16_t dstcols[] = { /* destination data entry columns */
|
---|
119 |
|
---|
120 | /* -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 */
|
---|
121 | 28, 30, 36, 34, 32, 32, 42, 39, 34, 32, 32, 34
|
---|
122 | };
|
---|
123 |
|
---|
124 | int16_t dfsttp[] = { 1, 1, 2, 3 }; /* def/stm formats */
|
---|
125 |
|
---|
126 | int16_t datasrc[] = {
|
---|
127 |
|
---|
128 | SM_HTPW, SM_VTMW, SM_LPBR, SM_PED1, SM_CTL1,
|
---|
129 | SM_PTCH, SM_FREQ, SM_KVEL, SM_KPRS, SM_RAND
|
---|
130 | };
|
---|
131 |
|
---|
132 | int16_t destype[] = { /* destination type table */
|
---|
133 |
|
---|
134 | PA_KEY, -1, PA_TRG, PA_PLS, PA_LED,
|
---|
135 | PA_SLIN, PA_SCTL, PA_TUNE, PA_RSET, PA_RADD,
|
---|
136 | PA_INST, PA_OSC, PA_WAVA, PA_WAVB, PA_CNFG,
|
---|
137 | PA_INDX, PA_FREQ, -1, -1, -1,
|
---|
138 | PA_LEVL, PA_LOCN, PA_FILT, PA_FILQ, PA_DYNM,
|
---|
139 | PA_VOUT, PA_DPTH, PA_RATE, PA_INTN, PA_AUX,
|
---|
140 | -1, -1, -1, -1, -1,
|
---|
141 | -1, -1, -1, -1, -1,
|
---|
142 | -1, -1, -1, -1, -1
|
---|
143 | };
|
---|
144 |
|
---|
145 | int8_t destfmt[] = { /* destination data entry format table */
|
---|
146 |
|
---|
147 | 0, -1, 1, 2, 3, /* 1 .. 5 */
|
---|
148 | 4, 4, 5, 4, 4, /* 6 .. 10 */
|
---|
149 | 6, 9, 6, 6, 6, /* 11 .. 15 */
|
---|
150 | 9, 9, -1, -1, -1, /* 16 .. 20 */
|
---|
151 | 10, 10, 10, 10, 10, /* 21 .. 25 */
|
---|
152 | 8, 7, 7, 7, 7 /* 26 .. 30 */
|
---|
153 | };
|
---|
154 |
|
---|
155 | int8_t datafmt[] = { /* datum data entry format table */
|
---|
156 |
|
---|
157 | 8, -1, 9, 8, 14,
|
---|
158 | 13, 9, 18, 12, 12,
|
---|
159 | 15, 4, 16, 16, 17,
|
---|
160 | 11, 11, -1, -1, -1,
|
---|
161 | 11, 11, 11, 11, 11,
|
---|
162 | 11, 11, 11, 11, 11
|
---|
163 | };
|
---|
164 |
|
---|
165 | int8_t desdatf[] = { /* data entry default flags */
|
---|
166 |
|
---|
167 | 2, 0, 2, 2, 1,
|
---|
168 | 1, 2, 1, 3, 3,
|
---|
169 | 1, 0, 1, 1, 1,
|
---|
170 | 2, 2, 0, 0, 0,
|
---|
171 | 2, 2, 2, 2, 2,
|
---|
172 | 2, 2, 2, 2, 2
|
---|
173 | };
|
---|
174 |
|
---|
175 | int16_t desdat1[] = { /* data word 1 defaults */
|
---|
176 |
|
---|
177 | 0, 0, 0, 0, 0,
|
---|
178 | 0, 0, 0, 0, 0,
|
---|
179 | 0, 0, 0, 0, 0,
|
---|
180 | 0, 0, 0, 0, 0,
|
---|
181 | 0, 0, 0, 0, 0,
|
---|
182 | 0, 0, 0, 0, 0
|
---|
183 | };
|
---|
184 |
|
---|
185 | int16_t desdat2[] = { /* data word 2 defaults */
|
---|
186 |
|
---|
187 | 0, 0, 1, 0, 0,
|
---|
188 | 0, 1, 0, 0, 1,
|
---|
189 | 0, 0, 0, 0, 0,
|
---|
190 | SM_HTPW, SM_HTPW, 0, 0, 0,
|
---|
191 | SM_HTPW, SM_HTPW, SM_HTPW, SM_HTPW, SM_HTPW,
|
---|
192 | SM_HTPW, SM_HTPW, SM_HTPW, SM_HTPW, SM_HTPW
|
---|
193 | };
|
---|
194 |
|
---|
195 | int8_t *rawdata[] = {
|
---|
196 |
|
---|
197 | "Trans", " ", "Start", "Trans", "000 ",
|
---|
198 | "000 ", "Start", "0 ", "+00 ", "+01 ",
|
---|
199 | "00 ", "+0000", "01 ", "01 ", "00 ",
|
---|
200 | "PchWh", "PchWh", " ", " ", " ",
|
---|
201 | "PchWh", "PchWh", "PchWh", "PchWh", "PchWh",
|
---|
202 | "PchWh", "PchWh", "PchWh", "PchWh", "PchWh"
|
---|
203 | };
|
---|
204 |
|
---|
205 | int8_t hilitab[][8] = { /* submenu highlight table */
|
---|
206 |
|
---|
207 | /* start, width, row1, row2, row3, row4, row5, pad */
|
---|
208 |
|
---|
209 | { 2, 3, HT_0|HT_2, HT_0, HT_0|HT_2, HT_0|HT_2, HT_2, 0},
|
---|
210 | { 7, 6, HT_2, HT_2, HT_2, HT_2, HT_2, 0},
|
---|
211 | { 15, 5, HT_2, HT_2, HT_2, HT_2, HT_2, 0},
|
---|
212 | { 22, 5, HT_2, HT_2|HT_3, HT_3, HT_3, HT_3, 0},
|
---|
213 | { 29, 5, HT_2, HT_2, HT_2, HT_2, HT_2, 0},
|
---|
214 | { 36, 5, HT_2, HT_2, HT_2, HT_2, HT_2, 0},
|
---|
215 | { 43, 4, HT_4|HT_5, HT_4|HT_5, HT_4|HT_5, HT_4|HT_5, 0, 0},
|
---|
216 | { 49, 5, HT_1, HT_1, HT_1, HT_1, HT_1, 0},
|
---|
217 | { 56, 5, HT_1, HT_1, HT_1, HT_1, HT_1, 0}
|
---|
218 | };
|
---|
219 |
|
---|
220 | struct selbox ptboxes[] = { /* selection boxes */
|
---|
221 |
|
---|
222 | {CTOX(1), RTOY(DATAROW), CTOX(48)-1, RTOY(1+DATAROW)-1, 0, ptfnbox}, /* current patch */
|
---|
223 |
|
---|
224 | { 0, 0, 0, 0, 0, FN_NULL}
|
---|
225 | };
|
---|
226 |
|
---|
227 | /*
|
---|
228 | =============================================================================
|
---|
229 | hilitpm() -- highlight patch submenu
|
---|
230 | =============================================================================
|
---|
231 | */
|
---|
232 |
|
---|
233 | void hilitpm(int8_t n)
|
---|
234 | {
|
---|
235 | register int16_t chr, h, v, w;
|
---|
236 |
|
---|
237 | ptemenu = n; /* set current submenu type */
|
---|
238 |
|
---|
239 | for (h = 0; h < 9; h++) { /* scan the columns */
|
---|
240 |
|
---|
241 | for (v = 0; v < 5; v++) { /* scan the rows */
|
---|
242 |
|
---|
243 | chr = hilitab[h][0]; /* starting character */
|
---|
244 |
|
---|
245 | for (w = hilitab[h][1]; w-- > 0; )
|
---|
246 | vsetcv(obj11, v + 1, chr++,
|
---|
247 | (hilitab[h][v + 2] & n) ?
|
---|
248 | PTIATR : PTMATR, 64);
|
---|
249 | }
|
---|
250 | }
|
---|
251 | }
|
---|
252 |
|
---|
253 | /*
|
---|
254 | =============================================================================
|
---|
255 | aftercm() -- determine state after cursor motion
|
---|
256 | =============================================================================
|
---|
257 | */
|
---|
258 |
|
---|
259 | void aftercm(void)
|
---|
260 | {
|
---|
261 | switch (stccol) { /* switch based on current cursor column */
|
---|
262 |
|
---|
263 | case 2: /* definer */
|
---|
264 | case 3:
|
---|
265 | case 4:
|
---|
266 | hilitpm(HT_0);
|
---|
267 | break;
|
---|
268 |
|
---|
269 | case 15: /* stimulus */
|
---|
270 | case 16:
|
---|
271 | case 17:
|
---|
272 |
|
---|
273 | hilitpm(HT_0);
|
---|
274 | break;
|
---|
275 |
|
---|
276 | case 28: /* destination */
|
---|
277 |
|
---|
278 | hilitpm(HT_2);
|
---|
279 | break;
|
---|
280 |
|
---|
281 |
|
---|
282 | case 34: /* may be a destination sub-address */
|
---|
283 | case 35:
|
---|
284 | case 36:
|
---|
285 | case 37:
|
---|
286 |
|
---|
287 | if (ptedsok) { /* if destination is good ... */
|
---|
288 |
|
---|
289 | switch (PE_SPEC & ptespec) {
|
---|
290 |
|
---|
291 | case PA_OSC:
|
---|
292 |
|
---|
293 | hilitpm(HT_3);
|
---|
294 | break;
|
---|
295 |
|
---|
296 | case PA_LEVL:
|
---|
297 | case PA_INDX:
|
---|
298 | case PA_FREQ:
|
---|
299 | case PA_LOCN:
|
---|
300 | case PA_FILT:
|
---|
301 |
|
---|
302 | hilitpm(HT_4);
|
---|
303 | break;
|
---|
304 |
|
---|
305 | case PA_FILQ:
|
---|
306 | case PA_DYNM:
|
---|
307 | case PA_VOUT:
|
---|
308 | case PA_DPTH:
|
---|
309 | case PA_RATE:
|
---|
310 | case PA_INTN:
|
---|
311 | case PA_AUX:
|
---|
312 |
|
---|
313 | hilitpm(HT_5);
|
---|
314 | break;
|
---|
315 |
|
---|
316 | default:
|
---|
317 |
|
---|
318 | hilitpm(HT_OFF);
|
---|
319 | break;
|
---|
320 | }
|
---|
321 |
|
---|
322 | } else {
|
---|
323 |
|
---|
324 | hilitpm(HT_OFF);
|
---|
325 | }
|
---|
326 |
|
---|
327 | break;
|
---|
328 |
|
---|
329 | case 42: /* datum */
|
---|
330 |
|
---|
331 | if (ptedtok) { /* if datum is valid ... */
|
---|
332 |
|
---|
333 | switch (PE_SPEC & ptespec) {
|
---|
334 |
|
---|
335 | case PA_LEVL:
|
---|
336 | case PA_INDX:
|
---|
337 | case PA_FREQ:
|
---|
338 | case PA_LOCN:
|
---|
339 | case PA_FILT:
|
---|
340 | case PA_FILQ:
|
---|
341 | case PA_DYNM:
|
---|
342 | case PA_VOUT:
|
---|
343 | case PA_DPTH:
|
---|
344 | case PA_RATE:
|
---|
345 | case PA_INTN:
|
---|
346 | case PA_AUX:
|
---|
347 |
|
---|
348 | if (ptedat1 EQ PSA_SRC)
|
---|
349 | hilitpm(HT_1);
|
---|
350 | else
|
---|
351 | hilitpm(HT_OFF);
|
---|
352 |
|
---|
353 | break;
|
---|
354 |
|
---|
355 | default:
|
---|
356 |
|
---|
357 | hilitpm(HT_OFF);
|
---|
358 | break;
|
---|
359 | }
|
---|
360 |
|
---|
361 | } else {
|
---|
362 |
|
---|
363 | hilitpm(HT_OFF);
|
---|
364 | }
|
---|
365 |
|
---|
366 | break;
|
---|
367 |
|
---|
368 | default: /* not in a starting place */
|
---|
369 |
|
---|
370 | hilitpm(HT_OFF);
|
---|
371 | break;
|
---|
372 | }
|
---|
373 | }
|
---|
374 |
|
---|
375 | /*
|
---|
376 | =============================================================================
|
---|
377 | movectc() -- move cursor and reset highlighting
|
---|
378 | =============================================================================
|
---|
379 | */
|
---|
380 |
|
---|
381 | void movectc(int16_t r, int16_t c)
|
---|
382 | {
|
---|
383 | ctcpos(r, c);
|
---|
384 | aftercm();
|
---|
385 | }
|
---|
386 |
|
---|
387 | /*
|
---|
388 | =============================================================================
|
---|
389 | endpsm() -- end patch submenu data entry
|
---|
390 | =============================================================================
|
---|
391 | */
|
---|
392 |
|
---|
393 | void endpsm(int16_t row, int16_t col)
|
---|
394 | {
|
---|
395 | submenu = FALSE;
|
---|
396 | cmtype = CT_SMTH;
|
---|
397 |
|
---|
398 | ptegood = ptedfok AND ptestok AND ptedsok AND ptedtok;
|
---|
399 |
|
---|
400 | mtcoff();
|
---|
401 | movectc(row, col);
|
---|
402 |
|
---|
403 | srdspte();
|
---|
404 | }
|
---|
405 |
|
---|
406 | /*
|
---|
407 | =============================================================================
|
---|
408 | edefstm() -- enter a def or a stm field
|
---|
409 | =============================================================================
|
---|
410 | */
|
---|
411 |
|
---|
412 | void edefstm(int16_t du, int16_t n)
|
---|
413 | {
|
---|
414 | int16_t chan, port, stim;
|
---|
415 | register int16_t i, left, right;
|
---|
416 | register int32_t ltemp;
|
---|
417 |
|
---|
418 | #if DEBUGIT
|
---|
419 | if (debugsw AND snapit)
|
---|
420 | printf("edefstm(%d): pte stok=%d dfok=%d\n",
|
---|
421 | n, ptestok, ptedfok);
|
---|
422 | #endif
|
---|
423 |
|
---|
424 | if (n) {
|
---|
425 |
|
---|
426 | if (NOT ptestok) {
|
---|
427 |
|
---|
428 | movectc(DATAROW, 15);
|
---|
429 | return;
|
---|
430 | }
|
---|
431 |
|
---|
432 | } else {
|
---|
433 |
|
---|
434 | if (NOT ptedfok) {
|
---|
435 |
|
---|
436 | movectc(DATAROW, 2);
|
---|
437 | return;
|
---|
438 | }
|
---|
439 | }
|
---|
440 |
|
---|
441 | port = ((n ? ptestm : ptedef) >> 11) & 0x0003;
|
---|
442 | chan = ((n ? ptestm : ptedef) >> 7) & 0x000F;
|
---|
443 | stim = (n ? ptestm : ptedef) & 0x007F;
|
---|
444 |
|
---|
445 | if ( (port EQ 0) OR (port EQ 1) OR
|
---|
446 | ((port EQ 2) AND (chan < 2)) ) { /* key / rel */
|
---|
447 |
|
---|
448 | ltemp = 0; /* stimulus number */
|
---|
449 | left = n ? 19 : 6;
|
---|
450 | right = n ? 22 : 9;
|
---|
451 |
|
---|
452 | for (i = left; i < right; i++)
|
---|
453 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
454 |
|
---|
455 | if ((ltemp EQ 0) OR (ltemp > 128L)) {
|
---|
456 |
|
---|
457 | movectc(DATAROW, left);
|
---|
458 | return;
|
---|
459 | }
|
---|
460 |
|
---|
461 | stim = ltemp - 1;
|
---|
462 |
|
---|
463 | if (port EQ 2) {
|
---|
464 |
|
---|
465 | chan = 0;
|
---|
466 |
|
---|
467 | } else {
|
---|
468 |
|
---|
469 | ltemp = 0; /* channel */
|
---|
470 | left = n ? 25 : 12;
|
---|
471 | right = n ? 27 : 14;
|
---|
472 |
|
---|
473 | for (i = left; i < right; i++)
|
---|
474 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
475 |
|
---|
476 | if ((ltemp EQ 0) OR (ltemp > 16L)) {
|
---|
477 |
|
---|
478 | movectc(DATAROW, left);
|
---|
479 | return;
|
---|
480 | }
|
---|
481 |
|
---|
482 | chan = ltemp - 1;
|
---|
483 | }
|
---|
484 |
|
---|
485 | if (n)
|
---|
486 | ptestm = (ptestm & 0x8000) | (port << 11) | (chan << 7) | stim;
|
---|
487 | else
|
---|
488 | ptedef = (ptedef & 0x8000) | (port << 11) | (chan << 7) | stim;
|
---|
489 |
|
---|
490 | } else if ((port EQ 2) AND (chan EQ 2)) { /* Trig */
|
---|
491 |
|
---|
492 | ltemp = 0;
|
---|
493 | left = n ? 20 : 7;
|
---|
494 | right = n ? 22 : 9;
|
---|
495 |
|
---|
496 | for (i = left; i < right; i++)
|
---|
497 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
498 |
|
---|
499 | if ((ltemp EQ 0) OR (ltemp > 16L)) {
|
---|
500 |
|
---|
501 | movectc(DATAROW, left);
|
---|
502 | return;
|
---|
503 | }
|
---|
504 |
|
---|
505 | stim = ltemp - 1;
|
---|
506 |
|
---|
507 | if (n)
|
---|
508 | ptestm = 0x1100 | stim;
|
---|
509 | else
|
---|
510 | ptedef = 0x1100 | stim;
|
---|
511 |
|
---|
512 | } else if ((port EQ 2) AND (chan EQ 3)) { /* Pulse */
|
---|
513 |
|
---|
514 | left = n ? 21 : 8;
|
---|
515 | ltemp = ptdebuf[left] - '0';
|
---|
516 |
|
---|
517 | if ((ltemp EQ 0) OR (ltemp > 2L)) {
|
---|
518 |
|
---|
519 | movectc(DATAROW, left);
|
---|
520 | return;
|
---|
521 | }
|
---|
522 |
|
---|
523 | stim = ltemp - 1;
|
---|
524 |
|
---|
525 | if (n)
|
---|
526 | ptestm = 0x1180 | stim;
|
---|
527 | else
|
---|
528 | ptedef = 0x1180 | stim;
|
---|
529 |
|
---|
530 | } else {
|
---|
531 |
|
---|
532 | movectc(DATAROW, n ? 15 : 2);
|
---|
533 | return;
|
---|
534 | }
|
---|
535 |
|
---|
536 | if (n)
|
---|
537 | ptestok = TRUE;
|
---|
538 | else
|
---|
539 | ptedfok = TRUE;
|
---|
540 |
|
---|
541 | #if SNAPDUMP
|
---|
542 | if (debugsw AND snapit)
|
---|
543 | SnapPTV("edefstm");
|
---|
544 | #endif
|
---|
545 |
|
---|
546 | if (du) { /* if display is to be updated ... */
|
---|
547 |
|
---|
548 | srdspte();
|
---|
549 | movectc(DATAROW, n ? 28 : 15);
|
---|
550 | }
|
---|
551 | }
|
---|
552 |
|
---|
553 | /*
|
---|
554 | =============================================================================
|
---|
555 | ptdest() -- enter patch destination field
|
---|
556 | =============================================================================
|
---|
557 | */
|
---|
558 |
|
---|
559 | void ptdest(int16_t du)
|
---|
560 | {
|
---|
561 | register int32_t ltemp;
|
---|
562 | register int16_t i, left, right, stim;
|
---|
563 | int16_t port, chan;
|
---|
564 |
|
---|
565 | #if DEBUGIT
|
---|
566 | if (debugsw AND debug01)
|
---|
567 | printf("ptdest(%d): entry -- ptedest = %d\n", du, ptedest);
|
---|
568 | #endif
|
---|
569 |
|
---|
570 | switch (ptedest) {
|
---|
571 |
|
---|
572 | case 0: /* key */
|
---|
573 |
|
---|
574 | ltemp = 0;
|
---|
575 | left = 30;
|
---|
576 | right = 33;
|
---|
577 |
|
---|
578 | for (i = left; i < right; i++)
|
---|
579 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
580 |
|
---|
581 | if ((ltemp EQ 0) OR (ltemp > 128L)) {
|
---|
582 |
|
---|
583 | movectc(DATAROW, left);
|
---|
584 | return;
|
---|
585 | }
|
---|
586 |
|
---|
587 | stim = ltemp - 1;
|
---|
588 | ltemp = 0;
|
---|
589 | left = 36;
|
---|
590 | right = 38;
|
---|
591 |
|
---|
592 | for (i = left; i < right; i++)
|
---|
593 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
594 |
|
---|
595 | if ((ltemp EQ 0) OR (ltemp > 16L)) {
|
---|
596 |
|
---|
597 | movectc(DATAROW, left);
|
---|
598 | return;
|
---|
599 | }
|
---|
600 |
|
---|
601 | chan = ltemp - 1;
|
---|
602 |
|
---|
603 | if (ptdebuf[34] EQ 'L') {
|
---|
604 |
|
---|
605 | port = 2;
|
---|
606 | chan = 0;
|
---|
607 |
|
---|
608 | } else {
|
---|
609 |
|
---|
610 | port = ptdebuf[34] - '1';
|
---|
611 | }
|
---|
612 |
|
---|
613 | ptesuba = (port << 11) | (chan << 7) | stim;
|
---|
614 | break;
|
---|
615 |
|
---|
616 | case 1: /* trigger */
|
---|
617 |
|
---|
618 | ltemp = 0;
|
---|
619 | left = 36;
|
---|
620 | right = 38;
|
---|
621 |
|
---|
622 | for (i = left; i < right; i++)
|
---|
623 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
624 |
|
---|
625 | if ((ltemp EQ 0) OR (ltemp > 16L)) {
|
---|
626 |
|
---|
627 | movectc(DATAROW, left);
|
---|
628 | return;
|
---|
629 | }
|
---|
630 |
|
---|
631 | stim = ltemp - 1;
|
---|
632 | ptesuba = 0x1100 | stim;
|
---|
633 | break;
|
---|
634 |
|
---|
635 | case 2: /* pulse */
|
---|
636 |
|
---|
637 | ptesuba = ptdebuf[34] - '1';
|
---|
638 | break;
|
---|
639 |
|
---|
640 | case 3: /* led */
|
---|
641 |
|
---|
642 | ptesuba = ptdebuf[32] - 'A';
|
---|
643 | break;
|
---|
644 |
|
---|
645 | case 4: /* seq / reg */
|
---|
646 |
|
---|
647 | ltemp = 0;
|
---|
648 | left = 32;
|
---|
649 | right = 34;
|
---|
650 |
|
---|
651 | for (i = left; i < right; i++)
|
---|
652 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
653 |
|
---|
654 | if ((ltemp EQ 0) OR (ltemp > 16L)) {
|
---|
655 |
|
---|
656 | movectc(DATAROW, left);
|
---|
657 | return;
|
---|
658 | }
|
---|
659 |
|
---|
660 | ptesuba = ltemp - 1;
|
---|
661 | break;
|
---|
662 |
|
---|
663 |
|
---|
664 | case 5: /* tuning */
|
---|
665 | case 7: /* aux, rate, inten, depth */
|
---|
666 |
|
---|
667 | break;
|
---|
668 |
|
---|
669 | case 6: /* inst, wave, config */
|
---|
670 | case 10: /* level, filtr, fil Q, loctn, dynmc */
|
---|
671 |
|
---|
672 | if (ptdebuf[39] EQ 'V')
|
---|
673 | stim = 0;
|
---|
674 | else
|
---|
675 | stim = 12;
|
---|
676 |
|
---|
677 | i = ptdebuf[40] & 0x00FF;
|
---|
678 |
|
---|
679 | if (i GE '\254')
|
---|
680 | stim += i - '\242';
|
---|
681 | else
|
---|
682 | stim += i - '0';
|
---|
683 |
|
---|
684 | --stim;
|
---|
685 | ptesuba = stim << 8;
|
---|
686 | break;
|
---|
687 |
|
---|
688 | case 8: /* vlt */
|
---|
689 |
|
---|
690 | ptesuba = ptdebuf[32] - '0';
|
---|
691 | break;
|
---|
692 |
|
---|
693 | case 9: /* osc, ind, frq */
|
---|
694 |
|
---|
695 | if (ptdebuf[39] EQ 'V')
|
---|
696 | stim = 0;
|
---|
697 | else
|
---|
698 | stim = 12;
|
---|
699 |
|
---|
700 | i = ptdebuf[40] & 0x00FF;
|
---|
701 |
|
---|
702 | if (i GE '\254')
|
---|
703 | stim += i - '\242';
|
---|
704 | else
|
---|
705 | stim += i - '0';
|
---|
706 |
|
---|
707 | --stim;
|
---|
708 | ptesuba = (stim << 8) | (ptdebuf[32] - '0');
|
---|
709 | break;
|
---|
710 |
|
---|
711 | default: /* something weird got in here ... */
|
---|
712 |
|
---|
713 | movectc(DATAROW, 28);
|
---|
714 | return;
|
---|
715 | }
|
---|
716 |
|
---|
717 | ptedsok = TRUE;
|
---|
718 |
|
---|
719 | #if SNAPDUMP
|
---|
720 | if (debugsw AND snapit)
|
---|
721 | SnapPTV("ptdest");
|
---|
722 | #endif
|
---|
723 |
|
---|
724 | if (du) {
|
---|
725 |
|
---|
726 | srdspte();
|
---|
727 | movectc(DATAROW, 42);
|
---|
728 | }
|
---|
729 |
|
---|
730 | #if DEBUGIT
|
---|
731 | if (debugsw AND debug01)
|
---|
732 | printf("ptdest(%d): exit\n", du);
|
---|
733 | #endif
|
---|
734 | }
|
---|
735 |
|
---|
736 | /*
|
---|
737 | =============================================================================
|
---|
738 | epatch() -- enter patch and reposition cursor to the DEF field
|
---|
739 | =============================================================================
|
---|
740 | */
|
---|
741 |
|
---|
742 | void epatch(void)
|
---|
743 | {
|
---|
744 | #if DEBUGIT
|
---|
745 | if (debugsw AND debug01)
|
---|
746 | printf("epatch(): entry\n");
|
---|
747 | #endif
|
---|
748 |
|
---|
749 | ptedtok = TRUE; /* data just got parsed or we wouldn't be here */
|
---|
750 | edefstm(0, 0); /* parse def */
|
---|
751 | edefstm(0, 1); /* parse stm */
|
---|
752 | ptdest(0); /* parse dest */
|
---|
753 | entrpte(); /* enter the patch */
|
---|
754 | srdspte(); /* adjust the display */
|
---|
755 | movectc(DATAROW, 2); /* reposition the cursor */
|
---|
756 |
|
---|
757 | #if SNAPDUMP
|
---|
758 | if (debugsw AND snapit)
|
---|
759 | SnapPTV("epatch");
|
---|
760 | #endif
|
---|
761 |
|
---|
762 | #if DEBUGIT
|
---|
763 | if (debugsw AND debug01)
|
---|
764 | printf("epatch(): exit\n");
|
---|
765 | #endif
|
---|
766 | }
|
---|
767 |
|
---|
768 | /*
|
---|
769 | =============================================================================
|
---|
770 | badpdat() -- position cursor at bad data field
|
---|
771 | =============================================================================
|
---|
772 | */
|
---|
773 |
|
---|
774 | void badpdat(void)
|
---|
775 | {
|
---|
776 | ptedtok = FALSE;
|
---|
777 | movectc(DATAROW, 42);
|
---|
778 | }
|
---|
779 |
|
---|
780 | /*
|
---|
781 | =============================================================================
|
---|
782 | setsubm() -- setup submenu
|
---|
783 | =============================================================================
|
---|
784 | */
|
---|
785 |
|
---|
786 | void setsubm(int16_t r, int16_t c)
|
---|
787 | {
|
---|
788 | submenu = TRUE;
|
---|
789 | cmtype = CT_MENU;
|
---|
790 | mtcpos(r, c);
|
---|
791 | }
|
---|
792 |
|
---|
793 | /*
|
---|
794 | =============================================================================
|
---|
795 | ptfnbox() -- patch display box hit processor
|
---|
796 | =============================================================================
|
---|
797 | */
|
---|
798 |
|
---|
799 | int16_t ptfnbox(int16_t n)
|
---|
800 | {
|
---|
801 | register int16_t i, box, ptd, ptt;
|
---|
802 | register int32_t ltemp;
|
---|
803 |
|
---|
804 | if (NOT submenu) { /* PATCH DATA ENTRY LINE */
|
---|
805 |
|
---|
806 | if (inrange(stccol, 2, 13)) { /* DEFINER */
|
---|
807 |
|
---|
808 | ptedftp = 1; /* def */
|
---|
809 |
|
---|
810 | if (inrange(stccol, 2, 4)) { /* select */
|
---|
811 |
|
---|
812 | setsubm(19, 2);
|
---|
813 |
|
---|
814 | } else { /* enter */
|
---|
815 |
|
---|
816 | edefstm(0, 1);
|
---|
817 | ptdest(0);
|
---|
818 | edefstm(1, 0);
|
---|
819 | }
|
---|
820 |
|
---|
821 | return(SUCCESS);
|
---|
822 |
|
---|
823 | } else if (inrange(stccol, 15, 26)) { /* STIMULUS */
|
---|
824 |
|
---|
825 | ptedftp = 2; /* stm */
|
---|
826 |
|
---|
827 | if (inrange(stccol, 15, 17)) { /* select */
|
---|
828 |
|
---|
829 | setsubm(19, 2);
|
---|
830 |
|
---|
831 | } else { /* enter */
|
---|
832 |
|
---|
833 | edefstm(0 ,0);
|
---|
834 | ptdest(0);
|
---|
835 | edefstm(1, 1);
|
---|
836 | }
|
---|
837 |
|
---|
838 | return(SUCCESS);
|
---|
839 |
|
---|
840 | } else if (inrange(stccol, 28, 40)) { /* DESTINATION */
|
---|
841 |
|
---|
842 | ptedftp = 0; /* not def/stm */
|
---|
843 |
|
---|
844 | if (stccol EQ 28) { /* select */
|
---|
845 |
|
---|
846 | setsubm(19, 2);
|
---|
847 |
|
---|
848 | } else if (ptemenu EQ HT_3) {
|
---|
849 |
|
---|
850 | setsubm(20, 22);
|
---|
851 |
|
---|
852 | } else if ((ptemenu EQ HT_4) OR
|
---|
853 | (ptemenu EQ HT_5)) {
|
---|
854 |
|
---|
855 | setsubm(19, 43);
|
---|
856 |
|
---|
857 | } else { /* enter */
|
---|
858 |
|
---|
859 | edefstm(0, 0);
|
---|
860 | edefstm(0, 1);
|
---|
861 | ptdest(1);
|
---|
862 | }
|
---|
863 |
|
---|
864 | return(SUCCESS);
|
---|
865 |
|
---|
866 | } else if (inrange(stccol, 42, 46)) { /* DATUM */
|
---|
867 |
|
---|
868 | ptedftp = 0; /* not def/stm */
|
---|
869 | setptcv(); /* setup control variables */
|
---|
870 |
|
---|
871 | #if DEBUGIT
|
---|
872 | if (debugsw AND debug01)
|
---|
873 | SnapPTV("ptfnbox");
|
---|
874 | #endif
|
---|
875 | switch (ptedata) { /* switch on Datum format */
|
---|
876 |
|
---|
877 | case 0: /* -none- */
|
---|
878 |
|
---|
879 | ptedtok = FALSE;
|
---|
880 | return(FAILURE);
|
---|
881 |
|
---|
882 | case 1: /* multiplier -- +1.00 */
|
---|
883 |
|
---|
884 | ebuf[0] = ptdebuf[43];
|
---|
885 | ebuf[1] = ptdebuf[45];
|
---|
886 | ebuf[2] = ptdebuf[46];
|
---|
887 | ebuf[3] = ptdebuf[42];
|
---|
888 |
|
---|
889 | if (0xFFFF EQ (i = dec2fr(ebuf))) {
|
---|
890 |
|
---|
891 | badpdat();
|
---|
892 | return(FAILURE);
|
---|
893 | }
|
---|
894 |
|
---|
895 | ptedat2 = i;
|
---|
896 | epatch(); /* enter -- multiplier */
|
---|
897 | return(SUCCESS);
|
---|
898 |
|
---|
899 | case 2: /* time -- 32767 */
|
---|
900 |
|
---|
901 | ltemp = 0;
|
---|
902 |
|
---|
903 | for (i = 42; i < 47; i++)
|
---|
904 | ltemp = (ltemp * 10) + (ptdebuf[i] - '0');
|
---|
905 |
|
---|
906 | if (ltemp > 32767L) {
|
---|
907 |
|
---|
908 | badpdat();
|
---|
909 | return(FAILURE);
|
---|
910 | }
|
---|
911 |
|
---|
912 | ptedat2 = tofpu((uint16_t)ltemp);
|
---|
913 | epatch(); /* enter -- time */
|
---|
914 | return(SUCCESS);
|
---|
915 |
|
---|
916 | case 3: /* value -- +10.00 */
|
---|
917 |
|
---|
918 | i = ptdebuf[42] & 0x00FF;
|
---|
919 |
|
---|
920 | if ((i EQ '\240') OR (i EQ '\241'))
|
---|
921 | ltemp = 1000;
|
---|
922 | else
|
---|
923 | ltemp = 0;
|
---|
924 |
|
---|
925 | ltemp += ((ptdebuf[43] - '0') * 100) +
|
---|
926 | ((ptdebuf[45] - '0') * 10) +
|
---|
927 | (ptdebuf[46] - '0');
|
---|
928 |
|
---|
929 | if (ltemp > 1000L) {
|
---|
930 |
|
---|
931 | badpdat();
|
---|
932 | return(FAILURE);
|
---|
933 | }
|
---|
934 |
|
---|
935 | if ((i EQ '-') OR (i EQ '\241'))
|
---|
936 | ltemp = -ltemp;
|
---|
937 |
|
---|
938 | ptedat2 = ltemp << 5;
|
---|
939 | epatch(); /* enter -- value */
|
---|
940 | return(SUCCESS);
|
---|
941 |
|
---|
942 |
|
---|
943 | case 4: /* interval -- +1200 */
|
---|
944 |
|
---|
945 | ltemp = 0;
|
---|
946 |
|
---|
947 | for (i = 43; i < 47; i++)
|
---|
948 | ltemp = (ltemp * 10) + (ptdebuf[i] - '0');
|
---|
949 |
|
---|
950 | if (ltemp > 1200L) {
|
---|
951 |
|
---|
952 | badpdat();
|
---|
953 | return(FAILURE);
|
---|
954 | }
|
---|
955 |
|
---|
956 | if (ptdebuf[42] EQ '-')
|
---|
957 | ltemp = -ltemp;
|
---|
958 |
|
---|
959 | ptedat2 = ltemp << 1;
|
---|
960 | epatch(); /* enter -- interval */
|
---|
961 | return(SUCCESS);
|
---|
962 |
|
---|
963 | case 5: /* ratio -- 9/9 */
|
---|
964 |
|
---|
965 | ptedat2 = ndvals[ptdebuf[42] - '0'] -
|
---|
966 | ndvals[ptdebuf[44] - '0'];
|
---|
967 |
|
---|
968 | epatch(); /* enter -- ratio */
|
---|
969 | return(SUCCESS);
|
---|
970 |
|
---|
971 | case 6: /* frequency -- 15.9 */
|
---|
972 |
|
---|
973 | ltemp = ((ptdebuf[42] - '0') * 100) +
|
---|
974 | ((ptdebuf[43] - '0') * 10) +
|
---|
975 | (ptdebuf[45] - '0');
|
---|
976 |
|
---|
977 | if (ltemp > 159L) {
|
---|
978 |
|
---|
979 | badpdat();
|
---|
980 | return(FAILURE);
|
---|
981 | }
|
---|
982 |
|
---|
983 | ptedat2 = ltemp << 1;
|
---|
984 | epatch(); /* enter -- frequency */
|
---|
985 | return(SUCCESS);
|
---|
986 |
|
---|
987 | case 7: /* pitch -- 9C#99 */
|
---|
988 |
|
---|
989 | memcpy(ebuf,& ptdebuf[42], 5);
|
---|
990 |
|
---|
991 | if (FAILURE EQ cnvp2c()) {
|
---|
992 |
|
---|
993 | badpdat();
|
---|
994 | return(FAILURE);
|
---|
995 | }
|
---|
996 |
|
---|
997 | ptedat2 = cents;
|
---|
998 | epatch(); /* enter - pitch */
|
---|
999 | return(SUCCESS);
|
---|
1000 |
|
---|
1001 | case 8: /* trans/stop/start */
|
---|
1002 | case 9: /* stop/start */
|
---|
1003 | case 10: /* off/on */
|
---|
1004 |
|
---|
1005 | epatch(); /* enter -- control */
|
---|
1006 | return(SUCCESS);
|
---|
1007 |
|
---|
1008 | case 11: /* source */
|
---|
1009 |
|
---|
1010 | if (stccol EQ 42)
|
---|
1011 | setsubm(19, 49); /* select */
|
---|
1012 | else
|
---|
1013 | epatch(); /* enter -- source */
|
---|
1014 |
|
---|
1015 | return(SUCCESS);
|
---|
1016 |
|
---|
1017 | case 12: /* register/value -- R16 | +99 */
|
---|
1018 |
|
---|
1019 | ltemp = ((ptdebuf[43] - '0') * 10) +
|
---|
1020 | (ptdebuf[44] - '0');
|
---|
1021 |
|
---|
1022 | if (ptdebuf[42] EQ 'R') {
|
---|
1023 |
|
---|
1024 | if ((ltemp EQ 0) OR (ltemp > 16L)) {
|
---|
1025 |
|
---|
1026 | badpdat();
|
---|
1027 | return(FAILURE);
|
---|
1028 | }
|
---|
1029 |
|
---|
1030 | --ltemp;
|
---|
1031 | ptedat1 = 1;
|
---|
1032 |
|
---|
1033 | } else {
|
---|
1034 |
|
---|
1035 | ptedat1 = 0;
|
---|
1036 | }
|
---|
1037 |
|
---|
1038 | ptedat2 = ltemp;
|
---|
1039 | epatch(); /* enter -- register | value */
|
---|
1040 | return(SUCCESS);
|
---|
1041 |
|
---|
1042 | case 13: /* sequence line */
|
---|
1043 |
|
---|
1044 | ltemp = 0;
|
---|
1045 |
|
---|
1046 | for (i = 42; i < 45; i++)
|
---|
1047 | ltemp = (ltemp * 10) + (ptdebuf[i] - '0');
|
---|
1048 |
|
---|
1049 | ptedat1 = ltemp;
|
---|
1050 | epatch(); /* enter -- sequence line */
|
---|
1051 | return(SUCCESS);
|
---|
1052 |
|
---|
1053 | case 14: /* LED controls */
|
---|
1054 |
|
---|
1055 | ltemp = 0;
|
---|
1056 |
|
---|
1057 | if (ptesuba & 0x0001) {
|
---|
1058 |
|
---|
1059 | for (i = 42; i < 46; i++)
|
---|
1060 | ltemp = (ltemp << 2) | (ptdebuf[i] - '0');
|
---|
1061 |
|
---|
1062 | ptedat1 = ltemp << 8;
|
---|
1063 |
|
---|
1064 | } else {
|
---|
1065 |
|
---|
1066 | for (i = 42; i < 45; i++)
|
---|
1067 | ltemp = (ltemp << 2) | (ptdebuf[i] - '0');
|
---|
1068 |
|
---|
1069 | ptedat1 = ltemp << 10;
|
---|
1070 | }
|
---|
1071 |
|
---|
1072 | epatch(); /* enter -- LED controls */
|
---|
1073 | return(SUCCESS);
|
---|
1074 |
|
---|
1075 |
|
---|
1076 | case 15: /* instrument number */
|
---|
1077 |
|
---|
1078 | ltemp = ((ptdebuf[42] - '0') * 10) +
|
---|
1079 | (ptdebuf[43] - '0');
|
---|
1080 |
|
---|
1081 | if (ltemp > 40L) {
|
---|
1082 |
|
---|
1083 | badpdat();
|
---|
1084 | return(FAILURE);
|
---|
1085 | }
|
---|
1086 |
|
---|
1087 | ptedat1 = ltemp;
|
---|
1088 | epatch(); /* enter -- instrument number */
|
---|
1089 | return(SUCCESS);
|
---|
1090 |
|
---|
1091 | case 16: /* waveshape number */
|
---|
1092 |
|
---|
1093 | ltemp = ((ptdebuf[42] - '0') * 10) +
|
---|
1094 | (ptdebuf[43] - '0');
|
---|
1095 |
|
---|
1096 | if ((ltemp EQ 0) OR (ltemp > 20L)) {
|
---|
1097 |
|
---|
1098 | badpdat();
|
---|
1099 | return(FAILURE);
|
---|
1100 | }
|
---|
1101 |
|
---|
1102 | ptedat1 = ltemp;
|
---|
1103 | epatch(); /* enter -- waveshape number */
|
---|
1104 | return(SUCCESS);
|
---|
1105 |
|
---|
1106 | case 17: /* configuration number */
|
---|
1107 |
|
---|
1108 | ltemp = ((ptdebuf[42] - '0') * 10) +
|
---|
1109 | (ptdebuf[43] - '0');
|
---|
1110 |
|
---|
1111 | if (ltemp > 11L) {
|
---|
1112 |
|
---|
1113 | badpdat();
|
---|
1114 | return(FAILURE);
|
---|
1115 | }
|
---|
1116 |
|
---|
1117 | ptedat1 = ltemp;
|
---|
1118 | epatch(); /* enter -- configuration number */
|
---|
1119 | return(SUCCESS);
|
---|
1120 |
|
---|
1121 | case 18: /* tuning table number */
|
---|
1122 |
|
---|
1123 | ptedat1 = ptdebuf[42] - '0';
|
---|
1124 | epatch(); /* enter -- tuning table number */
|
---|
1125 | return(SUCCESS);
|
---|
1126 |
|
---|
1127 | default: /* something weird got in here ... */
|
---|
1128 |
|
---|
1129 | ptedtok = FALSE;
|
---|
1130 | return(FAILURE);
|
---|
1131 | }
|
---|
1132 | }
|
---|
1133 |
|
---|
1134 | return(FAILURE);
|
---|
1135 |
|
---|
1136 | } else { /* SUBMENU SELECTION */
|
---|
1137 |
|
---|
1138 | /* determine the "box" we're pointing at */
|
---|
1139 |
|
---|
1140 | if (inrange(vtccol, 2, 4))
|
---|
1141 | box = vtcrow - 18;
|
---|
1142 | else if (inrange(vtccol, 7, 12))
|
---|
1143 | box = vtcrow - 13;
|
---|
1144 | else if (inrange(vtccol, 15, 19))
|
---|
1145 | box = vtcrow - 8;
|
---|
1146 | else if (inrange(vtccol, 22, 26))
|
---|
1147 | box = vtcrow - 3;
|
---|
1148 | else if (inrange(vtccol, 29, 33))
|
---|
1149 | box = vtcrow + 2;
|
---|
1150 | else if (inrange(vtccol, 36, 40))
|
---|
1151 | box = vtcrow + 7;
|
---|
1152 | else if (inrange(vtccol, 43, 46))
|
---|
1153 | box = vtcrow + 12;
|
---|
1154 | else if (inrange(vtccol, 49, 53))
|
---|
1155 | box = vtcrow + 17;
|
---|
1156 | else if (inrange(vtccol, 56, 60))
|
---|
1157 | box = vtcrow + 22;
|
---|
1158 | else
|
---|
1159 | return(FAILURE);
|
---|
1160 |
|
---|
1161 |
|
---|
1162 | switch (ptemenu) { /* switch on submenu type */
|
---|
1163 |
|
---|
1164 | case HT_0: /* DEFINERS / STIMULLI */
|
---|
1165 |
|
---|
1166 | if (inrange(box, 1, 4)) { /* Key, Rel, Trg, Pls */
|
---|
1167 |
|
---|
1168 | i = box - 1;
|
---|
1169 | ptedfst = dfsttp[i];
|
---|
1170 |
|
---|
1171 | if (ptedftp EQ 1) { /* def */
|
---|
1172 |
|
---|
1173 | ptedfok = TRUE;
|
---|
1174 | ptbflag = TRUE;
|
---|
1175 |
|
---|
1176 | ptedef = dfsttab[i];
|
---|
1177 |
|
---|
1178 | strcpy(&ptdebuf[2], rawdfst[i]);
|
---|
1179 |
|
---|
1180 | UpdVid(7, 2, rawdfst[i], PTDATR);
|
---|
1181 | endpsm(DATAROW, defcols[ptedfst]);
|
---|
1182 |
|
---|
1183 | return(SUCCESS);
|
---|
1184 |
|
---|
1185 | } else if (ptedftp EQ 2) { /* stm */
|
---|
1186 |
|
---|
1187 | ptestok = TRUE;
|
---|
1188 | ptbflag = TRUE;
|
---|
1189 |
|
---|
1190 | ptestm = dfsttab[i];
|
---|
1191 |
|
---|
1192 | strcpy(&ptdebuf[15], rawdfst[i]);
|
---|
1193 |
|
---|
1194 | UpdVid(7, 15, rawdfst[i], PTDATR);
|
---|
1195 | endpsm(DATAROW, stmcols[ptedfst]);
|
---|
1196 |
|
---|
1197 | return(SUCCESS);
|
---|
1198 | }
|
---|
1199 | }
|
---|
1200 |
|
---|
1201 | return(FAILURE);
|
---|
1202 |
|
---|
1203 | case HT_1: /* SOURCES */
|
---|
1204 |
|
---|
1205 | if (inrange(box, 36, 45)) {
|
---|
1206 |
|
---|
1207 | ptedtok = TRUE;
|
---|
1208 | ptbflag = TRUE;
|
---|
1209 |
|
---|
1210 | ptedat2 = datasrc[box - 36];
|
---|
1211 |
|
---|
1212 | strcpy(&ptdebuf[42], smdata[ptedat2]);
|
---|
1213 |
|
---|
1214 | UpdVid(7, 42, smdata[ptedat2], PTDATR);
|
---|
1215 | endpsm(DATAROW, 46);
|
---|
1216 |
|
---|
1217 | return(SUCCESS);
|
---|
1218 | }
|
---|
1219 |
|
---|
1220 | return(FAILURE);
|
---|
1221 |
|
---|
1222 | case HT_2: /* DESTINATIONS */
|
---|
1223 |
|
---|
1224 | i = box - 1;
|
---|
1225 | ptt = destype[i];
|
---|
1226 |
|
---|
1227 | if (ptt NE -1) {
|
---|
1228 |
|
---|
1229 | ptedsok = TRUE;
|
---|
1230 | ptedtok = TRUE;
|
---|
1231 | ptbflag = TRUE;
|
---|
1232 |
|
---|
1233 | ptedest = destfmt[i];
|
---|
1234 | ptedata = datafmt[i];
|
---|
1235 | ptespec = ptt;
|
---|
1236 | ptesuba = 0x0000;
|
---|
1237 | ptedat1 = 0x0000;
|
---|
1238 | ptedat2 = 0x0000;
|
---|
1239 |
|
---|
1240 | if (ptd = desdatf[i]) {
|
---|
1241 |
|
---|
1242 | if (ptd & 1)
|
---|
1243 | ptedat1 = desdat1[i];
|
---|
1244 |
|
---|
1245 | if (ptd & 2)
|
---|
1246 | ptedat2 = desdat2[i];
|
---|
1247 | }
|
---|
1248 |
|
---|
1249 | strcpy(&ptdebuf[28], rawdest[ptt]);
|
---|
1250 | strcpy(&ptdebuf[42], rawdata[i]);
|
---|
1251 |
|
---|
1252 | UpdVid(7, 28, rawdest[ptt], PTDATR);
|
---|
1253 | UpdVid(7, 42, rawdata[i], PTDATR);
|
---|
1254 | endpsm(DATAROW, dstcols[1 + ptedest]);
|
---|
1255 |
|
---|
1256 | return(SUCCESS);
|
---|
1257 | }
|
---|
1258 |
|
---|
1259 | return(FAILURE);
|
---|
1260 |
|
---|
1261 | case HT_3: /* OSCILLATOR MODES */
|
---|
1262 |
|
---|
1263 | if (inrange(box, 17, 20)) {
|
---|
1264 |
|
---|
1265 | i = box - 17;
|
---|
1266 |
|
---|
1267 | ptedsok = TRUE;
|
---|
1268 | ptedtok = TRUE;
|
---|
1269 | ptbflag = TRUE;
|
---|
1270 |
|
---|
1271 | ptedat1 = omtabl[i];
|
---|
1272 | ptedat2 = omdtab[i];
|
---|
1273 |
|
---|
1274 | ptedata = omftab[i];
|
---|
1275 |
|
---|
1276 | strcpy(&ptdebuf[34], rawmode[i]);
|
---|
1277 | strcpy(&ptdebuf[42], rawmdat[i]);
|
---|
1278 |
|
---|
1279 | UpdVid(7, 34, rawmode[i], PTDATR);
|
---|
1280 | UpdVid(7, 42, rawmdat[i], PTDATR);
|
---|
1281 | endpsm(DATAROW, 39);
|
---|
1282 |
|
---|
1283 | return(SUCCESS);
|
---|
1284 | }
|
---|
1285 |
|
---|
1286 | return(FAILURE);
|
---|
1287 |
|
---|
1288 | case HT_5: /* FPU OUTPUTS WITHOUT FUNCTIONS */
|
---|
1289 |
|
---|
1290 | if (NOT inrange(box, 31, 34))
|
---|
1291 | return(FAILURE);
|
---|
1292 |
|
---|
1293 | case HT_4: /* FPU OUTPUTS WITH FUNCTIONS */
|
---|
1294 |
|
---|
1295 | if (NOT inrange(box, 31, 35))
|
---|
1296 | return(FAILURE);
|
---|
1297 |
|
---|
1298 | i = box - 31;
|
---|
1299 |
|
---|
1300 | ptedsok = TRUE;
|
---|
1301 | ptedtok = TRUE;
|
---|
1302 | ptbflag = TRUE;
|
---|
1303 |
|
---|
1304 | ptedat1 = i;
|
---|
1305 | ptedat2 = fpudtab[i];
|
---|
1306 |
|
---|
1307 | ptedata = fpuetab[i];
|
---|
1308 |
|
---|
1309 | strcpy(&ptdebuf[34], stdata[i]);
|
---|
1310 | strcpy(&ptdebuf[42], rawfpud[i]);
|
---|
1311 |
|
---|
1312 | UpdVid(7, 34, stdata[i], PTDATR);
|
---|
1313 | UpdVid(7, 42, rawfpud[i], PTDATR);
|
---|
1314 | endpsm(DATAROW, 42);
|
---|
1315 |
|
---|
1316 | return(SUCCESS);
|
---|
1317 |
|
---|
1318 | default: /* -BOGUS- */
|
---|
1319 |
|
---|
1320 | endpsm(stcrow, stccol);
|
---|
1321 |
|
---|
1322 | return(FAILURE);
|
---|
1323 | }
|
---|
1324 | }
|
---|
1325 |
|
---|
1326 | return(FAILURE);
|
---|
1327 | }
|
---|
1328 |
|
---|