source: buchla-68k/orig/RAM/ETIWSN.C@ 6888aa2

Last change on this file since 6888aa2 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

  • Property mode set to 100755
File size: 3.7 KB
RevLine 
[3ae31e9]1/*
2 =============================================================================
3 etiwsn.c -- MIDAS instrument editor - waveshape number handlers
4 Version 6 -- 1988-04-19 -- 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 stcrow, stccol, curvce;
23extern short idbox[][8];
24
25extern char dspbuf[];
26
27extern struct instdef vbufs[];
28extern struct wstbl wslib[];
29
30/*
31
32*/
33
34/*
35 =============================================================================
36 et_iwsn() -- load the edit buffer
37 =============================================================================
38*/
39
40short
41et_iwsn(nn)
42short nn;
43{
44 register short m;
45
46 m = nn >> 8;
47
48 sprintf(ebuf, "%02d", m ? vbufs[curvce].idhwsb + 1
49 : vbufs[curvce].idhwsa + 1);
50 ebflag = TRUE;
51
52 return(SUCCESS);
53}
54
55/*
56
57*/
58
59/*
60 =============================================================================
61 ef_iwsn() -- parse (unload) the edit buffer
62 =============================================================================
63*/
64
65short
66ef_iwsn(nn)
67short nn;
68{
69 register short i, tmpval, m;
70 register short *fpuws;
71
72 m = nn >> 8;
73 ebuf[2] = '\0'; /* terminate the string in ebuf */
74 ebflag = FALSE;
75
76 tmpval = 0;
77
78 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
79 tmpval = (tmpval * 10) + (ebuf[i] - '0');
80
81 if ((tmpval EQ 0) OR (tmpval GT NUMWAVS))
82 return(FAILURE);
83
84 if (m) {
85
86 /* slot B */
87 vbufs[curvce].idhwsb = tmpval - 1;
88
89 memcpyw(vbufs[curvce].idhwvbf, &wslib[tmpval - 1],
90 NUMHARM + (2 * NUMWPNT));
91
92 fpuws = io_fpu + FPU_OWST + (curvce << 9) + 1;
93
94 memcpyw(fpuws, vbufs[curvce].idhwvbf, NUMWPNT);
95
96 *(fpuws - 1) = vbufs[curvce].idhwvbf[0];
97 *(fpuws + NUMWPNT) = vbufs[curvce].idhwvbf[NUMWPNT - 1];
98
99 } else {
100
101 /* slot A */
102
103 vbufs[curvce].idhwsa = tmpval - 1;
104
105 memcpyw(vbufs[curvce].idhwvaf, &wslib[tmpval - 1],
106 NUMHARM + (2 * NUMWPNT));
107
108 fpuws = io_fpu + FPU_OWST + (curvce << 9) + 0x100 + 1;
109
110 memcpyw(fpuws, vbufs[curvce].idhwvaf, NUMWPNT);
111
112 *(fpuws - 1) = vbufs[curvce].idhwvaf[0];
113 *(fpuws + NUMWPNT) = vbufs[curvce].idhwvaf[NUMWPNT - 1];
114 }
115
116 dswin(21);
117 modinst();
118 return(SUCCESS);
119}
120
121/*
122
123*/
124
125/*
126 =============================================================================
127 rd_iwsn() -- (re)display the field
128 =============================================================================
129*/
130
131short
132rd_iwsn(nn)
133short nn;
134{
135 register short m, n;
136
137 m = (nn >> 8) & 0x00FF;
138 n = nn & 0x00FF;
139
140 sprintf(dspbuf, "%02d", m ? vbufs[curvce].idhwsb + 1
141 : vbufs[curvce].idhwsa + 1);
142
143 vbank(0);
144
145 vcputsv(instob, 64, (m ? WSBFC : WSAFC), idbox[n][5],
146 cfetp->frow, cfetp->flcol, dspbuf, 14);
147
148 return(SUCCESS);
149}
150
151/*
152
153*/
154
155/*
156 =============================================================================
157 nd_iwsn() -- handle new data entry
158 =============================================================================
159*/
160
161short
162nd_iwsn(nn, k)
163short nn;
164register short k;
165{
166 register short ec, c, n;
167
168 n = nn & 0x00FF;
169
170 ec = stccol - cfetp->flcol; /* setup edit buffer column */
171 ebuf[ec] = k + '0'; /* enter new data in buffer */
172 ebuf[2] = '\0'; /* make sure string is terminated */
173
174 dspbuf[0] = k + '0'; /* setup for display */
175 dspbuf[1] = '\0';
176
177 vbank(0); /* display the new data */
178 vcputsv(instob, 64, ID_ENTRY, idbox[n][5], stcrow, stccol, dspbuf, 14);
179
180 advicur(); /* advance cursor */
181
182 return(SUCCESS);
183}
184
Note: See TracBrowser for help on using the repository browser.