source: buchla-68k/orig/RAM/ETWHRV.C@ b8080f6

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

Imported original source code.

  • Property mode set to 100755
File size: 3.6 KB
Line 
1/*
2 =============================================================================
3 etwhrv.c -- waveshape editor - harmonic value field handlers
4 Version 12 -- 1988-09-09 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "stddefs.h"
9#include "fields.h"
10#include "vsdd.h"
11#include "vsddsw.h"
12#include "graphdef.h"
13#include "charset.h"
14
15#include "midas.h"
16#include "instdsp.h"
17#include "wsdsp.h"
18
19extern short advwcur(), wdswin();
20
21extern unsigned *waveob;
22
23extern short stcrow, stccol, curwhrv, curvce, curwslt, curwhrm;
24
25extern short wdbox[][8];
26
27extern char dspbuf[];
28
29extern struct instdef vbufs[];
30
31extern short wsnmod[12][2];
32
33extern short vmtab[NUMHARM];
34
35/*
36
37*/
38
39/*
40 =============================================================================
41 et_whrv() -- load the edit buffer
42 =============================================================================
43*/
44
45short
46et_whrv(n)
47short n;
48{
49 register short harv;
50 register char hvsgn;
51
52 if (curwhrv LT 0) {
53
54 hvsgn = '-';
55 harv = -curwhrv;
56
57 } else {
58
59 hvsgn = '+';
60 harv = curwhrv;
61 }
62
63 sprintf(ebuf, "%c%03d", hvsgn, harv);
64 ebflag = TRUE;
65
66 return(SUCCESS);
67}
68
69/*
70
71*/
72
73/*
74 =============================================================================
75 ef_whrv() -- parse (unload) the edit buffer
76 =============================================================================
77*/
78
79short
80ef_whrv(n)
81short n;
82{
83 register short *hv;
84 register short i, tmpval;
85
86 ebuf[4] = '\0'; /* terminate the string in ebuf */
87 ebflag = FALSE;
88
89 tmpval = 0;
90
91 for (i = 1; i < 4; i++) /* convert from ASCII to binary */
92 tmpval = (tmpval * 10) + (ebuf[i] - '0');
93
94 if (tmpval GT 100)
95 return(FAILURE);
96
97 if (ebuf[0] EQ '-')
98 curwhrv = -tmpval;
99 else
100 curwhrv = tmpval;
101
102 hv = curwslt ? vbufs[curvce].idhwvbh : vbufs[curvce].idhwvah;
103 hv[curwhrm] = curwhrv;
104 vmtab[curwhrm] = curwhrv;
105 adj(curwhrm);
106 wscalc();
107 whupd();
108 wsnmod[curvce][curwslt] = TRUE;
109 wdswin(0);
110 wdswin(2);
111 wdswin(4);
112 return(SUCCESS);
113}
114
115/*
116
117*/
118
119/*
120 =============================================================================
121 rd_whrv() -- (re)display the field
122 =============================================================================
123*/
124
125short
126rd_whrv(nn)
127short nn;
128{
129 register short harv, n;
130 register char hvsgn;
131
132 n = nn & 0x00FF;
133
134 if (curwhrv LT 0) {
135
136 hvsgn = '-';
137 harv = -curwhrv;
138
139 } else {
140
141 hvsgn = '+';
142 harv = curwhrv;
143 }
144
145 sprintf(dspbuf, "%c%03d", hvsgn, harv);
146
147 vbank(0); /* display the value */
148 vcputsv(waveob, 64, wdbox[n][4], wdbox[n][5],
149 wdbox[n][6] + 1, wdbox[n][7] + WHRV_OFF, dspbuf, 14);
150
151 return(SUCCESS);
152}
153
154/*
155
156*/
157
158/*
159 =============================================================================
160 nd_whrv() -- handle new data entry
161 =============================================================================
162*/
163
164short
165nd_whrv(nn, k)
166short nn;
167register short k;
168{
169 register short ec, n;
170
171 n = nn & 0x00FF;
172 ec = stccol - cfetp->flcol; /* setup edit buffer column */
173
174 if (ec EQ 0) {
175
176 if (k EQ 8) {
177
178 ebuf[0] = dspbuf[0] = '-';
179 ebuf[4] = dspbuf[1] = '\0';
180
181 } else if (k EQ 9) {
182
183 ebuf[0] = dspbuf[0] = '+';
184 ebuf[4] = dspbuf[1] = '\0';
185
186 } else {
187
188 return(FAILURE);
189 }
190
191 } else {
192
193 ebuf[ec] = dspbuf[0] = k + '0';
194 ebuf[4] = dspbuf[1] = '\0';
195 }
196
197 vbank(0);
198 vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
199 stcrow, stccol, dspbuf, 14);
200
201 advwcur();
202 return(SUCCESS);
203}
Note: See TracBrowser for help on using the repository browser.