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

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

Added RAM files.

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