source: buchla-68k/orig/RAM/ETIACT.C@ 06ccda2

Last change on this file since 06ccda2 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

  • Property mode set to 100755
File size: 7.9 KB
RevLine 
[3ae31e9]1/*
2 =============================================================================
3 etiact.c -- point action field handlers
4 Version 16 -- 1988-08-31 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGIT 0
9
10#include "stddefs.h"
11#include "fields.h"
12#include "vsdd.h"
13#include "vsddsw.h"
14#include "graphdef.h"
15#include "charset.h"
16
17#include "midas.h"
18#include "instdsp.h"
19
20/* functions defined elsewhere */
21
22extern int advicur();
23
24extern char *strcpy();
25
26/* variables defined elsewhere */
27
28extern short stcrow, stccol, curvce, curpnt, curfunc;
29extern short debugsw;
30
31extern short idbox[][8];
32
33extern unsigned *instob;
34
35extern char dspbuf[];
36
37extern struct instdef vbufs[];
38
39extern short aform;
40
41/*
42
43*/
44
45/*
46 =============================================================================
47 et_iact() -- load edit buffer
48 =============================================================================
49*/
50
51short
52et_iact(nn)
53short nn;
54{
55 register struct instpnt *pp;
56
57 pp = &vbufs[curvce].idhpnt[curpnt];
58
59 aform = pp->ipact;
60
61 switch (aform) {
62
63 case AC_NULL:
64 case AC_SUST:
65 case AC_ENBL:
66 case AC_UNDF:
67
68 ebuf[0] = '\0';
69 break;
70
71 case AC_JUMP:
72 case AC_KYUP:
73 case AC_KYDN:
74
75 sprintf(ebuf, "%02d", pp->ippar1);
76 break;
77
78 case AC_LOOP:
79
80 sprintf(ebuf, "%02d %02d", pp->ippar1, pp->ippar2);
81 break;
82 }
83
84#if DEBUGIT
85 if (debugsw)
86 printf("et_iact(): aform=%d, ebuf=[%s]\r\n", aform, ebuf);
87#endif
88
89 ebflag = TRUE;
90 return(SUCCESS);
91}
92
93/*
94
95*/
96
97/*
98 =============================================================================
99 ef_iact() -- unload (parse) edit buffer
100 =============================================================================
101*/
102
103short
104ef_iact(nn)
105short nn;
106{
107 register short i, tmp1, tmp2;
108 register struct instpnt *pp;
109 register struct idfnhdr *fp;
110
111 fp = &vbufs[curvce].idhfnc[curfunc];
112 pp = &vbufs[curvce].idhpnt[curpnt];
113 ebflag = FALSE;
114
115#if DEBUGIT
116 if (debugsw)
117 printf("ef_iact(): aform=%d, fp=$%08lX, pp=$%08lX\r\n",
118 aform, fp, pp);
119#endif
120
121 switch (aform) {
122
123 case AC_NULL:
124 case AC_UNDF:
125
126 aform = AC_NULL;
127
128 case AC_SUST:
129 case AC_ENBL:
130
131 pp->ipact = aform;
132
133#if DEBUGIT
134 if (debugsw)
135 printf("ef_iact(): aform=%d, ipact=%d, ippar1=%d, ippar2=%d\r\n",
136 aform, pp->ipact, pp->ippar1, pp->ippar2);
137#endif
138
139 modinst();
140 return(SUCCESS);
141
142 case AC_JUMP:
143 case AC_KYUP:
144 case AC_KYDN:
145
146 tmp1 = 0;
147
148 for (i = 0; i < 2; i++)
149 tmp1 = (tmp1 * 10) + (ebuf[i] - '0');
150
151 if (tmp1 GE fp->idfpif)
152 return(FAILURE);
153
154 pp->ipact = aform;
155 pp->ippar1 = tmp1;
156 pp->ippar2 = 0;
157 pp->ippar3 = 0;
158
159#if DEBUGIT
160 if (debugsw)
161 printf("ef_iact(): aform=%d, ipact=%d, ippar1=%d, ippar2=%d\r\n",
162 aform, pp->ipact, pp->ippar1, pp->ippar2);
163#endif
164
165 modinst();
166 return(SUCCESS);
167/*
168
169*/
170 case AC_LOOP:
171
172 tmp1 = 0;
173
174 for (i = 0; i < 2; i++)
175 tmp1 = (tmp1 * 10) + (ebuf[i] - '0');
176
177 if (tmp1 GE fp->idfpif)
178 return(FAILURE);
179
180 tmp2 = 0;
181
182 for (i = 3; i < 5; i++)
183 tmp2 = (tmp2 * 10) + (ebuf[i] - '0');
184
185 pp->ipact = aform;
186 pp->ippar1 = tmp1;
187 pp->ippar2 = tmp2;
188 pp->ippar3 = 0;
189
190#if DEBUGIT
191 if (debugsw)
192 printf("ef_iact(): aform=%d, ipact=%d, ippar1=%d, ippar2=%d\r\n",
193 aform, pp->ipact, pp->ippar1, pp->ippar2);
194#endif
195
196 modinst();
197 return(SUCCESS);
198 }
199}
200
201/*
202
203*/
204
205/*
206 =============================================================================
207 rd_iact() -- (re)-display the field
208 =============================================================================
209*/
210
211short
212rd_iact(nn)
213short nn;
214{
215 register short pnt, par, n;
216 register struct instpnt *pp;
217 register char *s1;
218
219 n = nn & 0x00FF;
220 pp = &vbufs[curvce].idhpnt[curpnt];
221 pnt = pp->ippar1;
222 par = pp->ippar2;
223 aform = pp->ipact;
224
225#if DEBUGIT
226 if (debugsw)
227 printf("rd_iact(): aform=%d, pp=$%08lX, pnt=%d, par=%d\r\n",
228 aform, pp, pnt, par);
229#endif
230
231 switch (aform) {
232
233 case AC_NULL:
234
235 s1 = " ";
236 break;
237
238 case AC_SUST:
239
240 sprintf(dspbuf, "Pause if key %c ", SP_DNA);
241 s1 = dspbuf;
242 break;
243
244 case AC_ENBL:
245
246 sprintf(dspbuf, "Stop if key %c ", SP_UPA);
247 s1 = dspbuf;
248 break;
249
250 case AC_JUMP:
251
252 sprintf(dspbuf, "GoTo %02d forever ", pnt);
253 s1 = dspbuf;
254 break;
255
256/*
257
258*/
259 case AC_LOOP:
260
261 sprintf(dspbuf, "GoTo %02d %02d times", pnt, par);
262
263 if (dspbuf[8] EQ '9')
264 dspbuf[8] = 'R';
265
266 s1 = dspbuf;
267 break;
268
269 case AC_KYUP:
270
271 sprintf(dspbuf, "GoTo %02d if key %c", pnt, SP_UPA);
272 s1 = dspbuf;
273 break;
274
275 case AC_KYDN:
276
277 sprintf(dspbuf, "GoTo %02d if key %c", pnt, SP_DNA);
278 s1 = dspbuf;
279 break;
280
281 default:
282
283 s1 = "????????????????";
284 break;
285 }
286
287 vbank(0);
288 vcputsv(instob, 64, idbox[n][4], idbox[n][5],
289 idbox[n][6] + 1, idbox[n][7], s1, 14);
290}
291
292/*
293
294*/
295
296/*
297 =============================================================================
298 setactb() -- set action field data entry buffer format
299 =============================================================================
300*/
301
302setactb(n)
303short n;
304{
305 register char *s1;
306
307 switch (aform) {
308
309 case AC_NULL:
310
311 s1 = " ";
312 ebuf[0] = '\0';
313 break;
314
315 case AC_SUST:
316
317 sprintf(dspbuf, "Pause if key %c ", SP_DNA);
318 s1 = dspbuf;
319 ebuf[0] = '\0';
320 break;
321
322 case AC_ENBL:
323
324 sprintf(dspbuf, "Stop if key %c ", SP_UPA);
325 s1 = dspbuf;
326 ebuf[0] = '\0';
327 break;
328
329 case AC_JUMP:
330
331 s1 = "GoTo 00 forever ";
332 ebuf[0] = '0';
333 ebuf[1] = '0';
334 ebuf[2] = '\0';
335 break;
336
337/*
338
339*/
340 case AC_LOOP:
341
342 s1 = "GoTo 00 00 times";
343 ebuf[0] = '0';
344 ebuf[1] = '0';
345 ebuf[2] = ' ';
346 ebuf[3] = '0';
347 ebuf[4] = '0';
348 ebuf[5] = '\0';
349 break;
350
351 case AC_KYUP:
352
353 sprintf(dspbuf, "GoTo 00 if key %c", SP_UPA);
354 s1 = dspbuf;
355 ebuf[0] = '0';
356 ebuf[1] = '0';
357 ebuf[2] = '\0';
358 break;
359
360 case AC_KYDN:
361
362 sprintf(dspbuf, "GoTo 00 if key %c", SP_DNA);
363 s1 = dspbuf;
364 ebuf[0] = '0';
365 ebuf[1] = '0';
366 ebuf[2] = '\0';
367 break;
368
369 default:
370
371 s1 = "????????????????";
372 ebuf[0] = '\0';
373 break;
374 }
375
376 vbank(0);
377 vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
378 idbox[n][6] + 1, idbox[n][7], s1, 14);
379}
380
381/*
382
383*/
384
385/*
386 =============================================================================
387 nd_iact() -- process new data entry
388 =============================================================================
389*/
390
391short
392nd_iact(nn, k)
393short nn, k;
394{
395 register short n, ec;
396
397 n = nn & 0xFF;
398
399 if (stccol LT (idbox[n][7] + 5)) {
400
401 if (k EQ 8) {
402
403 if (--aform < 0)
404 aform = AC_KYDN;
405
406 setactb(n);
407 return(SUCCESS);
408
409 } else if (k EQ 9) {
410
411 if (++aform > AC_KYDN)
412 aform = AC_NULL;
413
414 setactb(n);
415 return(SUCCESS);
416 }
417
418 return(FAILURE);
419
420/*
421
422*/
423 } else {
424
425 switch (aform) {
426
427 case AC_NULL:
428 case AC_UNDF:
429 case AC_ENBL:
430 case AC_SUST:
431
432 return(FAILURE);
433
434 case AC_KYUP:
435 case AC_KYDN:
436 case AC_JUMP:
437
438 if ((stccol EQ (idbox[n][7] + 5)) OR
439 (stccol EQ (idbox[n][7] + 6))) {
440
441 ebuf[stccol - (idbox[n][7] + 5)] = k + '0';
442 dspbuf[0] = k + '0';
443 dspbuf[1] = '\0';
444
445 vbank(0);
446 vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
447 stcrow, stccol, dspbuf, 14);
448
449 advicur();
450 return(SUCCESS);
451
452 } else {
453
454 return(FAILURE);
455 }
456/*
457
458*/
459 case AC_LOOP:
460
461 if ((stccol GE (idbox[n][7] + 5)) AND
462 (stccol LE (idbox[n][7] + 9))) {
463
464 ec = stccol - (idbox[n][7] + 5);
465
466 if (ec EQ 2)
467 return(FAILURE);
468
469 ebuf[ec] = k + '0';
470 dspbuf[0] = k + '0';
471 dspbuf[1] = '\0';
472
473 if ((ec EQ 3) AND (k EQ 9))
474 dspbuf[0] = 'R';
475
476 vbank(0);
477 vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
478 stcrow, stccol, dspbuf, 14);
479
480 advicur();
481
482 if (ec EQ 1)
483 advicur();
484
485 return(SUCCESS);
486
487 } else {
488
489 return(FAILURE);
490 }
491 }
492 }
493}
Note: See TracBrowser for help on using the repository browser.