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

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

Make function pointers more consistent.

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