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

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

Removed form-feed comments.

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