source: buchla-68k/ram/showcfg.c@ 0580615

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

Point of no return.

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