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