source: buchla-68k/ram/etiact.c@ 0580615

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

Point of no return.

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