source: buchla-68k/orig/RAM/SHOWCFG.C@ 6f0834c

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

Imported original source code.

  • Property mode set to 100755
File size: 15.5 KB
Line 
1/*
2 =============================================================================
3 showcfg.c -- display a configuration diagram
4 Version 14 -- 1988-08-26 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "stddefs.h"
9#include "fields.h"
10#include "graphdef.h"
11#include "vsdd.h"
12#include "vsddsw.h"
13#include "vsddvars.h"
14#include "hwdefs.h"
15
16#include "midas.h"
17#include "instdsp.h"
18#include "wsdsp.h"
19
20#define MAXPAT 35
21
22#include "configs.h"
23
24/* instrument display configuration box parameters */
25
26#define LFT_EDGE 1 /* left edge of configuration box */
27#define TOP_EDGE 238 /* top edge of configuration box */
28#define RGT_EDGE 131 /* right edge of configuration box */
29#define BOT_EDGE 348 /* bottom edge of configuration box */
30
31/* external functions */
32
33extern unsigned exp_c();
34
35extern short enterit();
36extern short idpoint();
37extern short nokey();
38
39extern short et_mcfn(), ef_mcfn(), rd_mcfn(), nd_mcfn();
40extern short et_mwsn(), ef_mwsn(), rd_mwsn(), nd_mwsn();
41
42/* forward references */
43
44short imfnbox();
45
46/*
47
48*/
49
50/* variables defined elsewhere */
51
52extern short (*point)(); /* point plotting function pointer */
53extern short (*x_key)(); /* "X" key handler pointer */
54
55extern short LftEdge; /* left edge of current box */
56extern short TopEdge; /* top edge of current box */
57extern short RgtEdge; /* right edge of current box */
58extern short BotEdge; /* bottom edge of current box */
59
60extern short curslim; /* cursor changeover point */
61extern short curvce; /* currently edited voice */
62extern short hitbox; /* selected box number */
63extern short hitcx; /* selection cursor x value */
64extern short hitcy; /* selection cursor y value */
65extern short stccol; /* text cursor column */
66extern short stcrow; /* text cursor row */
67extern short wcflag; /* ws/cf menu select flag (cf=0, ws=1) */
68extern short wcmcol; /* ws/cf menu label column */
69extern short wcmrow; /* ws/cf menu label row */
70extern short wcpage; /* ws/cf menu page */
71extern short wmcsel; /* ws slot select */
72extern short wmctag; /* ws/cf display update flag */
73
74extern unsigned *instob; /* instrument display object pointer */
75
76extern struct octent *idoct; /* object control table pointer */
77
78extern struct selbox *csbp; /* current box select table pointer */
79
80extern struct instdef vbufs[]; /* voice buffers */
81
82extern struct wstbl wslib[]; /* waveshape library */
83
84/*
85
86*/
87
88struct fet id_fet2[] = { /* waveshape number fet */
89
90 {24, 12, 13, 0x0000, et_mwsn, ef_mwsn, rd_mwsn, nd_mwsn},
91 {24, 16, 17, 0x0100, et_mwsn, ef_mwsn, rd_mwsn, nd_mwsn},
92 { 0, 0, 0, 0x0000, FN_NULL, FN_NULL, FN_NULL, FN_NULL}
93};
94
95struct fet id_fet3[] = { /* configuration number fet */
96
97 {24, 16, 17, 0, et_mcfn, ef_mcfn, rd_mcfn, nd_mcfn},
98 { 0, 0, 0, 0x0000, FN_NULL, FN_NULL, FN_NULL, FN_NULL}
99};
100
101struct selbox idmbox[] = {
102
103 { 1, 1, 127, 111, 0, imfnbox}, /* slot 00 */
104 {129, 1, 255, 111, 1, imfnbox}, /* slot 01 */
105 {257, 1, 383, 111, 2, imfnbox}, /* slot 02 */
106 {385, 1, 510, 111, 3, imfnbox}, /* slot 03 */
107
108 { 1, 113, 127, 223, 4, imfnbox}, /* slot 04 */
109 {129, 113, 255, 223, 5, imfnbox}, /* slot 05 */
110 {257, 113, 383, 223, 6, imfnbox}, /* slot 06 */
111 {385, 113, 510, 223, 7, imfnbox}, /* slot 07 */
112
113 { 1, 225, 127, 334, 8, imfnbox}, /* slot 08 */
114 {129, 225, 255, 334, 9, imfnbox}, /* slot 09 */
115 {257, 225, 383, 334, 10, imfnbox}, /* slot 10 */
116 {385, 225, 510, 334, 11, imfnbox}, /* slot 11 */
117
118 { 1, 336, 510, 349, 12, imfnbox}, /* number */
119};
120
121/*
122
123*/
124
125short patctab[MAXPAT] = { /* pattern colors */
126
127 0, /* 1 */
128 0, /* 2 */
129 0, /* 3 */
130 0, /* 4 */
131 0, /* 5 */
132 0, /* 6 */
133 12, /* 7 */
134 12, /* 8 */
135 12, /* 9 */
136 12, /* 10 */
137 0, /* 11 */
138 0, /* 12 */
139 0, /* 13 */
140 0, /* 14 */
141 13, /* 15 */
142 8, /* 16 */
143 0, /* 17 */
144 0, /* 18 */
145 2, /* 19 */
146 2, /* 20 */
147 2, /* 21 */
148 2, /* 22 */
149 2, /* 23 */
150 2, /* 24 */
151 2, /* 25 */
152 2, /* 26 */
153 0, /* 27 */
154 0, /* 28 */
155 0, /* 29 */
156 0, /* 30 */
157 0, /* 31 */
158 0, /* 32 */
159 0, /* 33 */
160 0, /* 34 */
161 4 /* 35 */
162};
163
164/*
165
166*/
167
168short pat[MAXPAT][16] = { /* configuration pattern elements */
169
170 {0x0000, 0x0000, 0x0000, 0x0000, /* 1 */
171 0x0080, 0x0180, 0x0080, 0x0080,
172 0x0080, 0x0080, 0x0080, 0x01C0,
173 0x0000, 0x0000, 0x0000, 0x0000},
174
175 {0x0000, 0x0000, 0x0000, 0x0000, /* 2 */
176 0x03C0, 0x0420, 0x0020, 0x0020,
177 0x03C0, 0x0400, 0x0400, 0x07E0,
178 0x0000, 0x0000, 0x0000, 0x0000},
179
180 {0x0000, 0x0000, 0x0000, 0x0000, /* 3 */
181 0x03C0, 0x0420, 0x0020, 0x01C0,
182 0x0020, 0x0020, 0x0420, 0x03C0,
183 0x0000, 0x0000, 0x0000, 0x0000},
184
185 {0x0000, 0x0000, 0x0000, 0x0000, /* 4 */
186 0x0040, 0x00C0, 0x0140, 0x0240,
187 0x0440, 0x07E0, 0x0040, 0x0040,
188 0x0000, 0x0000, 0x0000, 0x0000},
189
190 {0x0000, 0x0000, 0x0000, 0x0000, /* 5 */
191 0x03C0, 0x0200, 0x0200, 0x03C0,
192 0x0020, 0x0020, 0x0420, 0x03C0,
193 0x0000, 0x0000, 0x0000, 0x0000},
194
195 {0x0000, 0x0000, 0x0000, 0x0000, /* 6 */
196 0x03C0, 0x0400, 0x0400, 0x07C0,
197 0x0420, 0x0420, 0x0420, 0x03C0,
198 0x0000, 0x0000, 0x0000, 0x0000},
199
200 {0x0000, 0x03C0, 0x07E0, 0x0FF0, /* 7 */
201 0x1FF8, 0x1FF8, 0x3FFC, 0x3FFC,
202 0x7FFE, 0x7FFE, 0x7FFE, 0xFFFF,
203 0xFFFF, 0xFFFF, 0x0000, 0x0000},
204
205 {0x0000, 0x0000, 0xFFFF, 0xFFFF, /* 8 */
206 0xFFFF, 0x7FFE, 0x7FFE, 0x7FFE,
207 0x3FFC, 0x3FFC, 0x1FF8, 0x1FF8,
208 0x0FF0, 0x07E0, 0x03C0, 0x0000},
209
210 {0x3800, 0x3F00, 0x3FC0, 0x3FF0, /* 9 */
211 0x3FF8, 0x3FFC, 0x3FFE, 0x3FFE,
212 0x3FFE, 0x3FFE, 0x3FFC, 0x3FF8,
213 0x3FF0, 0x3FC0, 0x3F00, 0x3800},
214
215 {0x001C, 0x00FC, 0x03FC, 0x0FFC, /* 10 */
216 0x1FFC, 0x3FFC, 0x7FFC, 0x7FFC,
217 0x7FFC, 0x7FFC, 0x3FFC, 0x1FFC,
218 0x0FFC, 0x03FC, 0x00FC, 0x001C},
219/*
220
221*/
222 {0x0000, 0x0000, 0x0000, 0x0000, /* 11 */
223 0x0080, 0x0180, 0x0080, 0x0000,
224 0x0000, 0x0000, 0x0000, 0x01C0,
225 0x0000, 0x0000, 0x0000, 0x0000},
226
227 {0x0000, 0x0000, 0x0000, 0x0000, /* 12 */
228 0x03C0, 0x0420, 0x0020, 0x0000,
229 0x03C0, 0x0400, 0x0000, 0x07E0,
230 0x0000, 0x0000, 0x0000, 0x0000},
231
232 {0x0000, 0x0000, 0x0000, 0x0000, /* 13 */
233 0x03C0, 0x0420, 0x0020, 0x01C0,
234 0x0020, 0x0000, 0x0420, 0x03C0,
235 0x0000, 0x0000, 0x0000, 0x0000},
236
237 {0x0000, 0x0000, 0x0000, 0x0000, /* 14 */
238 0x0000, 0x0000, 0x0000, 0x0000,
239 0x0000, 0x0000, 0x0000, 0x0000,
240 0x0000, 0x0000, 0x0000, 0x0000},
241
242 {0x0000, 0x07E0, 0x1FF8, 0x3FFC, /* 15 */
243 0x7FFE, 0x7FFE, 0xFFFF, 0xFFFF,
244 0xFFFF, 0xFFFF, 0x7FFE, 0x7FFE,
245 0x3FFC, 0x1FF8, 0x07E0, 0x0000},
246
247 {0x0000, 0x7FFE, 0x7FFE, 0x7FFE, /* 16 */
248 0x7FFE, 0x7FFE, 0x7FFE, 0x7FFE,
249 0x7FFE, 0x7FFE, 0x7FFE, 0x7FFE,
250 0x7FFE, 0x7FFE, 0x7FFE, 0x0000},
251
252 {0x0000, 0x0000, 0x0000, 0x0000, /* 17 */
253 0x03C0, 0x0420, 0x0420, 0x0420,
254 0x07E0, 0x0420, 0x0420, 0x0420,
255 0x0000, 0x0000, 0x0000, 0x0000},
256
257 {0x0000, 0x0000, 0x0000, 0x0000, /* 18 */
258 0x07C0, 0x0220, 0x0220, 0x03C0,
259 0x0220, 0x0220, 0x0220, 0x07C0,
260 0x0000, 0x0000, 0x0000, 0x0000},
261
262 {0x0000, 0x0000, 0x0000, 0x0000, /* 19 */
263 0x0000, 0x0000, 0x0000, 0x007F,
264 0x00FF, 0x01C0, 0x0180, 0x0180,
265 0x0180, 0x0180, 0x0180, 0x0180},
266
267 {0x0180, 0x0180, 0x0180, 0x0180, /* 20 */
268 0x0180, 0x0180, 0x0380, 0xFF00,
269 0xFE00, 0x0000, 0x0000, 0x0000,
270 0x0000, 0x0000, 0x0000, 0x0000},
271/*
272
273*/
274 {0x0000, 0x0000, 0x0000, 0x0000, /* 21 */
275 0x0000, 0x0000, 0x0000, 0xFE00,
276 0xFF00, 0x0380, 0x0180, 0x0180,
277 0x0180, 0x0180, 0x0180, 0x0180},
278
279 {0x0180, 0x0180, 0x0180, 0x0180, /* 22 */
280 0x0180, 0x0180, 0x01C0, 0x00FF,
281 0x007F, 0x0000, 0x0000, 0x0000,
282 0x0000, 0x0000, 0x0000, 0x0000},
283
284 {0x0000, 0x0000, 0x0000, 0x0000, /* 23 */
285 0x0000, 0x0000, 0x0000, 0xFFFF,
286 0xFFFF, 0x0000, 0x0000, 0x0000,
287 0x0000, 0x0000, 0x0000, 0x0000},
288
289 {0x0180, 0x0180, 0x0180, 0x0180, /* 24 */
290 0x0180, 0x0180, 0x0180, 0x0180,
291 0x0180, 0x0180, 0x0180, 0x0180,
292 0x0180, 0x0180, 0x0180, 0x0180},
293
294 {0x0003, 0x0007, 0x000E, 0x001C, /* 25 */
295 0x0038, 0x0070, 0x00E0, 0x01C0,
296 0x0380, 0x0700, 0x0E00, 0x1C00,
297 0x3800, 0x7000, 0xE000, 0xC000},
298
299 {0xC000, 0xE000, 0x7000, 0x3800, /* 26 */
300 0x1C00, 0x0E00, 0x0700, 0x0380,
301 0x01C0, 0x00E0, 0x0070, 0x0038,
302 0x001C, 0x000E, 0x0007, 0x0003}
303
304 {0x0000, 0x0000, 0x0000, 0x03C0, /* 27 */
305 0x07E0, 0x0E70, 0x0C30, 0x0C30,
306 0x0FF0, 0x0FF0, 0x0C30, 0x0C30,
307 0x0C30, 0x0000, 0x0000, 0x0000},
308
309 {0x0000, 0x0000, 0x0000, 0x0FE0, /* 28 */
310 0x0FF0, 0x0630, 0x0630, 0x07E0,
311 0x07E0, 0x0630, 0x0630, 0x0FF0,
312 0x0FE0, 0x0000, 0x0000, 0x0000},
313
314 {0x0000, 0x0000, 0x0000, 0x0080, /* 29 */
315 0x0180, 0x0380, 0x0180, 0x0180,
316 0x0180, 0x0180, 0x0180, 0x03C0,
317 0x03C0, 0x0000, 0x0000, 0x0000},
318
319 {0x0000, 0x0000, 0x0000, 0x03C0, /* 30 */
320 0x07E0, 0x0660, 0x0060, 0x03E0,
321 0x07C0, 0x0600, 0x0600, 0x07E0,
322 0x07E0, 0x0000, 0x0000, 0x0000},
323/*
324
325*/
326 {0x0000, 0x0000, 0x0000, 0x03C0, /* 31 */
327 0x07E0, 0x0660, 0x0060, 0x01C0,
328 0x01C0, 0x0060, 0x0660, 0x07E0,
329 0x03C0, 0x0000, 0x0000, 0x0000},
330
331 {0x0000, 0x0000, 0x0000, 0x0000, /* 32 */
332 0x0060, 0x0660, 0x0660, 0x0660,
333 0x07F0, 0x07F0, 0x0060, 0x0060,
334 0x0060, 0x0000, 0x0000, 0x0000},
335
336 {0x0000, 0x0000, 0x0000, 0x07C0, /* 33 */
337 0x07C0, 0x0600, 0x0600, 0x07C0,
338 0x07E0, 0x0060, 0x0060, 0x07E0,
339 0x03C0, 0x0000, 0x0000, 0x0000},
340
341 {0x0000, 0x0000, 0x0000, 0x03C0, /* 34 */
342 0x07C0, 0x0600, 0x0600, 0x07C0,
343 0x07E0, 0x0660, 0x0660, 0x07E0,
344 0x03C0, 0x0000, 0x0000, 0x0000},
345
346 {0x0000, 0x7FFE, 0x7FFE, 0x7FFE, /* 35 */
347 0x7FFE, 0x7FFE, 0x7FFE, 0x7FFE,
348 0x7FFE, 0x7FFE, 0x7FFE, 0x7FFE,
349 0x7FFE, 0x7FFE, 0x7FFE, 0x0000}
350};
351
352/*
353
354*/
355
356/*
357 =============================================================================
358 putpat() -- display a pattern in a configuration diagram
359 =============================================================================
360*/
361
362putpat(pn, px, py, patc)
363short pn, px, py, patc;
364{
365 register short xp, yp, pr, pc;
366 register unsigned pw;
367
368 if (v_regs[5] & 0x0180)
369 vbank(0);
370
371 for (pr = 0; pr < 16; pr++) {
372
373 pw = pat[pn - 1][pr];
374 yp = py - 8 + pr + TopEdge;
375
376 if ((yp GE TopEdge) AND
377 (yp LE BotEdge)) {
378
379 for (pc = 0; pc < 16; pc++) {
380
381 xp = px - 8 + pc + LftEdge;
382
383 if ((xp GE LftEdge) AND
384 (xp LE RgtEdge) AND
385 (pw & (1 << (15 - pc)))) {
386
387 vputp(idoct, xp, yp, patc);
388 }
389 }
390 }
391 }
392}
393
394/*
395
396*/
397
398/*
399 =============================================================================
400 dispcfg() -- display a configuration on the screen
401 =============================================================================
402*/
403
404dispcfg(nn)
405register short nn;
406{
407 register short i, np;
408 short idbuf[8];
409 register char *cfgdat, *cfp;
410
411 if (v_regs[5] & 0x0180)
412 vbank(0);
413
414 tsplot4(instob, 64, CFBX18, wcmrow, 4 + wcmcol, "Config #", 14);
415
416 sprintf(idbuf, "%02d", nn);
417 tsplot4(instob, 64, CFBX18, wcmrow, 12 + wcmcol, idbuf, 14);
418
419 cfgdat = cfgptr[nn];
420
421 for (i = 0; i < 64; i++) {
422
423 cfp = cfgdat + (i << 1) + i;
424 np = *cfp;
425
426 if (np)
427 putpat(np, *(cfp + 1), *(cfp + 2), patctab[np - 1]);
428 }
429}
430
431/*
432
433*/
434
435/*
436 =============================================================================
437 showcfg() -- display a configuration in the configuration window
438 =============================================================================
439*/
440
441showcfg(nn)
442short nn;
443{
444 LftEdge = LFT_EDGE;
445 TopEdge = TOP_EDGE;
446 RgtEdge = RGT_EDGE;
447 BotEdge = BOT_EDGE;
448 wcmrow = 17;
449 wcmcol = 0;
450
451 if (v_regs[5] & 0x0180)
452 vbank(0);
453
454 vbfill4(instob, 128, LftEdge, TopEdge, RgtEdge, BotEdge,
455 exp_c(CBBX18));
456
457 dispcfg(nn);
458}
459
460/*
461
462*/
463
464/*
465 =============================================================================
466 dispws() -- display a waveshape
467 =============================================================================
468*/
469
470dispws(ws)
471short ws;
472{
473 register unsigned *wsp;
474 register short i, x, y;
475 char buf[64];
476
477 if (ws GE NUMWAVS) /* number must be valid */
478 return;
479
480 wsp = wslib[ws].final; /* point at the data */
481
482 /* label the waveshape */
483
484 sprintf(buf, "Waveshape #%02d", ws + 1);
485 tsplot4(instob, 64, CFBX21, wcmrow, wcmcol + 2, buf, 14);
486
487 for (i = 1; i < 254; i++) { /* draw the points */
488
489 x = LftEdge + (i >> 1);
490 y = BotEdge - ((wsp[i] ^ 0x8000) / 676);
491
492 idpoint(x, y, WSBFC);
493 }
494}
495
496/*
497
498*/
499
500/*
501 =============================================================================
502 wcmenu() -- setup the display for a waveshape or configuration menu
503 =============================================================================
504*/
505
506wcmenu(wc)
507short wc;
508{
509 register short i;
510 char buf[32];
511
512 wcflag = wc; /* set menu page type */
513
514 if (v_regs[5] & 0x0180)
515 vbank(0);
516
517 vbfill4(instob, 128, 0, 0, 511, 349, exp_c(CBBX18));
518
519 point = idpoint;
520
521 lseg( 0, 0, 511, 0, CBORD); /* outside border */
522 lseg(511, 0, 511, 349, CBORD);
523 lseg(511, 349, 0, 349, CBORD);
524 lseg( 0, 349, 0, 0, CBORD);
525
526 lseg( 0, 112, 511, 112, CBORD); /* horizontal lines */
527 lseg( 0, 224, 511, 224, CBORD);
528 lseg( 0, 335, 511, 335, CBORD);
529
530 lseg(128, 0, 128, 335, CBORD); /* vertical lines */
531 lseg(256, 0, 256, 335, CBORD);
532 lseg(384, 0, 384, 335, CBORD);
533
534 ebflag = FALSE; /* clear edit buffer */
535 memset(ebuf, '\0', sizeof ebuf);
536
537 curslim = RTOY(24)-1; /* text cursor in bottom row */
538
539 x_key = nokey;
540 csbp = idmbox;
541
542/*
543
544*/
545 if (wc) { /* waveshape */
546
547 for (i = 0; i < 12; i++) { /* fill in waveshapes */
548
549 LftEdge = ((i % 4) * 128) + 1;
550 BotEdge = ((i / 4) * 112) + 111;
551 wcmrow = (i / 4) << 3;
552 wcmcol = (i % 4) << 4;
553
554 dispws(i + (wcpage * 12));
555 }
556
557 /* label data entry area and show page number */
558
559 sprintf(buf, "Waveshape A%02d B%02d Page",
560 1 + vbufs[curvce].idhwsb,
561 1 + vbufs[curvce].idhwsa);
562
563 tsplot4(instob, 64, CFBX18, 24, 1, buf, 14);
564
565 tsplot4(instob, 64, wcpage ? CFBX18 : ID_ENTRY,
566 24, 26, "1", 14);
567
568 tsplot4(instob, 64, wcpage ? ID_ENTRY : CFBX18,
569 24, 28, "2", 14);
570
571 curfet = id_fet2;
572 settc(24, 12);
573/*
574
575*/
576 } else { /* configuration */
577
578 for (i = 0; i < 12; i++) { /* fill in configurations */
579
580 LftEdge = ((i % 4) * 128) + 1;
581 TopEdge = ((i / 4) * 112) + 1;
582 RgtEdge = LftEdge + 128;
583 BotEdge = TopEdge + 112;
584 wcmrow = (i / 4) << 3;
585 wcmcol = (i % 4) << 4;
586
587 dispcfg(i);
588 }
589
590 /* label data entry area */
591
592 tsplot4(instob, 64, CFBX18, 24, 1, "Configuration #", 14);
593
594 sprintf(buf, "%02d", vbufs[curvce].idhcfg);
595 tsplot4(instob, 64, CFBX18, 24, 16, buf, 14);
596
597 curfet = id_fet3;
598 settc(24, 16);
599 }
600}
601
602/*
603
604*/
605
606/*
607 =============================================================================
608 imfnbox() -- instrument menu box hit processor
609 =============================================================================
610*/
611
612imfnbox(n)
613short n;
614{
615 register short row, col;
616
617 row = hitcy / 14;
618 col = hitcx >> 3;
619
620 if (hitbox EQ 12) {
621
622 if (wcflag) { /* waveshape */
623
624 if (col < 10) { /* take down menu */
625
626 reshowi();
627 settc(17, wmcsel ? 61 : 57);
628
629 } else if ((col GE 19) AND (col LE 22)) {
630
631 /* toggle waveshape display page */
632
633 if (wcpage)
634 wcpage = 0; /* to page 1 */
635 else
636 wcpage = 1; /* to page 2 */
637
638 wcmenu(1);
639 return;
640
641 } else { /* data entry */
642
643 wmctag = FALSE;
644 enterit();
645
646 if (wmctag)
647 modinst();
648
649 return;
650 }
651/*
652
653*/
654 } else { /* configuration */
655
656 if (col < 14) { /* take down menu */
657
658 reshowi();
659 settc(17, 12);
660
661 } else { /* data entry */
662
663 wmctag = FALSE;
664 enterit();
665
666 if (wmctag)
667 modinst();
668
669 return;
670 }
671 }
672 }
673}
Note: See TracBrowser for help on using the repository browser.