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

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

Removed form-feed comments.

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