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

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

Added include files for global functions and variables.

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