source: buchla-68k/ram/asgdsp.c@ 7ecfb7b

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

Unused variables and parameters.

  • Property mode set to 100644
File size: 21.5 KB
Line 
1/*
2 =============================================================================
3 asgdsp.c -- MIDAS assignment editor
4 Version 50 -- 1988-10-04 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGIT 0
9
10#include "ram.h"
11
12#define PSG_ADDR 0
13#define PSG_READ 0
14#define PSG_WRIT 2
15
16#define PSG_IOEN 7
17#define PSG_IDLE 0xBF
18
19#define PSG_PRTB 15 /* PSG Port B */
20
21#define AUX_BIT 0x02 /* aux control bit in PSG port B */
22
23/* 4 bit pixel patterns */
24
25#define AKW_0 0x0000
26#define AKW_1 0xF000
27#define AKW_2 0x0F00
28#define AKW_3 0xFF00
29#define AKW_4 0x00F0
30#define AKW_5 0xF0F0
31#define AKW_6 0x0FF0
32#define AKW_7 0xFFF0
33#define AKW_8 0x000F
34#define AKW_9 0xF00F
35#define AKW_A 0x0F0F
36#define AKW_B 0xFF0F
37#define AKW_C 0x00FF
38#define AKW_D 0xF0FF
39#define AKW_E 0x0FFF
40#define AKW_F 0xFFFF
41
42int8_t *gprep[] = {" ", "1", "2", "L"};
43
44int8_t *asgsrc[] = { /* source labels */
45
46 "1 Pch/Hor",
47 "2 Mod/Vrt",
48 "3 Brth/LP",
49 "4 GPC/CV1",
50 "5 Pedal 1",
51 "6 Key Prs"
52};
53
54/* keys are 5 pixels wide on top, except the last one, which is 8 pixels wide */
55
56int16_t asgkble[88] = { /* key left edge offsets */
57
58 /* piano MIDI */
59
60 1, 6, 11, /* 1..3 21..23 */
61 17, 22, 27, 32, 37, /* 4..8 24..28 */
62 43, 48, 53, 58, 63, 68, 73, /* 9..15 29..35 */
63 79, 84, 89, 94, 99, /* 16..20 36..40 */
64 105, 110, 115, 120, 125, 130, 135, /* 21..27 41..47 */
65 141, 146, 151, 156, 161, /* 28..32 48..52 */
66 167, 172, 177, 182, 187, 192, 197, /* 33..39 53..59 */
67 203, 208, 213, 218, 223, /* 40..44 60..64 */
68 229, 234, 239, 244, 249, 254, 259, /* 45..51 65..71 */
69 265, 270, 275, 280, 285, /* 52..56 72..76 */
70 291, 296, 301, 306, 311, 316, 321, /* 57..63 77..83 */
71 327, 332, 337, 342, 347, /* 64..68 84..88 */
72 353, 358, 363, 368, 373, 378, 383, /* 69..75 89..95 */
73 389, 394, 399, 404, 409, /* 76..80 96..100 */
74 415, 420, 425, 430, 435, 440, 445, /* 81..87 101..107 */
75 451 /* 88 108 */
76};
77
78uint16_t asgkbtp[AK_WIDTH] = { /* keyboard icon top lines */
79
80 AKW_7, AKW_C, AKW_1, AKW_F,
81 AKW_7, AKW_C, AKW_1, AKW_F,
82 AKW_0, AKW_7, AKW_D, AKW_F,
83 AKW_0, AKW_7, AKW_C, AKW_1,
84 AKW_F, AKW_0, AKW_7, AKW_D,
85 AKW_F, AKW_0, AKW_7, AKW_C,
86 AKW_1, AKW_F,
87
88 AKW_7, AKW_C, AKW_1, AKW_F,
89 AKW_0, AKW_7, AKW_C, AKW_1,
90 AKW_F, AKW_7, AKW_C, AKW_1,
91 AKW_F, AKW_0, AKW_7, AKW_D,
92 AKW_F, AKW_0, AKW_7, AKW_C,
93 AKW_1, AKW_F, AKW_0, AKW_7,
94 AKW_D, AKW_F, AKW_0, AKW_7,
95 AKW_C, AKW_1, AKW_F,
96
97 AKW_7, AKW_C, AKW_1, AKW_F,
98 AKW_0, AKW_7, AKW_C, AKW_1,
99 AKW_F, AKW_7, AKW_C, AKW_1,
100 AKW_F, AKW_0, AKW_7, AKW_D,
101 AKW_F, AKW_0, AKW_7, AKW_C,
102 AKW_1, AKW_F, AKW_0, AKW_7,
103 AKW_D, AKW_F, AKW_0, AKW_7,
104 AKW_C, AKW_1, AKW_F,
105
106 AKW_7, AKW_C, AKW_1, AKW_F,
107 AKW_0, AKW_7, AKW_C, AKW_1,
108 AKW_F, AKW_7, AKW_C, AKW_1,
109 AKW_F, AKW_0, AKW_7, AKW_D,
110 AKW_F, AKW_0, AKW_7, AKW_C,
111 AKW_1, AKW_F, AKW_0, AKW_7,
112 AKW_D, AKW_F, AKW_E
113};
114
115uint16_t asgkbbt[AK_WIDTH] = { /* keyboard icon bottom lines */
116
117 AKW_7, AKW_F, AKW_7, AKW_F,
118 AKW_7, AKW_F, AKW_7, AKW_F,
119 AKW_B, AKW_F, AKW_D, AKW_F,
120 AKW_E, AKW_F, AKW_F, AKW_7,
121 AKW_F, AKW_B, AKW_F, AKW_D,
122 AKW_F, AKW_E, AKW_F, AKW_E,
123 AKW_F, AKW_F,
124
125 AKW_7, AKW_F, AKW_B, AKW_F,
126 AKW_D, AKW_F, AKW_E, AKW_F,
127 AKW_F, AKW_7, AKW_F, AKW_B,
128 AKW_F, AKW_B, AKW_F, AKW_D,
129 AKW_F, AKW_E, AKW_F, AKW_F,
130 AKW_7, AKW_F, AKW_B, AKW_F,
131 AKW_D, AKW_F, AKW_E, AKW_F,
132 AKW_E, AKW_F, AKW_F,
133
134 AKW_7, AKW_F, AKW_B, AKW_F,
135 AKW_D, AKW_F, AKW_E, AKW_F,
136 AKW_F, AKW_7, AKW_F, AKW_B,
137 AKW_F, AKW_B, AKW_F, AKW_D,
138 AKW_F, AKW_E, AKW_F, AKW_F,
139 AKW_7, AKW_F, AKW_B, AKW_F,
140 AKW_D, AKW_F, AKW_E, AKW_F,
141 AKW_E, AKW_F, AKW_F,
142
143 AKW_7, AKW_F, AKW_B, AKW_F,
144 AKW_D, AKW_F, AKW_E, AKW_F,
145 AKW_F, AKW_7, AKW_F, AKW_B,
146 AKW_F, AKW_B, AKW_F, AKW_D,
147 AKW_F, AKW_E, AKW_F, AKW_F,
148 AKW_7, AKW_F, AKW_B, AKW_F,
149 AKW_D, AKW_F, AKW_E
150};
151
152int16_t asgpal[16][3] = { /* assignment editor color palette */
153
154 {0, 0, 0}, /* 0 */
155 {3, 3, 3}, /* 1 */
156 {0, 0, 2}, /* 2 */
157 {1, 0, 1}, /* 3 */
158 {0, 1, 2}, /* 4 */
159 {0, 1, 1}, /* 5 (was 0, 1, 0) */
160 {1, 1, 2}, /* 6 */
161 {0, 0, 1}, /* 7 */
162 {2, 2, 2}, /* 8 */
163 {0, 0, 0}, /* 9 */
164 {2, 2, 2}, /* 10 (was 1, 1, 0) */
165 {2, 3, 3}, /* 11 */
166 {3, 3, 0}, /* 12 */
167 {3, 0, 0}, /* 13 */
168 {0, 0, 0}, /* 14 */
169 {0, 2, 3} /* 15 (was 0, 3, 2) */
170};
171
172int16_t dyntab[10] = { /* dynamics translation table */
173
174 0, /* 0 */
175 ( 120 << 5), /* 1 */
176 ( 180 << 5), /* 2 */
177 ( 250 << 5), /* 3 */
178 ( 320 << 5), /* 4 */
179 ( 400 << 5), /* 5 */
180 ( 500 << 5), /* 6 */
181 ( 630 << 5), /* 7 */
182 ( 790 << 5), /* 8 */
183 (1000 << 5) /* 9 */
184};
185
186/*
187 =============================================================================
188 advacur() -- advance the assignment display text cursor
189 =============================================================================
190*/
191
192void advacur(void)
193{
194 register int16_t newcol;
195
196 if (infield(stcrow, stccol, curfet))
197 cfetp = infetp;
198 else
199 return;
200
201 newcol = stccol + 1;
202
203 if (newcol LE cfetp->frcol)
204 itcpos(stcrow, newcol);
205
206 cxval = stccol << 3;
207 cyval = stcrow * 14;
208}
209
210/*
211 =============================================================================
212 bspacur() -- backspace the assignment display text cursor
213 =============================================================================
214*/
215
216void bspacur(void)
217{
218 register int16_t newcol;
219
220 if (infield(stcrow, stccol, curfet))
221 cfetp = infetp;
222 else
223 return;
224
225 newcol = stccol - 1;
226
227 if (newcol GE cfetp->flcol)
228 itcpos(stcrow, newcol);
229
230 cxval = stccol << 3;
231 cyval = stcrow * 14;
232}
233
234/*
235 =============================================================================
236 keycpyw() -- copy words into the keyboard object
237 =============================================================================
238*/
239
240void keycpyw(uint16_t *dest, uint16_t *src, int16_t len, uint16_t wk, uint16_t bk)
241{
242 register uint16_t wkey, bkey, theword;
243 register int16_t i;
244
245 wkey = exp_c(wk);
246 bkey = exp_c(bk);
247
248 for (i = 0; i < len; i++) {
249
250 theword = *src++;
251 *dest++ = (theword & wkey) | ((~theword) & bkey);
252 }
253}
254
255/*
256 =============================================================================
257 asgkb() -- draw the assignment keyboard icon
258 =============================================================================
259*/
260
261void asgkb(void)
262{
263 register uint16_t *p;
264 register uint16_t akline;
265 register int16_t i, j;
266
267 akline = exp_c(AK_LINE);
268 p = asgob + (int32_t)AKSTART;
269
270 for (j = 0; j < 12; j++) {
271
272 memsetw(p, akline, AK_WIDTH);
273 p += 128L;
274
275 for (i = 0; i < 13; i++) {
276
277 keycpyw(p, asgkbtp, AK_WIDTH, AK_WKEYT, AK_BKEYT);
278 p += 128L;
279 }
280 }
281
282 memsetw(p, akline, AK_WIDTH);
283 p += 128L;
284
285 for (i = 0; i < 14; i++) {
286
287 keycpyw(p, asgkbtp, AK_WIDTH, AK_WKEYB, AK_BKEYB);
288 p += 128L;
289 }
290
291 for (i = 0; i < 11; i++) {
292
293 keycpyw(p, asgkbbt, AK_WIDTH, AK_WKEYB, AK_BKEYB);
294 p += 128L;
295 }
296
297 memsetw(p, akline, AK_WIDTH);
298}
299
300/*
301 =============================================================================
302 drawk2g() -- display key assignments for a group
303 =============================================================================
304*/
305
306void drawk2g(int16_t grp)
307{
308 register int16_t i;
309 register int16_t n;
310 register int16_t key;
311 register int16_t line;
312 register int8_t *bfsp;
313 register uint16_t *lp;
314
315 n = 7; /* key to group window */
316
317 line = (14 * grp) + AK_BASE;
318 lp = asgob + ((int32_t)line << 7) + 6L;
319
320 for (i = 0; i < 4; i++) {
321
322 keycpyw(lp, asgkbtp, AK_WIDTH, AK_WKEYT, AK_BKEYT);
323 lp += 128L;
324 }
325
326 if (grp2prt[grp][0] EQ 1) {
327
328 for (key = 0; key < 88; key++)
329 if (key2grp[key] & (0x0001 << grp))
330 vbfill4(asgob, 128, asgkble[key] + 24, line,
331 asgkble[key] + (key EQ 87 ? 31 : 28),
332 line + 3, exp_c(AK_SELC));
333
334 sprintf(bfs, "%c", (grp > 8) ? (grp + 163) : (grp + '1'));
335 bfsp = bfs;
336
337 } else {
338
339 bfsp = " ";
340 }
341
342 vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
343 adbox[n][6] + 1 + grp, adbox[n][7], bfsp, 14);
344
345 vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
346 adbox[n][6] + 1 + grp, adbox[n][7] + 61, bfsp, 14);
347}
348
349/*
350 =============================================================================
351 adpoint() -- plot a point for the lseg function
352 =============================================================================
353*/
354
355void adpoint(int16_t x, int16_t y, int16_t pen)
356{
357 if (v_regs[5] & 0x0180)
358 vbank(0);
359
360 vputp(adoct, x, y, exp_c(pen));
361}
362
363/*
364 =============================================================================
365 numblk() -- return a number string or a blank string
366 =============================================================================
367*/
368
369int8_t *numblk(int8_t *buf, int16_t n)
370{
371 if (n EQ -1) {
372
373 strcpy(buf, " ");
374 return(buf);
375
376 } else {
377
378 sprintf(buf, "%02.2d", n);
379 return(buf);
380 }
381}
382
383/*
384 =============================================================================
385 adswin() -- display a window
386 =============================================================================
387*/
388
389void adswin(int16_t n)
390{
391 register int16_t cx, i;
392 int8_t buf1[4], buf2[4];
393
394 if ((n EQ 7) AND (admctl NE -1))
395 return;
396
397 cx = exp_c(adbox[n][5]);
398 point = adpoint;
399
400 /* first, fill the box with the background color */
401
402 vbank(0);
403 vbfill4(asgob, 128, adbox[n][0], adbox[n][1], adbox[n][2],
404 adbox[n][3], cx);
405
406 /* put in the box label */
407
408 tsplot4(asgob, 64, adbox[n][4], adbox[n][6], adbox[n][7],
409 adbxlb[n], 14);
410
411
412 switch (n) { /* final text - overlays above stuff */
413
414 case 0: /* assignment table number and name */
415
416 sprintf(bfs, "%02.2d", curasg);
417 tsplot4(asgob, 64, (asgmod ? AK_MODC : adbox[n][4]),
418 adbox[n][6], adbox[n][7] + 8, bfs, 14);
419
420 sprintf(bfs, "%-10.10s", caname);
421 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 1,
422 adbox[n][7], bfs, 14);
423
424 return;
425
426 case 2: /* output MIDI port number */
427
428 tsplot4(asgob, 64, adbox[n][4], adbox[n][6], adbox[n][7] + 9,
429 gprep[curmop], 14);
430
431 return;
432
433 case 3: /* MIDI program change channel (always on port 1) */
434
435 sprintf(bfs, "%02.2d", prgchan);
436 tsplot4(asgob, 64, adbox[n][4], adbox[n][6], adbox[n][7] + 8,
437 bfs, 14);
438
439 return;
440
441 case 4: /* groups to voices */
442
443 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 1, adbox[n][7],
444 "of Groups", 14);
445
446 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 2, adbox[n][7],
447 "to Voices", 14);
448
449 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 3, adbox[n][7],
450 "V Gr V Gr", 14);
451
452 lseg(CTOX(13), RTOY(3) + 13,
453 CTOX(13) + 7, RTOY(3) + 13, adbox[n][4]);
454
455 lseg(CTOX(15), RTOY(3) + 13,
456 CTOX(16) + 7, RTOY(3) + 13, adbox[n][4]);
457
458 lseg(CTOX(19), RTOY(3) + 13,
459 CTOX(19) + 7, RTOY(3) + 13, adbox[n][4]);
460
461 lseg(CTOX(21), RTOY(3) + 13,
462 CTOX(22) + 7, RTOY(3) + 13, adbox[n][4]);
463
464 for (i = 0; i < 6; i++) {
465
466 sprintf(bfs, "%c %s", i + '1',
467 numblk(buf1, vce2grp[i]));
468
469 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + i + 4,
470 adbox[n][7], bfs, 14);
471
472 sprintf(bfs, "%c %s", (i > 2 ? (i + 169) : (i + '7')),
473 numblk(buf2, vce2grp[i + 6]));
474
475 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + i + 4,
476 adbox[n][7] + 6, bfs, 14);
477 }
478
479 return;
480
481 case 5: /* MIDI controller number assignments */
482
483 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 1, adbox[n][7],
484 "Sources and", 14);
485
486 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 2, adbox[n][7],
487 "Controllers", 14);
488
489 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 3, adbox[n][7],
490 "# Source CN", 14);
491
492 lseg(CTOX(25), RTOY(3) + 13,
493 CTOX(25) + 7, RTOY(3) + 13, adbox[n][4]);
494
495 lseg(CTOX(27), RTOY(3) + 13,
496 CTOX(33) + 7, RTOY(3) + 13, adbox[n][4]);
497
498 lseg(CTOX(35), RTOY(3) + 13,
499 CTOX(36) + 7, RTOY(3) + 13, adbox[n][4]);
500
501 for (i = 0; i < 6; i++)
502 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + i + 4,
503 adbox[n][7], asgsrc[i], 14);
504
505 for (i = 0; i < 4; i++) {
506
507 sprintf(bfs, "%s", numblk(buf1, (mctlnum[i] & 0x00FF)));
508
509 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + i + 5,
510 adbox[n][7] + 10, bfs, 14);
511
512 if ((mctlnum[i] NE -1) AND (mctlnum[i] & CTAG1)) {
513
514 bfs[0] = '2' + i;
515 bfs[1] = '\0';
516
517 tsplot4(asgob, 64, AK_MODC, adbox[n][6] + i + 5,
518 adbox[n][7], bfs, 14);
519 }
520 }
521
522 return;
523
524 case 6: /* instruments, dynamics, MIDI ports and channels to groups */
525
526 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 1, adbox[n][7],
527 "Dynamics, MIDI Ports and", 14);
528
529 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 2, adbox[n][7],
530 "Channels to Groups", 14);
531
532 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 3, adbox[n][7],
533 "G In D I Ch G In D I Ch", 14);
534
535 lseg(CTOX(39), RTOY(3) + 13,
536 CTOX(39) + 7, RTOY(3) + 13, adbox[n][4]);
537
538 lseg(CTOX(41), RTOY(3) + 13,
539 CTOX(42) + 7, RTOY(3) + 13, adbox[n][4]);
540
541 lseg(CTOX(44), RTOY(3) + 13,
542 CTOX(44) + 7, RTOY(3) + 13, adbox[n][4]);
543
544 lseg(CTOX(46), RTOY(3) + 13,
545 CTOX(46) + 7, RTOY(3) + 13, adbox[n][4]);
546
547 lseg(CTOX(48), RTOY(3) + 13,
548 CTOX(49) + 7, RTOY(3) + 13, adbox[n][4]);
549
550
551 lseg(CTOX(52), RTOY(3) + 13,
552 CTOX(52) + 7, RTOY(3) + 13, adbox[n][4]);
553
554 lseg(CTOX(54), RTOY(3) + 13,
555 CTOX(55) + 7, RTOY(3) + 13, adbox[n][4]);
556
557 lseg(CTOX(57), RTOY(3) + 13,
558 CTOX(57) + 7, RTOY(3) + 13, adbox[n][4]);
559
560 lseg(CTOX(59), RTOY(3) + 13,
561 CTOX(59) + 7, RTOY(3) + 13, adbox[n][4]);
562
563 lseg(CTOX(61), RTOY(3) + 13,
564 CTOX(62) + 7, RTOY(3) + 13, adbox[n][4]);
565
566
567 for (i = 0; i < 6; i++) {
568
569 sprintf(bfs, "%c %02.2d %d %s %s %c %02.2d %d %s %s",
570
571 i + '1',
572 (ins2grp[i] & 0x00FF), grpdyn[i],
573 gprep[grp2prt[i][0]],
574 numblk(buf1, grp2prt[i][1]),
575
576 ((i > 2) ? (i + 169) : (i + '7')),
577 (ins2grp[i + 6] & 0x00FF), grpdyn[i + 6],
578 gprep[grp2prt[i + 6][0]],
579 numblk(buf2, grp2prt[i + 6][1]));
580
581 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + i + 4,
582 adbox[n][7], bfs, 14);
583
584 if (GTAG1 & ins2grp[i]) {
585
586 bfs[1] = '\0';
587
588 tsplot4(asgob, 64, AK_MODC, adbox[n][6] + i + 4,
589 adbox[n][7], bfs, 14);
590 }
591
592 if (GTAG1 & ins2grp[i + 6]) {
593
594 bfs[14] = '\0';
595
596 tsplot4(asgob, 64, AK_MODC, adbox[n][6] + i + 4,
597 adbox[n][7] + 13, &bfs[13], 14);
598 }
599 }
600
601 return;
602
603 case 7: /* port 1 key to group assignments */
604
605 lseg( 8, 153, 15, 153, exp_c(adbox[n][4])); /* underlines */
606 lseg(496, 153, 503, 153, exp_c(adbox[n][4]));
607
608 asgkb(); /* icon */
609
610 for (i = 0; i < 12; i++) /* assignments */
611 drawk2g(i);
612
613 return;
614
615 case 8: /* aux control */
616
617 tsplot4(asgob, 64, (auxctl ? AK_MODC : adbox[n][4]),
618 adbox[n][6], adbox[n][7], "Aux", 14);
619
620 return;
621
622 case 9: /* tuning table */
623
624 tsplot4(asgob, 64, adbox[n][4], adbox[n][6], adbox[n][7],
625 "Tun", 14);
626
627 sprintf(bfs, "%d", curtun);
628 tsplot4(asgob, 64, (tunmod ? AK_MODC : adbox[n][4]),
629 adbox[n][6], adbox[n][7] + 4, bfs, 14);
630
631 return;
632
633 case 10: /* phase shifter variables -- intensity, rate depth */
634
635 sprintf(bfs, "Intnsty %02.2d", ps_intn);
636 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 1, adbox[n][7],
637 bfs, 14);
638
639 sprintf(bfs, "ModRate %02.2d", ps_rate);
640 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 2, adbox[n][7],
641 bfs, 14);
642
643 sprintf(bfs, "ModDpth %02.2d", ps_dpth);
644 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 3, adbox[n][7],
645 bfs, 14);
646
647 return;
648 }
649}
650
651/*
652 =============================================================================
653 initat() -- initialize assignment table
654 =============================================================================
655*/
656
657void initat(int16_t n)
658{
659 register struct asgent *ap;
660 register int16_t i;
661
662 ap = &asgtab[n];
663 ap->a_mop = 0; /* output to NULL */
664 ap->a_tun = 0; /* tuning = default */
665 ap->a_aux = 0; /* aux ctl = OFF */
666 ap->a_intn = 70; /* intensity */
667 ap->a_rate = 0; /* rate */
668 ap->a_dpth = 70; /* depth */
669
670 for (i = 0; i < 12; i++) { /* groups 1..12 */
671
672 ap->a_i2grp[i] = 0; /* instrument */
673 ap->a_gpdyn[i] = 9; /* dynamics */
674 }
675
676 for (i = 0; i < 8; i++) /* voices 1..8 to group 1 */
677 ap->a_v2grp[i] = 1;
678
679 for (i = 8; i < 12; i++) /* voices 9..12 to group 2 */
680 ap->a_v2grp[i] = 2;
681
682 ap->a_mctln[0] = 1; /* modulation wheel */
683 ap->a_mctln[1] = 2; /* breath controller */
684 ap->a_mctln[2] = 80; /* general controller 1 */
685 ap->a_mctln[3] = 4; /* pedal controller 1 */
686
687 ap->a_g2prt[0][0] = 1; /* group 1: port 1 input */
688 ap->a_g2prt[0][1] = 1; /* group 1: channel 1 in and out */
689 ap->a_g2prt[1][0] = 3; /* group 2: local input */
690 ap->a_g2prt[1][1] = 1; /* group 2: channel 1 in and out*/
691
692 for (i = 2; i < 12; i++) { /* groups 3..12 */
693
694 ap->a_g2prt[i][0] = 0; /* no input port */
695 ap->a_g2prt[i][1] = -1; /* no channel */
696 }
697
698 memsetw(ap->a_k2grp, 0x0001, 88); /* all keys in group 1 */
699
700 memcpy(ap->a_name, n ? "{unused} " : "{Default} ", 16);
701}
702
703/*
704 =============================================================================
705 setaux() -- set aux control
706 =============================================================================
707*/
708
709void setaux(int16_t aux)
710{
711 register int16_t psgdata;
712 register int8_t *psg;
713
714 auxctl = aux;
715 psg = &io_tone;
716
717 *(psg + PSG_ADDR) = PSG_IOEN; /* setup PSG I/O controls */
718 *(psg + PSG_WRIT) = PSG_IDLE;
719
720 *(psg + PSG_ADDR) = PSG_PRTB; /* read current psg data */
721 psgdata = *(psg + PSG_READ) & ~AUX_BIT;
722
723 *(psg + PSG_ADDR) = PSG_PRTB; /* send out updated aux data */
724 *(psg + PSG_WRIT) = psgdata | (aux ? 0 : AUX_BIT);
725}
726
727/*
728 =============================================================================
729 getasg() -- get an assignment table from the library
730 =============================================================================
731*/
732
733void getasg(int16_t n)
734{
735 register struct asgent *ap;
736 register int16_t i, grp, vce;
737
738 ap = &asgtab[n];
739 curmop = ap->a_mop;
740 gettun(ap->a_tun);
741 setaux(ap->a_aux);
742 ps_intn = ap->a_intn;
743 ps_rate = ap->a_rate;
744 ps_dpth = ap->a_dpth;
745 memcpyw(ins2grp, ap->a_i2grp, sizeof ins2grp / 2);
746 memcpyw(grpdyn, ap->a_gpdyn, sizeof grpdyn / 2);
747 memcpyw(vce2grp, ap->a_v2grp, sizeof vce2grp / 2);
748 memcpyw(mctlnum, ap->a_mctln, sizeof mctlnum / 2);
749 memcpyw(grp2prt, ap->a_g2prt, sizeof grp2prt / 2);
750 memcpyw(key2grp, ap->a_k2grp, sizeof key2grp / 2);
751 memcpy(caname, ap->a_name, 16);
752
753 for (i = 0; i < 12; i++) /* fix old tables */
754 if (grp2prt[i][0] EQ 4)
755 grp2prt[i][0] = 3;
756
757 sendval(1, 0, (ps_intn * 10) << 5);
758 sendval(2, 0, (ps_rate * 10) << 5);
759 sendval(3, 0, (ps_dpth * 10) << 5);
760
761 for (vce = 0; vce < 12; vce++) {
762
763 grp = vce2grp[vce];
764
765 if (grp NE -1) {
766
767 s_inst[vce] = ins2grp[grp - 1] & 0x00FF;
768 execins(vce, s_inst[vce], 1);
769 sendval(vce, 8, dyntab[grpdyn[grp - 1]]);
770 }
771 }
772
773 newvce(curvce);
774 asgmod = FALSE;
775}
776
777/*
778 =============================================================================
779 putasg() -- put an assignment table into the library
780 =============================================================================
781*/
782
783void putasg(int16_t n)
784{
785 register struct asgent *ap;
786 register int16_t i;
787
788 for (i = 0; i < 12; i++) /* fix old tables */
789 if (grp2prt[i][0] EQ 4)
790 grp2prt[i][0] = 3;
791
792 ap = &asgtab[n];
793 ap->a_mop = curmop;
794 ap->a_tun = curtun;
795 ap->a_aux = auxctl;
796 ap->a_intn = ps_intn;
797 ap->a_rate = ps_rate;
798 ap->a_dpth = ps_dpth;
799 memcpyw(ap->a_i2grp, ins2grp, sizeof ins2grp / 2);
800 memcpyw(ap->a_gpdyn, grpdyn, sizeof grpdyn / 2);
801 memcpyw(ap->a_v2grp, vce2grp, sizeof vce2grp / 2);
802 memcpyw(ap->a_mctln, mctlnum, sizeof mctlnum / 2);
803 memcpyw(ap->a_g2prt, grp2prt, sizeof grp2prt / 2);
804 memcpyw(ap->a_k2grp, key2grp, sizeof key2grp / 2);
805 memcpy(ap->a_name, caname, 16);
806 asgmod = FALSE;
807}
808
809/*
810 =============================================================================
811 awins() -- display all assignment editor windows
812 =============================================================================
813*/
814
815void awins(void)
816{
817 register int16_t i;
818
819 for (i = 0; i < 11; i++)
820 adswin(i);
821}
822
823/*
824 =============================================================================
825 inital() -- initialize assignment library
826 =============================================================================
827*/
828
829void inital(void)
830{
831 register int16_t n;
832
833 for (n = 0; n < NASGS; n++)
834 initat(n);
835
836 getasg(0);
837 prgchan = 1;
838}
839
840/*
841 =============================================================================
842 adbord() -- draw the border for the display
843 =============================================================================
844*/
845
846void adbord(void)
847{
848 point = adpoint;
849
850 lseg( 0, 0, 511, 0, AK_BORD); /* outer border */
851 lseg(511, 0, 511, 349, AK_BORD);
852 lseg(511, 349, 0, 349, AK_BORD);
853 lseg( 0, 349, 0, 0, AK_BORD);
854
855 lseg( 0, 41, 95, 41, AK_BORD); /* windows - H lines */
856 lseg( 0, 55, 95, 55, AK_BORD);
857 lseg( 0, 69, 95, 69, AK_BORD);
858 lseg( 0, 83, 95, 83, AK_BORD);
859 lseg( 0, 139, 511, 139, AK_BORD);
860
861 lseg( 39, 69, 39, 83, AK_BORD); /* windows - V lines */
862 lseg( 95, 0, 95, 139, AK_BORD);
863 lseg(191, 0, 191, 139, AK_BORD);
864 lseg(303, 0, 303, 139, AK_BORD);
865}
866
867/*
868 =============================================================================
869 asgdsp() -- put up the assignment display
870 =============================================================================
871*/
872
873void asgdsp(void)
874{
875 asgob = v_score; /* setup object pointer */
876 obj0 = v_curs0; /* setup cursor object pointer */
877 obj2 = v_tcur; /* setup typewriter object pointer */
878 adoct = &v_obtab[ASGOBJ]; /* setup object control table pointer */
879
880 adnamsw = FALSE; /* virtual typewriter not up */
881 submenu = FALSE; /* no submenu cursor up */
882 admctl = -1; /* no submenu up */
883
884 dswap(); /* initialize display */
885
886 vbank(0); /* clear the display */
887 memsetw(asgob, 0, 32767);
888 memsetw(asgob+32767L, 0, 12033);
889
890 SetObj(ASGOBJ, 0, 0, asgob, 512, 350, 0, 0, ASGNFL, -1);
891 SetObj( 0, 0, 1, obj0, 16, 16, CTOX(9), RTOY(0), OBFL_00, -1);
892 SetObj(TTCURS, 0, 1, obj2, 16, 16, 0, 0, TTCCFL, -1);
893
894 arcurs(AK_CURS); /* setup arrow cursor object */
895 itcini(AK_CURS); /* setup text cursor object */
896 ttcini(AK_CURS); /* setup virtual typewriter cursor object */
897
898 adbord(); /* draw the border */
899 awins(); /* fill in the windows */
900
901 SetPri(ASGOBJ, ASGPRI); /* enable screen object */
902
903 settc(0, 9); /* display text cursor */
904
905 vsndpal(asgpal); /* set the palette */
906}
907
Note: See TracBrowser for help on using the repository browser.