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

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

Removed form-feed comments.

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