1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etioas.c -- line 17 field handlers (I/O Assignment thru Interpolate)
|
---|
4 | Version 12 -- 1988-08-22 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "fields.h"
|
---|
9 | #include "hwdefs.h"
|
---|
10 | #include "graphdef.h"
|
---|
11 | #include "vsdd.h"
|
---|
12 | #include "vsddsw.h"
|
---|
13 | #include "stddefs.h"
|
---|
14 | #include "score.h"
|
---|
15 | #include "scfns.h"
|
---|
16 | #include "slice.h"
|
---|
17 |
|
---|
18 | #include "midas.h"
|
---|
19 | #include "scdsp.h"
|
---|
20 |
|
---|
21 | extern uint16_t fromfpu(uint16_t fputime);
|
---|
22 | extern uint16_t tofpu(uint16_t time);
|
---|
23 |
|
---|
24 | extern uint16_t *obj8;
|
---|
25 | extern uint16_t curintp;
|
---|
26 |
|
---|
27 | extern int16_t ctrsw;
|
---|
28 | extern int16_t curasg;
|
---|
29 | extern int16_t curtun;
|
---|
30 | extern int16_t tmpoval;
|
---|
31 | extern int16_t recsw;
|
---|
32 | extern int16_t stccol;
|
---|
33 |
|
---|
34 | extern int8_t dspbuf[];
|
---|
35 |
|
---|
36 | extern struct gdsel *gdstbc[];
|
---|
37 |
|
---|
38 | /* |
---|
39 |
|
---|
40 | */
|
---|
41 |
|
---|
42 | /*
|
---|
43 | =============================================================================
|
---|
44 | Assignment table field handlers
|
---|
45 | =============================================================================
|
---|
46 | */
|
---|
47 |
|
---|
48 | /*
|
---|
49 | =============================================================================
|
---|
50 | et_ioas() -- load edit buffer
|
---|
51 | =============================================================================
|
---|
52 | */
|
---|
53 |
|
---|
54 | int16_t et_ioas(int16_t n)
|
---|
55 | {
|
---|
56 | sprintf(ebuf, "%02.2d", curasg);
|
---|
57 | ebflag = TRUE;
|
---|
58 |
|
---|
59 | return(SUCCESS);
|
---|
60 | }
|
---|
61 |
|
---|
62 | /* |
---|
63 |
|
---|
64 | */
|
---|
65 | /*
|
---|
66 | =============================================================================
|
---|
67 | ef_ioas() -- parse edit buffer
|
---|
68 | =============================================================================
|
---|
69 | */
|
---|
70 |
|
---|
71 | int16_t ef_ioas(int16_t n)
|
---|
72 | {
|
---|
73 | register int16_t ival;
|
---|
74 | register struct s_entry *ep;
|
---|
75 |
|
---|
76 | ebuf[2] = '\0';
|
---|
77 | ival = ((ebuf[0] - '0') * 10) + (ebuf[1] - '0');
|
---|
78 |
|
---|
79 | ebflag = FALSE;
|
---|
80 |
|
---|
81 | if (ival GE NASGS)
|
---|
82 | return(FAILURE);
|
---|
83 |
|
---|
84 | getasg(curasg = ival);
|
---|
85 | mpcupd();
|
---|
86 |
|
---|
87 | if (recsw) {
|
---|
88 |
|
---|
89 | if (E_NULL NE (ep = findev(p_cur, t_cur, EV_ASGN, -1, -1))) {
|
---|
90 |
|
---|
91 | ep->e_data1 = ival;
|
---|
92 |
|
---|
93 | } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
|
---|
94 |
|
---|
95 | ep->e_type = EV_ASGN;
|
---|
96 | ep->e_data1 = ival;
|
---|
97 | ep->e_time = t_cur;
|
---|
98 | p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
|
---|
99 | eh_ins(ep, EH_ASGN);
|
---|
100 | ctrsw = TRUE;
|
---|
101 | se_disp(ep, D_FWD, gdstbc, 1);
|
---|
102 | scupd();
|
---|
103 | }
|
---|
104 | }
|
---|
105 |
|
---|
106 | return(SUCCESS);
|
---|
107 | }
|
---|
108 |
|
---|
109 | /* |
---|
110 |
|
---|
111 | */
|
---|
112 |
|
---|
113 | /*
|
---|
114 | =============================================================================
|
---|
115 | rd_ioas() -- (re)display the field
|
---|
116 | =============================================================================
|
---|
117 | */
|
---|
118 |
|
---|
119 | int16_t rd_ioas(int16_t n)
|
---|
120 | {
|
---|
121 | sprintf(dspbuf, "%02.2d", curasg);
|
---|
122 |
|
---|
123 | if (v_regs[5] & 0x0180)
|
---|
124 | vbank(0);
|
---|
125 |
|
---|
126 | vputs(obj8, 1, 11, dspbuf, SDW04ATR);
|
---|
127 | return(SUCCESS);
|
---|
128 | }
|
---|
129 |
|
---|
130 | /*
|
---|
131 | =============================================================================
|
---|
132 | nd_ioas() -- data entry function
|
---|
133 | =============================================================================
|
---|
134 | */
|
---|
135 |
|
---|
136 | int16_t nd_ioas(int16_t n, int16_t k)
|
---|
137 | {
|
---|
138 | register int16_t ec;
|
---|
139 |
|
---|
140 | ec = stccol - cfetp->flcol;
|
---|
141 | ebuf[ec] = k + '0';
|
---|
142 |
|
---|
143 | if (v_regs[5] & 0x0180)
|
---|
144 | vbank(0);
|
---|
145 |
|
---|
146 | vputc(obj8, 1, stccol, k + '0', SDW04DEA);
|
---|
147 | advscur();
|
---|
148 | return(SUCCESS);
|
---|
149 | }
|
---|
150 |
|
---|
151 | /* |
---|
152 |
|
---|
153 | */
|
---|
154 |
|
---|
155 | /*
|
---|
156 | =============================================================================
|
---|
157 | Tuning field handlers
|
---|
158 | =============================================================================
|
---|
159 | */
|
---|
160 |
|
---|
161 | /*
|
---|
162 | =============================================================================
|
---|
163 | et_tune() -- load edit buffer
|
---|
164 | =============================================================================
|
---|
165 | */
|
---|
166 |
|
---|
167 | int16_t et_tune(int16_t n)
|
---|
168 | {
|
---|
169 | ebuf[0] = '0' + curtun;
|
---|
170 | ebuf[1] = '\0';
|
---|
171 | ebflag = TRUE;
|
---|
172 | return(SUCCESS);
|
---|
173 | }
|
---|
174 |
|
---|
175 | /* |
---|
176 |
|
---|
177 | */
|
---|
178 |
|
---|
179 | /*
|
---|
180 | =============================================================================
|
---|
181 | ef_tune() -- parse edit buffer
|
---|
182 | =============================================================================
|
---|
183 | */
|
---|
184 |
|
---|
185 | int16_t ef_tune(int16_t n)
|
---|
186 | {
|
---|
187 | register int16_t ival;
|
---|
188 | register struct s_entry *ep;
|
---|
189 |
|
---|
190 | ebuf[1] = '\0';
|
---|
191 | ival = ebuf[0] - '0';
|
---|
192 | ebflag = FALSE;
|
---|
193 | gettun(ival);
|
---|
194 |
|
---|
195 | if (recsw) {
|
---|
196 |
|
---|
197 | if (E_NULL NE (ep = findev(p_cur, t_cur, EV_TUNE, -1, -1))) {
|
---|
198 |
|
---|
199 | ep->e_data1 = ival;
|
---|
200 |
|
---|
201 | } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
|
---|
202 |
|
---|
203 | ep->e_type = EV_TUNE;
|
---|
204 | ep->e_data1 = ival;
|
---|
205 | ep->e_time = t_cur;
|
---|
206 | p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
|
---|
207 | eh_ins(ep, EH_TUNE);
|
---|
208 | ctrsw = TRUE;
|
---|
209 | se_disp(ep, D_FWD, gdstbc, 1);
|
---|
210 | scupd();
|
---|
211 | }
|
---|
212 | }
|
---|
213 |
|
---|
214 | return(SUCCESS);
|
---|
215 | }
|
---|
216 |
|
---|
217 | /* |
---|
218 |
|
---|
219 | */
|
---|
220 |
|
---|
221 | /*
|
---|
222 | =============================================================================
|
---|
223 | rd_tune() -- (re)display the field
|
---|
224 | =============================================================================
|
---|
225 | */
|
---|
226 |
|
---|
227 | int16_t rd_tune(int16_t n)
|
---|
228 | {
|
---|
229 | if (v_regs[5] & 0x0180)
|
---|
230 | vbank(0);
|
---|
231 |
|
---|
232 | vputc(obj8, 1, 19, curtun + '0', SDW05ATR);
|
---|
233 |
|
---|
234 | return(SUCCESS);
|
---|
235 | }
|
---|
236 |
|
---|
237 | /*
|
---|
238 | =============================================================================
|
---|
239 | nd_tune() -- data entry function
|
---|
240 | =============================================================================
|
---|
241 | */
|
---|
242 |
|
---|
243 | int16_t nd_tune(int16_t n, int16_t k)
|
---|
244 | {
|
---|
245 | register int16_t ec;
|
---|
246 |
|
---|
247 | ebuf[0] = k + '0';
|
---|
248 |
|
---|
249 | if (v_regs[5] & 0x0180)
|
---|
250 | vbank(0);
|
---|
251 |
|
---|
252 | vputc(obj8, 1, stccol, k + '0', SDW05DEA);
|
---|
253 |
|
---|
254 | return(SUCCESS);
|
---|
255 | }
|
---|
256 |
|
---|
257 | /* |
---|
258 |
|
---|
259 | */
|
---|
260 |
|
---|
261 | /*
|
---|
262 | =============================================================================
|
---|
263 | Tempo field handlers
|
---|
264 | =============================================================================
|
---|
265 | */
|
---|
266 |
|
---|
267 | /*
|
---|
268 | =============================================================================
|
---|
269 | et_tmpo() -- load edit buffer
|
---|
270 | =============================================================================
|
---|
271 | */
|
---|
272 |
|
---|
273 | int16_t et_tmpo(int16_t n)
|
---|
274 | {
|
---|
275 | sprintf(ebuf, "%03.3d", tmpoval);
|
---|
276 | ebflag = TRUE;
|
---|
277 |
|
---|
278 | return(SUCCESS);
|
---|
279 | }
|
---|
280 |
|
---|
281 | /* |
---|
282 |
|
---|
283 | */
|
---|
284 |
|
---|
285 | /*
|
---|
286 | =============================================================================
|
---|
287 | ef_tmpo() -- parse edit buffer
|
---|
288 | =============================================================================
|
---|
289 | */
|
---|
290 |
|
---|
291 | int16_t ef_tmpo(int16_t n)
|
---|
292 | {
|
---|
293 | register int16_t ival;
|
---|
294 | register struct s_entry *ep;
|
---|
295 |
|
---|
296 | ebuf[3] = '\0';
|
---|
297 | ival = ((ebuf[0] - '0') * 100) + ((ebuf[1] - '0') * 10)
|
---|
298 | + (ebuf[2] - '0');
|
---|
299 |
|
---|
300 | ebflag = FALSE;
|
---|
301 |
|
---|
302 | if ((ival GT 240) OR (ival LT 4))
|
---|
303 | return(FAILURE);
|
---|
304 |
|
---|
305 | settmpo(ival);
|
---|
306 |
|
---|
307 | if (recsw) {
|
---|
308 |
|
---|
309 | if (E_NULL NE (ep = findev(p_cur, t_cur, EV_TMPO, -1, -1))) {
|
---|
310 |
|
---|
311 | ep->e_data1 = ival;
|
---|
312 |
|
---|
313 | } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
|
---|
314 |
|
---|
315 | ep->e_type = EV_TMPO;
|
---|
316 | ep->e_data1 = ival;
|
---|
317 | ep->e_time = t_cur;
|
---|
318 | p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
|
---|
319 | eh_ins(ep, EH_TMPO);
|
---|
320 | ctrsw = TRUE;
|
---|
321 | se_disp(ep, D_FWD, gdstbc, 1);
|
---|
322 | scupd();
|
---|
323 | }
|
---|
324 | }
|
---|
325 |
|
---|
326 | return(SUCCESS);
|
---|
327 | }
|
---|
328 |
|
---|
329 | /* |
---|
330 |
|
---|
331 | */
|
---|
332 |
|
---|
333 | /*
|
---|
334 | =============================================================================
|
---|
335 | rd_tmpo() -- (re)display the field
|
---|
336 | =============================================================================
|
---|
337 | */
|
---|
338 |
|
---|
339 | int16_t rd_tmpo(int16_t n)
|
---|
340 | {
|
---|
341 | sprintf(dspbuf, "%03.3d", tmpoval);
|
---|
342 |
|
---|
343 | if (v_regs[5] & 0x0180)
|
---|
344 | vbank(0);
|
---|
345 |
|
---|
346 | vputs(obj8, 1, 27, dspbuf, SDW06ATR);
|
---|
347 |
|
---|
348 | return(SUCCESS);
|
---|
349 | }
|
---|
350 |
|
---|
351 | /*
|
---|
352 | =============================================================================
|
---|
353 | nd_tmpo() -- data entry function
|
---|
354 | =============================================================================
|
---|
355 | */
|
---|
356 |
|
---|
357 | int16_t nd_tmpo(int16_t n, int16_t k)
|
---|
358 | {
|
---|
359 | register int16_t ec;
|
---|
360 |
|
---|
361 | ec = stccol - cfetp->flcol;
|
---|
362 | ebuf[ec] = k + '0';
|
---|
363 |
|
---|
364 | if (v_regs[5] & 0x0180)
|
---|
365 | vbank(0);
|
---|
366 |
|
---|
367 | vputc(obj8, 1, stccol, k + '0', SDW06DEA);
|
---|
368 | advscur();
|
---|
369 |
|
---|
370 | return(SUCCESS);
|
---|
371 | }
|
---|
372 |
|
---|
373 | /* |
---|
374 |
|
---|
375 | */
|
---|
376 |
|
---|
377 | /*
|
---|
378 | =============================================================================
|
---|
379 | Interpolate field handlers
|
---|
380 | =============================================================================
|
---|
381 | */
|
---|
382 |
|
---|
383 | /*
|
---|
384 | =============================================================================
|
---|
385 | et_intp() -- load edit buffer
|
---|
386 | =============================================================================
|
---|
387 | */
|
---|
388 |
|
---|
389 | int16_t et_intp(int16_t n)
|
---|
390 | {
|
---|
391 | register int16_t th, tl;
|
---|
392 | register int32_t tt, sc, sf;
|
---|
393 |
|
---|
394 | sc = 1000L;
|
---|
395 | sf = 100L;
|
---|
396 | tt = fromfpu(curintp);
|
---|
397 | th = tt / sc;
|
---|
398 | tl = (tt - (th * sc)) / sf;
|
---|
399 |
|
---|
400 | sprintf(ebuf, "%02d.%d", th, tl);
|
---|
401 | ebflag = TRUE;
|
---|
402 |
|
---|
403 | return(SUCCESS);
|
---|
404 | }
|
---|
405 |
|
---|
406 | /*
|
---|
407 | =============================================================================
|
---|
408 | ef_intp() -- parse edit buffer
|
---|
409 | =============================================================================
|
---|
410 | */
|
---|
411 |
|
---|
412 | int16_t ef_intp(int16_t n)
|
---|
413 | {
|
---|
414 | register int16_t i;
|
---|
415 | register uint16_t tmpval;
|
---|
416 | register struct s_entry *ep;
|
---|
417 |
|
---|
418 | ebuf[2] = '.'; /* add implied decimal point */
|
---|
419 | ebuf[4] = '\0'; /* terminate the string in ebuf */
|
---|
420 | ebflag = FALSE;
|
---|
421 | tmpval = 0;
|
---|
422 |
|
---|
423 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
424 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
425 |
|
---|
426 | tmpval = ((tmpval * 10) + (ebuf[3] - '0')) * 100;
|
---|
427 |
|
---|
428 | if (tmpval > (uint16_t)64900)
|
---|
429 | return(FAILURE);
|
---|
430 |
|
---|
431 | if (tmpval EQ 0)
|
---|
432 | tmpval = 1;
|
---|
433 |
|
---|
434 | curintp = tofpu(tmpval);
|
---|
435 |
|
---|
436 | if (recsw) {
|
---|
437 |
|
---|
438 | if (E_NULL NE (ep = findev(p_cur, t_cur, EV_INTP, -1, -1))) {
|
---|
439 |
|
---|
440 | ep->e_data1 = (curintp >> 8);
|
---|
441 | ep->e_data2 = 0x00FF & curintp;
|
---|
442 |
|
---|
443 | } else if (E_NULL NE (ep = e_alc(E_SIZE3))) {
|
---|
444 |
|
---|
445 | ep->e_type = EV_INTP;
|
---|
446 | ep->e_time = t_cur;
|
---|
447 | ep->e_data1 = (curintp >> 8);
|
---|
448 | ep->e_data2 = 0x00FF & curintp;
|
---|
449 | p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
|
---|
450 | eh_ins(ep, EH_INTP);
|
---|
451 | ctrsw = TRUE;
|
---|
452 | se_disp(ep, D_FWD, gdstbc, 1);
|
---|
453 | scupd();
|
---|
454 | }
|
---|
455 | }
|
---|
456 |
|
---|
457 | return(SUCCESS);
|
---|
458 | }
|
---|
459 |
|
---|
460 | /* |
---|
461 |
|
---|
462 | */
|
---|
463 |
|
---|
464 | /*
|
---|
465 | =============================================================================
|
---|
466 | rd_intp() -- (re)display the field
|
---|
467 | =============================================================================
|
---|
468 | */
|
---|
469 |
|
---|
470 | int16_t rd_intp(int16_t n)
|
---|
471 | {
|
---|
472 | register int16_t th, tl;
|
---|
473 | register int32_t tt, sc, sf;
|
---|
474 |
|
---|
475 | sc = 1000L;
|
---|
476 | sf = 100L;
|
---|
477 | tt = fromfpu(curintp);
|
---|
478 | th = tt / sc;
|
---|
479 | tl = (tt - (th * sc)) / sf;
|
---|
480 |
|
---|
481 | sprintf(dspbuf, "%02d.%d", th, tl); /* convert to ASCII */
|
---|
482 |
|
---|
483 | vbank(0); /* display the value */
|
---|
484 |
|
---|
485 | vputs(obj8, 1, 35, dspbuf, SDW07ATR);
|
---|
486 |
|
---|
487 | return(SUCCESS);
|
---|
488 | }
|
---|
489 |
|
---|
490 | /*
|
---|
491 | =============================================================================
|
---|
492 | nd_intp() -- data entry function
|
---|
493 | =============================================================================
|
---|
494 | */
|
---|
495 |
|
---|
496 | int16_t nd_intp(int16_t n, int16_t k)
|
---|
497 | {
|
---|
498 | register int16_t ec;
|
---|
499 |
|
---|
500 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
501 |
|
---|
502 | if (ec EQ 2)
|
---|
503 | return(FAILURE);
|
---|
504 |
|
---|
505 | if ((ec EQ 0) AND (k > 6))
|
---|
506 | return(FAILURE);
|
---|
507 |
|
---|
508 | if ((ec EQ 1) AND (ebuf[0] EQ '6') AND (k > 4))
|
---|
509 | return(FAILURE);
|
---|
510 |
|
---|
511 | ebuf[ec] = k + '0';
|
---|
512 | ebuf[2] = '.';
|
---|
513 | ebuf[4] = '\0';
|
---|
514 |
|
---|
515 | dspbuf[0] = k + '0';
|
---|
516 | dspbuf[1] = '\0';
|
---|
517 |
|
---|
518 | vbank(0);
|
---|
519 |
|
---|
520 | vputs(obj8, 1, stccol, dspbuf, SDW07DEA);
|
---|
521 |
|
---|
522 | advscur();
|
---|
523 |
|
---|
524 | if (stccol EQ 37)
|
---|
525 | advscur();
|
---|
526 |
|
---|
527 | return(SUCCESS);
|
---|
528 | }
|
---|