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

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

Added missing includes and declarations.

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