source: buchla-68k/ram/asgdsp.c@ 39a696b

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

Added include files for global functions and variables.

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