source: buchla-68k/orig/RAM/ADFIELD.C@ c79db87

Last change on this file since c79db87 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

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