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

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

Point of no return.

  • Property mode set to 100644
File size: 10.0 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(unsigned fputime);
22extern unsigned tofpu(unsigned time);
23
24extern unsigned *obj8;
25extern unsigned curintp;
26
27extern short ctrsw;
28extern short curasg;
29extern short curtun;
30extern short tmpoval;
31extern short recsw;
32extern short stccol;
33
34extern char dspbuf[];
35
36extern 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
54short et_ioas(short 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
71short ef_ioas(short n)
72{
73 register short 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
119short rd_ioas(short 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
136short nd_ioas(short n, short k)
137{
138 register short 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
167short et_tune(short 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
185short ef_tune(short n)
186{
187 register short 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
227short rd_tune(short 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
243short nd_tune(short n, short k)
244{
245 register short 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
273short et_tmpo(short 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
291short ef_tmpo(short n)
292{
293 register short 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
339short rd_tmpo(short 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
357short nd_tmpo(short n, short k)
358{
359 register short 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
389short et_intp(short n)
390{
391 register short th, tl;
392 register long 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
412short ef_intp(short n)
413{
414 register short i;
415 register unsigned 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 > (unsigned)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
470short rd_intp(short n)
471{
472 register short th, tl;
473 register long 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
496short nd_intp(short n, short k)
497{
498 register short 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}
Note: See TracBrowser for help on using the repository browser.