source: buchla-68k/ram/etavgr.c

Last change on this file was 9b98b6a, checked in by Thomas Lopatic <thomas@…>, 6 years ago

Fixed etavgr.c.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 =============================================================================
3 etavgr.c -- assignment editor - voice to group field handlers
4 Version 9 -- 1988-03-18 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGIT 0
9
10#include "ram.h"
11
12/*
13 =============================================================================
14 et_avgr() -- load the edit buffer
15 =============================================================================
16*/
17
18int16_t et_avgr(int16_t nn)
19{
20 register int16_t grp;
21 int8_t buf[4];
22
23 grp = 0x00FF & (nn >> 8);
24
25 sprintf(ebuf, "%s", numblk(buf, vce2grp[grp]));
26 ebflag = TRUE;
27
28#if DEBUGIT
29 if (debugsw)
30 printf("et_avgr($%04.4X): ebuf=[%s]\n", nn, ebuf);
31#endif
32
33 return(SUCCESS);
34}
35
36/*
37 =============================================================================
38 ef_avgr() -- parse (unload) the edit buffer
39 =============================================================================
40*/
41
42int16_t ef_avgr(int16_t nn)
43{
44 register int16_t tmpval, vce, i;
45
46 vce = 0x00FF & (nn >> 8);
47
48 ebuf[2] = '\0'; /* terminate the string in ebuf */
49 ebflag = FALSE;
50 tmpval = 0;
51
52#if DEBUGIT
53 if (debugsw)
54 printf("ef_avgr($%04.4X): ebuf=[%s]\n", nn, ebuf);
55#endif
56
57 if ((ebuf[0] EQ ' ') AND (ebuf[1] EQ ' ')) {
58
59 tmpval = -1;
60
61 } else {
62
63 for (i = 0; i < 2; i++) {
64
65 if (ebuf[i] EQ ' ')
66 ebuf[i] = '0';
67
68 tmpval = (tmpval * 10) + (ebuf[i] - '0');
69 }
70
71 if ((tmpval EQ 0) OR (tmpval GT 12))
72 return(FAILURE);
73 }
74
75 vce2grp[vce] = tmpval;
76
77 if (tmpval > 0)
78 execins(vce, (ins2grp[tmpval - 1] & 0x00FF), 1);
79
80 modasg();
81 return(SUCCESS);
82}
83
84/*
85 =============================================================================
86 rd_avgr() -- (re)display the field
87 =============================================================================
88*/
89
90int16_t rd_avgr(int16_t nn)
91{
92 register int16_t n, grp;
93 int8_t buf[4];
94
95 n = 0x00FF & nn;
96 grp = 0x00FF & (nn >> 8);
97
98 vbank(0);
99 vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
100 cfetp->frow, cfetp->flcol, numblk(buf, vce2grp[grp]), 14);
101
102 return(SUCCESS);
103}
104
105/*
106 =============================================================================
107 nd_avgr() -- handle new data entry
108 =============================================================================
109*/
110
111int16_t nd_avgr(int16_t nn, int16_t k)
112{
113 register int16_t n, col;
114
115 n = nn & 0xFF;
116 col = stccol - cfetp->flcol;
117
118 ebuf[col] = (int8_t)(k + '0');
119 ebuf[2] = '\0';
120
121#if DEBUGIT
122 if (debugsw)
123 printf("nd_avgr($%04.4X, %d): cfetp=$%08.8lX, col=%d, ebuf=[%s]\n",
124 nn, k, cfetp, col, ebuf);
125#endif
126
127 dspbuf[0] = (int8_t)(k + '0');
128 dspbuf[1] = '\0';
129
130 vbank(0);
131 vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
132
133 advacur();
134 return(SUCCESS);
135}
136
137
Note: See TracBrowser for help on using the repository browser.