source: buchla-68k/ram/etioas.c@ 6262b5c

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

Added include files for global functions and variables.

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