source: buchla-68k/ram/etwhrv.c@ 6262b5c

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

Added include files for global functions and variables.

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