source: buchla-68k/ram/tdfield.c@ e225e77

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

Added missing includes and declarations.

  • Property mode set to 100644
File size: 11.6 KB
Line 
1/*
2 =============================================================================
3 tdfield.c -- MIDAS-VII tuning display field processing and cursor motion
4 Version 18 -- 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 "tundsp.h"
18
19extern void select(void);
20extern int16_t whatbox(void);
21extern void nokey(void);
22extern int16_t nonf(int16_t k);
23extern int16_t stdctp0(void);
24extern void cxkstd(void);
25extern void cykstd(void);
26extern void stdmkey(void);
27extern void stddkey(int16_t k);
28
29extern int16_t et_null(int16_t n);
30extern int16_t ef_null(int16_t n);
31extern int16_t rd_null(int16_t n);
32extern int16_t nd_null(int16_t n, int16_t k);
33extern int16_t et_ttab(int16_t n);
34extern int16_t ef_ttab(int16_t n);
35extern int16_t rd_ttab(int16_t nn);
36extern int16_t nd_ttab(int16_t nn, int16_t k);
37extern int16_t et_tval(int16_t n);
38extern int16_t ef_tval(int16_t n);
39extern int16_t rd_tval(int16_t nn);
40extern int16_t nd_tval(int16_t nn, int16_t k);
41extern int16_t et_tpch(int16_t nn);
42extern int16_t ef_tpch(int16_t nn);
43extern int16_t rd_tpch(int16_t nn);
44extern int16_t nd_tpch(int16_t nn, int16_t k);
45
46extern void *memset(void *vp, int8_t c, int16_t n);
47
48extern int16_t cxval, cyval, cxrate, cyrate;
49extern int16_t stcrow, stccol, submenu, vtcrow, vtccol, vtwrow, vtwcol;
50extern int16_t vtxval, vtyval;
51
52extern int16_t crate1[];
53
54extern struct selbox *csbp;
55extern struct selbox tdboxes[];
56
57extern int16_t tunmod, tdnamsw;
58
59/* forward references */
60
61void tdcxupd(void);
62void tdcyupd(void);
63
64extern void curset(struct curpak *s);
65
66/*
67
68*/
69
70struct fet td_fet1[] = { /* field definitions */
71
72 { 0, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
73 { 1, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
74 { 2, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
75 { 3, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
76 { 4, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
77 { 5, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
78 { 6, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
79 { 7, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
80 { 8, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
81 { 9, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
82 {10, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
83 {11, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
84 {12, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
85 {13, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
86 {14, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
87 {15, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
88 {16, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
89 {17, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
90 {18, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
91 {19, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
92 {20, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
93 {21, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
94 {22, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
95 {23, 6, 10, 0, et_tpch, ef_tpch, rd_tpch, nd_tpch},
96
97 { 0, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
98 { 1, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
99 { 2, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
100 { 3, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
101 { 4, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
102 { 5, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
103 { 6, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
104 { 7, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
105 { 8, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
106 { 9, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
107 {10, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
108 {11, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
109 {12, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
110 {13, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
111 {14, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
112 {15, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
113 {16, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
114 {17, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
115 {18, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
116 {19, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
117 {20, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
118 {21, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
119 {22, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
120 {23, 16, 20, 1, et_tpch, ef_tpch, rd_tpch, nd_tpch},
121/*
122
123*/
124 { 0, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
125 { 1, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
126 { 2, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
127 { 3, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
128 { 4, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
129 { 5, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
130 { 6, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
131 { 7, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
132 { 8, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
133 { 9, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
134 {10, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
135 {11, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
136 {12, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
137 {13, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
138 {14, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
139 {15, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
140 {16, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
141 {17, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
142 {18, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
143 {19, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
144 {20, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
145 {21, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
146 {22, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
147 {23, 26, 30, 2, et_tpch, ef_tpch, rd_tpch, nd_tpch},
148
149 { 0, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
150 { 1, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
151 { 2, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
152 { 3, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
153 { 4, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
154 { 5, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
155 { 6, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
156 { 7, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
157 { 8, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
158 { 9, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
159 {10, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
160 {11, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
161 {12, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
162 {13, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
163 {14, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
164 {15, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
165 {16, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
166 {17, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
167 {18, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
168 {19, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
169 {20, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
170 {21, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
171 {22, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
172 {23, 36, 40, 3, et_tpch, ef_tpch, rd_tpch, nd_tpch},
173/*
174
175*/
176 { 0, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
177 { 1, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
178 { 2, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
179 { 3, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
180 { 4, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
181 { 5, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
182 { 6, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
183 { 7, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
184 { 8, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
185 { 9, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
186 {10, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
187 {11, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
188 {12, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
189 {13, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
190 {14, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
191 {15, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
192 {16, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
193 {17, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
194 {18, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
195 {19, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
196 {20, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
197 {21, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
198 {22, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
199 {23, 47, 51, 4, et_tpch, ef_tpch, rd_tpch, nd_tpch},
200
201 { 0, 58, 62, 5, et_tpch, ef_tpch, rd_tpch, nd_tpch},
202 { 1, 58, 62, 5, et_tpch, ef_tpch, rd_tpch, nd_tpch},
203 { 2, 58, 62, 5, et_tpch, ef_tpch, rd_tpch, nd_tpch},
204 { 3, 58, 62, 5, et_tpch, ef_tpch, rd_tpch, nd_tpch},
205 { 4, 58, 62, 5, et_tpch, ef_tpch, rd_tpch, nd_tpch},
206 { 5, 58, 62, 5, et_tpch, ef_tpch, rd_tpch, nd_tpch},
207 { 6, 58, 62, 5, et_tpch, ef_tpch, rd_tpch, nd_tpch},
208 { 7, 58, 62, 5, et_tpch, ef_tpch, rd_tpch, nd_tpch},
209
210 {18, 58, 62, 6, et_tval, ef_tval, rd_tval, nd_tval},
211
212 {24, 7, 38, 7, et_null, ef_null, rd_null, nd_null},
213 {24, 61, 61, 6, et_ttab, ef_ttab, rd_ttab, nd_ttab},
214
215 { 0, 0, 0, 0x0000, FN_NULL, FN_NULL, FN_NULL, FN_NULL}
216};
217
218/*
219
220*/
221
222int16_t tdbox[][8] = { /* display box parameters */
223
224 { 0, 0, 95, 335, TCFBX00, TCBBX00, 0, 1}, /* 0 */
225 { 96, 0, 175, 335, TCFBX01, TCBBX01, 0, 13}, /* 1 */
226 {176, 0, 255, 335, TCFBX02, TCBBX02, 0, 23}, /* 2 */
227 {256, 0, 335, 335, TCFBX03, TCBBX03, 0, 33}, /* 3 */
228 {336, 0, 423, 335, TCFBX04, TCBBX04, 0, 43}, /* 4 */
229 {424, 0, 511, 118, TCFBX05, TCBBX05, 0, 54}, /* 5 */
230 {424, 119, 511, 349, TCFBX06, TCBBX06, 9, 54}, /* 6 */
231 { 0, 336, 423, 349, TCFBX07, TCBBX07, 24, 1} /* 7 */
232};
233
234int8_t *tdbxlb[] = { /* display box labels */
235
236 "", /* 0 */
237 "", /* 1 */
238 "", /* 2 */
239 "", /* 3 */
240 "", /* 4 */
241 "", /* 5 */
242 "", /* 6 */
243 "Name:" /* 7 */
244};
245
246/*
247
248*/
249
250struct curpak td_flds = {
251
252 stdctp0, /* curtype */
253 nokey, /* premove */
254 nokey, /* pstmove */
255 cxkstd, /* cx_key */
256 cykstd, /* cy_key */
257 tdcxupd, /* cx_upd */
258 tdcyupd, /* cy_upd */
259 nokey, /* xy_up */
260 nokey, /* xy_dn */
261 nokey, /* x_key */
262 select, /* e_key */
263 stdmkey, /* m_key */
264 stddkey, /* d_key */
265 nonf, /* not_fld */
266 td_fet1, /* curfet */
267 tdboxes, /* csbp */
268 crate1, /* cratex */
269 crate1, /* cratey */
270 CT_TEXT, /* cmtype */
271 TDCURX, /* cxval */
272 TDCURY /* cyval */
273};
274
275/*
276
277*/
278
279/*
280 =============================================================================
281 tdcyupd() -- update cursor y location
282 =============================================================================
283*/
284
285void tdcyupd(void)
286{
287 register int16_t pval, vh, vl;
288
289 if (tdnamsw) { /* see if we're in the menu area */
290
291 vtcrow = YTOR(vtyval += cyrate);
292
293 if (vtcrow > (vtwrow + 2))
294 vtyval = RTOY(vtcrow = vtwrow + 2);
295 else if (vtcrow < vtwrow)
296 vtyval = RTOY(vtcrow = vtwrow);
297
298 } else { /* just moving the cursor */
299
300 cyval += cyrate;
301
302 if (cyval GT (CYMAX - 1))
303 cyval = CYMAX - 1;
304 else if (cyval LT 1)
305 cyval = 1;
306 }
307}
308
309/*
310
311*/
312
313/*
314 =============================================================================
315 tdcxupd() -- update cursor x location
316 =============================================================================
317*/
318
319void tdcxupd(void)
320{
321
322 if (tdnamsw) { /* see if we're in the menu area */
323
324 vtccol = XTOC(vtxval += cxrate);
325
326 if (vtccol > (vtwcol + 29))
327 vtxval = CTOX(vtccol = vtwcol + 29);
328 else if (vtccol < vtwcol)
329 vtxval = CTOX(vtccol = vtwcol);
330
331 } else { /* just moving the cursor */
332
333 cxval += cxrate;
334
335 if (cxval GT (CXMAX- 1))
336 cxval = CXMAX - 1;
337 else if (cxval LT 1)
338 cxval = 1;
339 }
340}
341
342/*
343
344*/
345
346/*
347 =============================================================================
348 tdfield() -- setup field routines for the tuning editor
349 =============================================================================
350*/
351
352void tdfield(void)
353{
354 tdnamsw = FALSE;
355 submenu = FALSE;
356
357 curset(&td_flds);
358}
Note: See TracBrowser for help on using the repository browser.