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

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

Removed form-feed comments.

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