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

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

Zero redundant declarations.

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