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

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

Code compiles, doesn't link.

  • Property mode set to 100644
File size: 11.7 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
254short
255adcyupd()
256{
257 if (adnamsw) {
258
259 vtcrow = YTOR(vtyval += cyrate);
260
261 if (vtcrow > (vtwrow + 2))
262 vtyval = RTOY(vtcrow = vtwrow + 2);
263 else if (vtcrow < vtwrow)
264 vtyval = RTOY(vtcrow = vtwrow);
265
266 } else {
267
268 cyval += cyrate;
269
270 if (cyval GT (CYMAX - 1))
271 cyval = CYMAX - 1;
272 else if (cyval LT 1)
273 cyval = 1;
274 }
275}
276
277/*
278 =============================================================================
279 adcxupd() -- update cursor x location
280 =============================================================================
281*/
282
283short
284adcxupd()
285{
286 if (adnamsw) {
287
288 vtccol = XTOC(vtxval += cxrate);
289
290 if (vtccol > (vtwcol + 29))
291 vtxval = CTOX(vtccol = vtwcol + 29);
292 else if (vtccol < vtwcol)
293 vtxval = CTOX(vtccol = vtwcol);
294
295 } else {
296
297 cxval += cxrate;
298
299 if (cxval GT (CXMAX - 1))
300 cxval = CXMAX - 1;
301 else if (cxval LT 1)
302 cxval = 1;
303 }
304}
305
306/*
307
308*/
309
310/*
311 =============================================================================
312 ad_xkey() -- process the X key
313 =============================================================================
314*/
315
316short
317ad_xkey(nn)
318short nn;
319{
320 register short row, col, grp, i;
321
322 if (astat) {
323
324 if (whatbox()) {
325
326 row = hitcy / 14;
327 col = hitcx >> 3;
328
329 switch (hitbox) {
330
331 case 0: /* name */
332
333 if (row EQ 1) {
334
335 memset(asgtab[curasg].a_name, ' ', 16);
336 asgmod = TRUE;
337 adswin(0);
338 return(SUCCESS);
339
340 } else
341 return(FAILURE);
342 case 2: /* MIDI output port */
343
344 if ((col GE 1) AND (col LE 10)) {
345
346 curmop = 0;
347 adswin(hitbox);
348 modasg();
349 return(SUCCESS);
350 }
351
352 break;
353/*
354
355*/
356 case 4: /* voice to group */
357
358 if (row LT 4)
359 break;
360
361 if ((col GE 13) AND (col LE 16)) {
362
363 grp = row - 4;
364 vce2grp[grp] = -1;
365 adswin(hitbox);
366 modasg();
367 return(SUCCESS);
368
369 } else if ((col GE 19) AND (col LE 22)) {
370
371 grp = row + 2;
372 vce2grp[grp] = -1;
373 adswin(hitbox);
374 modasg();
375 return(SUCCESS);
376 }
377
378 break;
379
380 case 5: /* controller number */
381
382 if ((row LT 5) OR (row GT 8))
383 break;
384
385 if ((col EQ 35) OR (col EQ 36)) {
386
387 mctlnum[row - 5] = -1;
388 adswin(hitbox);
389 modasg();
390 return(SUCCESS);
391 }
392
393 break;
394/*
395
396*/
397 case 6: /* port or channel */
398
399 if (row LT 4)
400 break;
401
402 if (col EQ 46 ) {
403
404 /* port */
405
406 grp = row - 4;
407 grp2prt[grp][0] = 0;
408
409 for (i = 0; i < 88; i++)
410 key2grp[i] &= ~(0x0001 << grp);
411
412 adswin(hitbox);
413 drawk2g(grp);
414 modasg();
415 return(SUCCESS);
416
417 } else if ((col EQ 48) OR (col EQ 49)) {
418
419 /* channel */
420
421 grp = row - 4;
422 grp2prt[grp][1] = -1;
423 adswin(hitbox);
424 modasg();
425 return(SUCCESS);
426/*
427
428*/
429 } else if (col EQ 59) {
430
431 /* port */
432
433 grp = row + 2;
434 grp2prt[grp][0] = 0;
435
436 for (i = 0; i < 88; i++)
437 key2grp[i] &= ~(0x0001 << grp);
438
439 adswin(hitbox);
440 drawk2g(grp);
441 modasg();
442 return(SUCCESS);
443
444 } else if ((col EQ 61) OR (col EQ 62)) {
445
446 /* channel */
447
448 grp = row + 2;
449 grp2prt[grp][1] = -1;
450 adswin(hitbox);
451 modasg();
452 return(SUCCESS);
453 }
454
455 break;
456 }
457 }
458 }
459
460 return(FAILURE);
461}
462
463/*
464
465*/
466
467/*
468 =============================================================================
469 adfield() -- setup field routines for the assignment editor
470 =============================================================================
471*/
472
473adfield()
474{
475 curslim = 140;
476
477 curset(&ad_flds);
478}
Note: See TracBrowser for help on using the repository browser.