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

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

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