source: buchla-68k/orig/RAM/ETTVAL.C@ c93e44d

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

Imported original source code.

  • Property mode set to 100755
File size: 3.6 KB
Line 
1/*
2 =============================================================================
3 ettval.c -- MIDAS tuning editor -- value field handlers
4 Version 2 -- 1987-12-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 "tundsp.h"
17
18extern unsigned *tunob;
19
20extern short stcrow, stccol, tunval, tunmod;
21
22extern short tdbox[][8];
23
24extern char dspbuf[];
25
26/*
27
28*/
29
30/*
31 =============================================================================
32 modtun() -- indicate that the tuning table was modified
33 =============================================================================
34*/
35
36modtun()
37{
38 if (NOT tunmod) {
39
40 tunmod = TRUE;
41 tdswin(6);
42 }
43}
44
45/*
46
47*/
48
49/*
50 =============================================================================
51 et_tval() -- load the edit buffer
52 =============================================================================
53*/
54
55short
56et_tval(n)
57short n;
58{
59 register short tv;
60 register char ts;
61
62 tv = (tunval < 0 ? -tunval : tunval) >> 1;
63 ts = tunval < 0 ? '-' : '+';
64
65 sprintf(ebuf, "%c%04d", ts, tv);
66 ebflag = TRUE;
67
68 return(SUCCESS);
69}
70
71/*
72
73*/
74
75/*
76 =============================================================================
77 ef_tval() -- parse (unload) the edit buffer
78 =============================================================================
79*/
80
81short
82ef_tval(n)
83short n;
84{
85 register short *ov;
86 register short i, tmpval, tv;
87 register char ts;
88
89 ebuf[5] = '\0'; /* terminate the string in ebuf */
90 ebflag = FALSE;
91
92 tmpval = 0;
93
94 for (i = 1; i < 5; i++) /* convert from ASCII to binary */
95 tmpval = (tmpval * 10) + (ebuf[i] - '0');
96
97 if (ebuf[0] EQ '-')
98 tunval = -tmpval << 1;
99 else
100 tunval = tmpval << 1;
101
102 tv = (tunval < 0 ? -tunval : tunval) >> 1;
103 ts = tunval < 0 ? '-' : '+';
104 sprintf(dspbuf, "Val %c%04d", ts, tv);
105
106 vbank(0);
107 vcputsv(tunob, 64, tdbox[n][4], tdbox[n][5], 18, 54, dspbuf, 14);
108
109 modtun();
110 return(SUCCESS);
111}
112
113/*
114
115*/
116
117/*
118 =============================================================================
119 rd_tval() -- (re)display the field
120 =============================================================================
121*/
122
123short
124rd_tval(nn)
125short nn;
126{
127 register short tv, n;
128 register char ts;
129
130 n = nn & 0xFF;
131
132 tv = (tunval < 0 ? -tunval : tunval) >> 1;
133 ts = tunval < 0 ? '-' : '+';
134
135 sprintf(dspbuf, "Val %c%04d", ts, tv);
136
137 vbank(0);
138 vcputsv(tunob, 64, tdbox[n][4], tdbox[n][5], 18, 54, dspbuf, 14);
139 return(SUCCESS);
140}
141
142/*
143
144*/
145
146/*
147 =============================================================================
148 nd_tval() -- handle new data entry
149 =============================================================================
150*/
151
152short
153nd_tval(nn, k)
154short nn;
155register short k;
156{
157 register short ec, n;
158
159 n = nn & 0xFF;
160 ec = stccol - cfetp->flcol; /* setup edit buffer column */
161
162 if (ec EQ 0) {
163
164 if (k EQ 8) {
165
166 ebuf[0] = '-';
167 ebuf[5] = '\0';
168
169 dspbuf[0] = '-';
170 dspbuf[1] = '\0';
171
172 } else if (k EQ 9) {
173
174 ebuf[0] = '+';
175 ebuf[5] = '\0';
176
177 dspbuf[0] = '+';
178 dspbuf[1] = '\0';
179
180 } else {
181
182 return(FAILURE);
183 }
184/*
185
186*/
187 } else {
188
189 ebuf[ec] = k + '0';
190 ebuf[5] = '\0';
191
192 dspbuf[0] = k + '0';
193 dspbuf[1] = '\0';
194 }
195
196 vbank(0);
197 vcputsv(tunob, 64, TDENTRY, tdbox[n][5], stcrow, stccol, dspbuf, 14);
198
199 advtcur();
200 return(SUCCESS);
201}
202
Note: See TracBrowser for help on using the repository browser.