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

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

Prototypes for global function pointers. Consistent global types.

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