source: buchla-68k/ram/adfield.c@ 0580615

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

Point of no return.

  • Property mode set to 100644
File size: 12.9 KB
Line 
1/*
2 =============================================================================
3 adfield.c -- assignment display field processing and cursor motion
4 Version 24 -- 1989-11-15 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "stddefs.h"
9#include "fields.h"
10#include "vsdd.h"
11#include "graphdef.h"
12#include "charset.h"
13#include "hwdefs.h"
14#include "curpak.h"
15
16#include "midas.h"
17#include "asgdsp.h"
18
19extern void select(void);
20extern short whatbox(void);
21extern short nokey(void);
22extern short stdctp4(void);
23extern void cxkstd(void);
24extern void cykstd(void);
25extern void stdmkey(void);
26extern void stddkey(void);
27
28extern short et_null(void);
29extern short ef_null(void);
30extern short rd_null(void);
31extern short nd_null(void);
32extern short et_atab(short n);
33extern short ef_atab(short n);
34extern short rd_atab(short nn);
35extern short nd_atab(short nn, short k);
36extern short et_aopt(short n);
37extern short ef_aopt(short n);
38extern short rd_aopt(short nn);
39extern short nd_aopt(short nn, short k);
40extern short et_avgr(short nn);
41extern short ef_avgr(short nn);
42extern short rd_avgr(short nn);
43extern short nd_avgr(short nn, short k);
44extern short et_accn(short n);
45extern short ef_accn(short n);
46extern short rd_accn(short nn);
47extern short nd_accn(short nn, short k);
48extern short et_agpt(short n);
49extern short ef_agpt(short n);
50extern short rd_agpt(short nn);
51extern short nd_agpt(short nn, short k);
52extern short et_agch(short n);
53extern short ef_agch(short n);
54extern short rd_agch(short nn);
55extern short nd_agch(short nn, short k);
56extern short et_ains(short n);
57extern short ef_ains(short n);
58extern short rd_ains(short nn);
59extern short nd_ains(short nn, short k);
60extern short et_adyn(short n);
61extern short ef_adyn(short n);
62extern short rd_adyn(short nn);
63extern short nd_adyn(short nn, short k);
64extern short et_atun(short n);
65extern short ef_atun(short n);
66extern short rd_atun(short nn);
67extern short nd_atun(short nn, short k);
68extern short et_aprg(short n);
69extern short ef_aprg(short n);
70extern short rd_aprg(short nn);
71extern short nd_aprg(short nn, short k);
72extern short et_aint(short n);
73extern short ef_aint(short n);
74extern short rd_aint(short nn);
75extern short nd_aint(short nn, short k);
76extern short et_arat(short n);
77extern short ef_arat(short n);
78extern short rd_arat(short nn);
79extern short nd_arat(short nn, short k);
80extern short et_adep(short n);
81extern short ef_adep(short n);
82extern short rd_adep(short nn);
83extern short nd_adep(short nn, short k);
84
85extern void vcputsv(int *obase, int nw, int fg, int bg, int row, int col, char *str, int pitch);
86
87extern char *memset(char *sp, char c, int n);
88
89extern short adnamsw;
90extern short asgmod;
91extern short astat;
92extern short cmtype;
93extern short cmfirst;
94extern short curasg;
95extern short curhold;
96extern short curmop;
97extern short curslim;
98extern short cxval;
99extern short cyval;
100extern short cxrate;
101extern short cyrate;
102extern short hcwval;
103extern short hitbox;
104extern short hitcx;
105extern short hitcy;
106extern short stccol;
107extern short stcrow;
108extern short thcwval;
109extern short tvcwval;
110extern short vcwval;
111extern short vtccol;
112extern short vtcrow;
113extern short vtwcol;
114extern short vtwrow;
115extern short vtxval;
116extern short vtyval;
117
118extern short crate1[];
119
120extern unsigned *asgob;
121
122extern struct asgent asgtab[];
123
124extern struct selbox adboxes[];
125extern struct selbox *csbp;
126
127extern short grp2prt[12][2];
128extern short key2grp[];
129extern short mctlnum[];
130extern short vce2grp[];
131
132/* forward references */
133
134void adcxupd(void);
135void adcyupd(void);
136short ad_xkey(short nn);
137
138/*
139
140*/
141
142struct fet ad_fet1[] = { /* field definitions */
143
144 { 0, 9, 10, 0x0000, et_atab, ef_atab, rd_atab, nd_atab},
145
146 { 1, 1, 10, 0x0000, et_null, ef_null, rd_null, nd_null},
147
148 { 4, 10, 10, 0x0002, et_aopt, ef_aopt, rd_aopt, nd_aopt},
149
150 { 3, 9, 10, 0x0003, et_aprg, ef_aprg, rd_aprg, nd_aprg},
151
152 { 4, 15, 16, 0x0004, et_avgr, ef_avgr, rd_avgr, nd_avgr},
153 { 5, 15, 16, 0x0104, et_avgr, ef_avgr, rd_avgr, nd_avgr},
154 { 6, 15, 16, 0x0204, et_avgr, ef_avgr, rd_avgr, nd_avgr},
155 { 7, 15, 16, 0x0304, et_avgr, ef_avgr, rd_avgr, nd_avgr},
156 { 8, 15, 16, 0x0404, et_avgr, ef_avgr, rd_avgr, nd_avgr},
157 { 9, 15, 16, 0x0504, et_avgr, ef_avgr, rd_avgr, nd_avgr},
158 { 4, 21, 22, 0x0604, et_avgr, ef_avgr, rd_avgr, nd_avgr},
159 { 5, 21, 22, 0x0704, et_avgr, ef_avgr, rd_avgr, nd_avgr},
160 { 6, 21, 22, 0x0804, et_avgr, ef_avgr, rd_avgr, nd_avgr},
161 { 7, 21, 22, 0x0904, et_avgr, ef_avgr, rd_avgr, nd_avgr},
162 { 8, 21, 22, 0x0A04, et_avgr, ef_avgr, rd_avgr, nd_avgr},
163 { 9, 21, 22, 0x0B04, et_avgr, ef_avgr, rd_avgr, nd_avgr},
164
165 { 5, 35, 36, 0x0005, et_accn, ef_accn, rd_accn, nd_accn},
166 { 6, 35, 36, 0x0105, et_accn, ef_accn, rd_accn, nd_accn},
167 { 7, 35, 36, 0x0205, et_accn, ef_accn, rd_accn, nd_accn},
168 { 8, 35, 36, 0x0305, et_accn, ef_accn, rd_accn, nd_accn},
169
170 { 4, 46, 46, 0x0006, et_agpt, ef_agpt, rd_agpt, nd_agpt},
171 { 5, 46, 46, 0x0106, et_agpt, ef_agpt, rd_agpt, nd_agpt},
172 { 6, 46, 46, 0x0206, et_agpt, ef_agpt, rd_agpt, nd_agpt},
173 { 7, 46, 46, 0x0306, et_agpt, ef_agpt, rd_agpt, nd_agpt},
174 { 8, 46, 46, 0x0406, et_agpt, ef_agpt, rd_agpt, nd_agpt},
175 { 9, 46, 46, 0x0506, et_agpt, ef_agpt, rd_agpt, nd_agpt},
176 { 4, 59, 59, 0x0606, et_agpt, ef_agpt, rd_agpt, nd_agpt},
177 { 5, 59, 59, 0x0706, et_agpt, ef_agpt, rd_agpt, nd_agpt},
178 { 6, 59, 59, 0x0806, et_agpt, ef_agpt, rd_agpt, nd_agpt},
179 { 7, 59, 59, 0x0906, et_agpt, ef_agpt, rd_agpt, nd_agpt},
180 { 8, 59, 59, 0x0A06, et_agpt, ef_agpt, rd_agpt, nd_agpt},
181 { 9, 59, 59, 0x0B06, et_agpt, ef_agpt, rd_agpt, nd_agpt},
182
183 { 4, 48, 49, 0x0006, et_agch, ef_agch, rd_agch, nd_agch},
184 { 5, 48, 49, 0x0106, et_agch, ef_agch, rd_agch, nd_agch},
185 { 6, 48, 49, 0x0206, et_agch, ef_agch, rd_agch, nd_agch},
186 { 7, 48, 49, 0x0306, et_agch, ef_agch, rd_agch, nd_agch},
187 { 8, 48, 49, 0x0406, et_agch, ef_agch, rd_agch, nd_agch},
188 { 9, 48, 49, 0x0506, et_agch, ef_agch, rd_agch, nd_agch},
189 { 4, 61, 62, 0x0606, et_agch, ef_agch, rd_agch, nd_agch},
190 { 5, 61, 62, 0x0706, et_agch, ef_agch, rd_agch, nd_agch},
191 { 6, 61, 62, 0x0806, et_agch, ef_agch, rd_agch, nd_agch},
192 { 7, 61, 62, 0x0906, et_agch, ef_agch, rd_agch, nd_agch},
193 { 8, 61, 62, 0x0A06, et_agch, ef_agch, rd_agch, nd_agch},
194 { 9, 61, 62, 0x0B06, et_agch, ef_agch, rd_agch, nd_agch},
195
196 { 4, 41, 42, 0x0006, et_ains, ef_ains, rd_ains, nd_ains},
197 { 5, 41, 42, 0x0106, et_ains, ef_ains, rd_ains, nd_ains},
198 { 6, 41, 42, 0x0206, et_ains, ef_ains, rd_ains, nd_ains},
199 { 7, 41, 42, 0x0306, et_ains, ef_ains, rd_ains, nd_ains},
200 { 8, 41, 42, 0x0406, et_ains, ef_ains, rd_ains, nd_ains},
201 { 9, 41, 42, 0x0506, et_ains, ef_ains, rd_ains, nd_ains},
202 { 4, 54, 55, 0x0606, et_ains, ef_ains, rd_ains, nd_ains},
203 { 5, 54, 55, 0x0706, et_ains, ef_ains, rd_ains, nd_ains},
204 { 6, 54, 55, 0x0806, et_ains, ef_ains, rd_ains, nd_ains},
205 { 7, 54, 55, 0x0906, et_ains, ef_ains, rd_ains, nd_ains},
206 { 8, 54, 55, 0x0A06, et_ains, ef_ains, rd_ains, nd_ains},
207 { 9, 54, 55, 0x0B06, et_ains, ef_ains, rd_ains, nd_ains},
208
209 { 4, 44, 44, 0x0006, et_adyn, ef_adyn, rd_adyn, nd_adyn},
210 { 5, 44, 44, 0x0106, et_adyn, ef_adyn, rd_adyn, nd_adyn},
211 { 6, 44, 44, 0x0206, et_adyn, ef_adyn, rd_adyn, nd_adyn},
212 { 7, 44, 44, 0x0306, et_adyn, ef_adyn, rd_adyn, nd_adyn},
213 { 8, 44, 44, 0x0406, et_adyn, ef_adyn, rd_adyn, nd_adyn},
214 { 9, 44, 44, 0x0506, et_adyn, ef_adyn, rd_adyn, nd_adyn},
215 { 4, 57, 57, 0x0606, et_adyn, ef_adyn, rd_adyn, nd_adyn},
216 { 5, 57, 57, 0x0706, et_adyn, ef_adyn, rd_adyn, nd_adyn},
217 { 6, 57, 57, 0x0806, et_adyn, ef_adyn, rd_adyn, nd_adyn},
218 { 7, 57, 57, 0x0906, et_adyn, ef_adyn, rd_adyn, nd_adyn},
219 { 8, 57, 57, 0x0A06, et_adyn, ef_adyn, rd_adyn, nd_adyn},
220 { 9, 57, 57, 0x0B06, et_adyn, ef_adyn, rd_adyn, nd_adyn},
221
222 { 5, 10, 10, 0x0009, et_atun, ef_atun, rd_atun, nd_atun},
223
224 { 7, 9, 10, 0x000A, et_aint, ef_aint, rd_aint, nd_aint},
225 { 8, 9, 10, 0x000A, et_arat, ef_arat, rd_arat, nd_arat},
226 { 9, 9, 10, 0x000A, et_adep, ef_adep, rd_adep, nd_adep},
227
228 { 0, 0, 0, 0x0000, FN_NULL, FN_NULL, FN_NULL, FN_NULL}
229};
230
231/*
232
233*/
234
235short adbox[][8] = { /* display box parameters */
236
237 { 1, 1, 94, 27, ACFBX00, ACBBX00, 0, 1}, /* 0 */
238 { 1, 28, 94, 40, ACFBX01, ACBBX01, 2, 1}, /* 1 */
239 { 1, 56, 94, 68, ACFBX02, ACBBX02, 4, 1}, /* 2 */
240 { 1, 42, 94, 54, ACFBX03, ACBBX03, 3, 1}, /* 3 */
241 { 96, 1, 190, 138, ACFBX04, ACBBX04, 0, 13}, /* 4 */
242 {192, 1, 302, 138, ACFBX05, ACBBX05, 0, 25}, /* 5 */
243 {304, 1, 510, 138, ACFBX06, ACBBX06, 0, 39}, /* 6 */
244 { 1, 140, 510, 348, ACFBX07, ACBBX07, 10, 1}, /* 7 */
245 { 1, 70, 38, 82, ACFBX08, ACBBX08, 5, 1}, /* 8 */
246 { 40, 70, 94, 82, ACFBX09, ACBBX09, 5, 6}, /* 9 */
247 { 1, 84, 94, 138, ACFBX10, ACBBX10, 6, 1} /* 10 */
248};
249
250char *adbxlb[] = { /* display box labels */
251
252 "Asgnmnt", /* 0 */
253 "Stor/Fetch", /* 1 */
254 "MIDI out", /* 2 */
255 "PrgChng", /* 3 */
256 "Assignment", /* 4 */
257 "Assignmnt of" , /* 5 */
258 "Assignmnt of Instruments,", /* 6 */
259 "G Assignment of Keys to Groups for MIDI Port 1 G", /* 7 */
260 "", /* 8 */
261 "Tun", /* 9 */
262 "PhaseShift" /* 10 */
263};
264
265/*
266
267*/
268
269struct curpak ad_flds = {
270
271 stdctp4, /* curtype */
272 nokey, /* premove */
273 nokey, /* pstmove */
274 cxkstd, /* cx_key */
275 cykstd, /* cy_key */
276 adcxupd, /* cx_upd */
277 adcyupd, /* cy_upd */
278 nokey, /* xy_up */
279 nokey, /* xy_dn */
280 ad_xkey, /* x_key */
281 select, /* e_key */
282 stdmkey, /* m_key */
283 stddkey, /* d_key */
284 nokey, /* not_fld */
285 ad_fet1, /* curfet */
286 adboxes, /* csbp */
287 crate1, /* cratex */
288 crate1, /* cratey */
289 CT_GRAF, /* cmtype */
290 CTOX(0), /* cxval */
291 RTOY(9) /* cyval */
292};
293
294/*
295
296*/
297
298/*
299 =============================================================================
300 adcyupd() -- update cursor y location
301 =============================================================================
302*/
303
304void adcyupd(void)
305{
306 if (adnamsw) {
307
308 vtcrow = YTOR(vtyval += cyrate);
309
310 if (vtcrow > (vtwrow + 2))
311 vtyval = RTOY(vtcrow = vtwrow + 2);
312 else if (vtcrow < vtwrow)
313 vtyval = RTOY(vtcrow = vtwrow);
314
315 } else {
316
317 cyval += cyrate;
318
319 if (cyval GT (CYMAX - 1))
320 cyval = CYMAX - 1;
321 else if (cyval LT 1)
322 cyval = 1;
323 }
324}
325
326/*
327 =============================================================================
328 adcxupd() -- update cursor x location
329 =============================================================================
330*/
331
332void adcxupd(void)
333{
334 if (adnamsw) {
335
336 vtccol = XTOC(vtxval += cxrate);
337
338 if (vtccol > (vtwcol + 29))
339 vtxval = CTOX(vtccol = vtwcol + 29);
340 else if (vtccol < vtwcol)
341 vtxval = CTOX(vtccol = vtwcol);
342
343 } else {
344
345 cxval += cxrate;
346
347 if (cxval GT (CXMAX - 1))
348 cxval = CXMAX - 1;
349 else if (cxval LT 1)
350 cxval = 1;
351 }
352}
353
354/*
355
356*/
357
358/*
359 =============================================================================
360 ad_xkey() -- process the X key
361 =============================================================================
362*/
363
364short ad_xkey(short nn)
365{
366 register short row, col, grp, i;
367
368 if (astat) {
369
370 if (whatbox()) {
371
372 row = hitcy / 14;
373 col = hitcx >> 3;
374
375 switch (hitbox) {
376
377 case 0: /* name */
378
379 if (row EQ 1) {
380
381 memset(asgtab[curasg].a_name, ' ', 16);
382 asgmod = TRUE;
383 adswin(0);
384 return(SUCCESS);
385
386 } else
387 return(FAILURE);
388 case 2: /* MIDI output port */
389
390 if ((col GE 1) AND (col LE 10)) {
391
392 curmop = 0;
393 adswin(hitbox);
394 modasg();
395 return(SUCCESS);
396 }
397
398 break;
399/*
400
401*/
402 case 4: /* voice to group */
403
404 if (row LT 4)
405 break;
406
407 if ((col GE 13) AND (col LE 16)) {
408
409 grp = row - 4;
410 vce2grp[grp] = -1;
411 adswin(hitbox);
412 modasg();
413 return(SUCCESS);
414
415 } else if ((col GE 19) AND (col LE 22)) {
416
417 grp = row + 2;
418 vce2grp[grp] = -1;
419 adswin(hitbox);
420 modasg();
421 return(SUCCESS);
422 }
423
424 break;
425
426 case 5: /* controller number */
427
428 if ((row LT 5) OR (row GT 8))
429 break;
430
431 if ((col EQ 35) OR (col EQ 36)) {
432
433 mctlnum[row - 5] = -1;
434 adswin(hitbox);
435 modasg();
436 return(SUCCESS);
437 }
438
439 break;
440/*
441
442*/
443 case 6: /* port or channel */
444
445 if (row LT 4)
446 break;
447
448 if (col EQ 46 ) {
449
450 /* port */
451
452 grp = row - 4;
453 grp2prt[grp][0] = 0;
454
455 for (i = 0; i < 88; i++)
456 key2grp[i] &= ~(0x0001 << grp);
457
458 adswin(hitbox);
459 drawk2g(grp);
460 modasg();
461 return(SUCCESS);
462
463 } else if ((col EQ 48) OR (col EQ 49)) {
464
465 /* channel */
466
467 grp = row - 4;
468 grp2prt[grp][1] = -1;
469 adswin(hitbox);
470 modasg();
471 return(SUCCESS);
472/*
473
474*/
475 } else if (col EQ 59) {
476
477 /* port */
478
479 grp = row + 2;
480 grp2prt[grp][0] = 0;
481
482 for (i = 0; i < 88; i++)
483 key2grp[i] &= ~(0x0001 << grp);
484
485 adswin(hitbox);
486 drawk2g(grp);
487 modasg();
488 return(SUCCESS);
489
490 } else if ((col EQ 61) OR (col EQ 62)) {
491
492 /* channel */
493
494 grp = row + 2;
495 grp2prt[grp][1] = -1;
496 adswin(hitbox);
497 modasg();
498 return(SUCCESS);
499 }
500
501 break;
502 }
503 }
504 }
505
506 return(FAILURE);
507}
508
509/*
510
511*/
512
513/*
514 =============================================================================
515 adfield() -- setup field routines for the assignment editor
516 =============================================================================
517*/
518
519void adfield(void)
520{
521 curslim = 140;
522
523 curset(&ad_flds);
524}
Note: See TracBrowser for help on using the repository browser.