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

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

Zero redundant declarations.

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