1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etmcfn.c -- instrument editor - ws/cf menu field handlers
|
---|
4 | Version 7 -- 1988-08-26 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 | #include "fields.h"
|
---|
10 | #include "hwdefs.h"
|
---|
11 | #include "fpu.h"
|
---|
12 | #include "vsdd.h"
|
---|
13 | #include "vsddsw.h"
|
---|
14 | #include "graphdef.h"
|
---|
15 |
|
---|
16 | #include "midas.h"
|
---|
17 | #include "instdsp.h"
|
---|
18 | #include "wsdsp.h"
|
---|
19 |
|
---|
20 | extern unsigned *instob;
|
---|
21 |
|
---|
22 | extern short curvce;
|
---|
23 | extern short stccol;
|
---|
24 | extern short stcrow;
|
---|
25 | extern short wmcsel;
|
---|
26 | extern short wmctag;
|
---|
27 |
|
---|
28 | extern char dspbuf[];
|
---|
29 |
|
---|
30 | extern short idbox[][8];
|
---|
31 |
|
---|
32 | extern struct instdef vbufs[];
|
---|
33 |
|
---|
34 | extern struct wstbl wslib[];
|
---|
35 |
|
---|
36 | /* |
---|
37 |
|
---|
38 | */
|
---|
39 |
|
---|
40 | /*
|
---|
41 | =============================================================================
|
---|
42 | et_mcfn() -- load the edit buffer
|
---|
43 | =============================================================================
|
---|
44 | */
|
---|
45 |
|
---|
46 | short et_mcfn(short n)
|
---|
47 | {
|
---|
48 | sprintf(ebuf, "%02d", vbufs[curvce].idhcfg);
|
---|
49 | ebflag = TRUE;
|
---|
50 |
|
---|
51 | return(SUCCESS);
|
---|
52 | }
|
---|
53 |
|
---|
54 | /* |
---|
55 |
|
---|
56 | */
|
---|
57 |
|
---|
58 | /*
|
---|
59 | =============================================================================
|
---|
60 | ef_mcfn() -- parse (unload) the edit buffer
|
---|
61 | =============================================================================
|
---|
62 | */
|
---|
63 |
|
---|
64 | short ef_mcfn(short n)
|
---|
65 | {
|
---|
66 | register short tmpval;
|
---|
67 |
|
---|
68 | wmctag = FALSE;
|
---|
69 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
70 | ebflag = FALSE;
|
---|
71 |
|
---|
72 | tmpval = ((ebuf[0] - '0') * 10) + (ebuf[1] - '0');
|
---|
73 |
|
---|
74 | if (tmpval GE NUMCFG) /* check against limit */
|
---|
75 | return(FAILURE);
|
---|
76 |
|
---|
77 | vbufs[curvce].idhcfg = tmpval;
|
---|
78 | dosync(curvce);
|
---|
79 | wmctag = TRUE;
|
---|
80 | return(SUCCESS);
|
---|
81 | }
|
---|
82 |
|
---|
83 | /* |
---|
84 |
|
---|
85 | */
|
---|
86 |
|
---|
87 | /*
|
---|
88 | =============================================================================
|
---|
89 | rd_mcfn() -- (re)display the field
|
---|
90 | =============================================================================
|
---|
91 | */
|
---|
92 |
|
---|
93 | short rd_mcfn(short n)
|
---|
94 | {
|
---|
95 | sprintf(dspbuf, "%02d", vbufs[curvce].idhcfg);
|
---|
96 |
|
---|
97 | if (v_regs[5] & 0x0180)
|
---|
98 | vbank(0);
|
---|
99 |
|
---|
100 | vcputsv(instob, 64, CFBX18, CBBX18, 24, 16, dspbuf, 14);
|
---|
101 |
|
---|
102 | return(SUCCESS);
|
---|
103 | }
|
---|
104 |
|
---|
105 | /* |
---|
106 |
|
---|
107 | */
|
---|
108 |
|
---|
109 | /*
|
---|
110 | =============================================================================
|
---|
111 | nd_mcfn() -- handle new data entry
|
---|
112 | =============================================================================
|
---|
113 | */
|
---|
114 |
|
---|
115 | short nd_mcfn(short n, short k)
|
---|
116 | {
|
---|
117 | register short ec, c;
|
---|
118 |
|
---|
119 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
120 | ebuf[ec] = k + '0'; /* enter new data in buffer */
|
---|
121 | ebuf[2] = '\0'; /* make sure string is terminated */
|
---|
122 |
|
---|
123 | dspbuf[0] = k + '0'; /* setup for display */
|
---|
124 | dspbuf[1] = '\0';
|
---|
125 |
|
---|
126 | if (v_regs[5] & 0x0180)
|
---|
127 | vbank(0);
|
---|
128 |
|
---|
129 | /* display the new data */
|
---|
130 |
|
---|
131 | vcputsv(instob, 64, ID_ENTRY, CBBX18, stcrow, stccol, dspbuf, 14);
|
---|
132 |
|
---|
133 | advicur(); /* advance cursor */
|
---|
134 |
|
---|
135 | return(SUCCESS);
|
---|
136 | }
|
---|
137 |
|
---|
138 | /* |
---|
139 |
|
---|
140 | */
|
---|
141 |
|
---|
142 | /*
|
---|
143 | =============================================================================
|
---|
144 | et_mwsn() -- load the edit buffer
|
---|
145 | =============================================================================
|
---|
146 | */
|
---|
147 |
|
---|
148 | short et_mwsn(short nn)
|
---|
149 | {
|
---|
150 | wmcsel = (nn & 0xFF00) ? 1 : 0;
|
---|
151 |
|
---|
152 | sprintf(ebuf, "%02d", 1 + (wmcsel ? vbufs[curvce].idhwsb
|
---|
153 | : vbufs[curvce].idhwsa));
|
---|
154 |
|
---|
155 | ebflag = TRUE;
|
---|
156 |
|
---|
157 | return(SUCCESS);
|
---|
158 | }
|
---|
159 |
|
---|
160 | /* |
---|
161 |
|
---|
162 | */
|
---|
163 |
|
---|
164 | /*
|
---|
165 | =============================================================================
|
---|
166 | ef_mwsn() -- parse (unload) the edit buffer
|
---|
167 | =============================================================================
|
---|
168 | */
|
---|
169 |
|
---|
170 | short ef_mwsn(short nn)
|
---|
171 | {
|
---|
172 | register short tmpval;
|
---|
173 | register short *fpuws;
|
---|
174 |
|
---|
175 | wmcsel = (nn & 0xFF00) ? 1 : 0;
|
---|
176 |
|
---|
177 | wmctag = FALSE;
|
---|
178 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
179 | ebflag = FALSE;
|
---|
180 |
|
---|
181 | /* convert from ASCII to binary */
|
---|
182 |
|
---|
183 | tmpval = ((ebuf[0] -'0') * 10) + (ebuf[1] - '0');
|
---|
184 |
|
---|
185 | if ((tmpval < 1) OR (tmpval > NUMWAVS))
|
---|
186 | return(FAILURE);
|
---|
187 | /* |
---|
188 |
|
---|
189 | */
|
---|
190 | if (wmcsel) {
|
---|
191 |
|
---|
192 | /* slot B */
|
---|
193 | vbufs[curvce].idhwsb = tmpval - 1;
|
---|
194 |
|
---|
195 | memcpyw(vbufs[curvce].idhwvbf, &wslib[tmpval - 1],
|
---|
196 | NUMHARM + (2 * NUMWPNT));
|
---|
197 |
|
---|
198 | fpuws = io_fpu + FPU_OWST + (curvce << 9) + 1;
|
---|
199 |
|
---|
200 | memcpyw(fpuws, vbufs[curvce].idhwvbf, NUMWPNT);
|
---|
201 |
|
---|
202 | *(fpuws - 1) = vbufs[curvce].idhwvbf[0];
|
---|
203 | *(fpuws + NUMWPNT) = vbufs[curvce].idhwvbf[NUMWPNT - 1];
|
---|
204 |
|
---|
205 | } else {
|
---|
206 |
|
---|
207 | /* slot A */
|
---|
208 |
|
---|
209 | vbufs[curvce].idhwsa = tmpval - 1;
|
---|
210 |
|
---|
211 | memcpyw(vbufs[curvce].idhwvaf, &wslib[tmpval - 1],
|
---|
212 | NUMHARM + (2 * NUMWPNT));
|
---|
213 |
|
---|
214 | fpuws = io_fpu + FPU_OWST + (curvce << 9) + 0x100 + 1;
|
---|
215 |
|
---|
216 | memcpyw(fpuws, vbufs[curvce].idhwvaf, NUMWPNT);
|
---|
217 |
|
---|
218 | *(fpuws - 1) = vbufs[curvce].idhwvaf[0];
|
---|
219 | *(fpuws + NUMWPNT) = vbufs[curvce].idhwvaf[NUMWPNT - 1];
|
---|
220 | }
|
---|
221 |
|
---|
222 | wmctag = TRUE;
|
---|
223 | return(SUCCESS);
|
---|
224 | }
|
---|
225 |
|
---|
226 | /* |
---|
227 |
|
---|
228 | */
|
---|
229 |
|
---|
230 | /*
|
---|
231 | =============================================================================
|
---|
232 | rd_mwsn() -- (re)display the field
|
---|
233 | =============================================================================
|
---|
234 | */
|
---|
235 |
|
---|
236 | short rd_mwsn(short nn)
|
---|
237 | {
|
---|
238 | wmcsel = (nn & 0xFF00) ? 1 : 0;
|
---|
239 |
|
---|
240 | sprintf(dspbuf, "%02d", 1 + (wmcsel ? vbufs[curvce].idhwsb
|
---|
241 | : vbufs[curvce].idhwsa));
|
---|
242 |
|
---|
243 | if (v_regs[5] & 0x0180)
|
---|
244 | vbank(0);
|
---|
245 |
|
---|
246 | vcputsv(instob, 64, CFBX23, CBBX23, 24, wmcsel ? 16 : 12, dspbuf, 14);
|
---|
247 |
|
---|
248 | return(SUCCESS);
|
---|
249 | }
|
---|
250 |
|
---|
251 | /* |
---|
252 |
|
---|
253 | */
|
---|
254 |
|
---|
255 | /*
|
---|
256 | =============================================================================
|
---|
257 | nd_mwsn() -- handle new data entry
|
---|
258 | =============================================================================
|
---|
259 | */
|
---|
260 |
|
---|
261 | short nd_mwsn(short nn, short k)
|
---|
262 | {
|
---|
263 | register short ec, c;
|
---|
264 |
|
---|
265 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
266 | ebuf[ec] = k + '0'; /* enter new data in buffer */
|
---|
267 | ebuf[2] = '\0'; /* make sure string is terminated */
|
---|
268 |
|
---|
269 | dspbuf[0] = k + '0'; /* setup for display */
|
---|
270 | dspbuf[1] = '\0';
|
---|
271 |
|
---|
272 | if (v_regs[5] & 0x0180)
|
---|
273 | vbank(0); /* display the new data */
|
---|
274 |
|
---|
275 | vcputsv(instob, 64, ID_ENTRY, CBBX23, stcrow, stccol, dspbuf, 14);
|
---|
276 |
|
---|
277 | advicur(); /* advance cursor */
|
---|
278 |
|
---|
279 | return(SUCCESS);
|
---|
280 | }
|
---|