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

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

Zero redundant declarations.

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