source: buchla-68k/ram/etmcfn.c@ c65a0e2

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

Added RAM files.

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