source: buchla-68k/ram/ettval.c@ 60288f5

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

Point of no return.

  • Property mode set to 100644
File size: 3.4 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
36void modtun(void)
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 et_tval(short n)
56{
57 register short tv;
58 register char ts;
59
60 tv = (tunval < 0 ? -tunval : tunval) >> 1;
61 ts = tunval < 0 ? '-' : '+';
62
63 sprintf(ebuf, "%c%04d", ts, tv);
64 ebflag = TRUE;
65
66 return(SUCCESS);
67}
68
69/*
70
71*/
72
73/*
74 =============================================================================
75 ef_tval() -- parse (unload) the edit buffer
76 =============================================================================
77*/
78
79short ef_tval(short n)
80{
81 register short *ov;
82 register short i, tmpval, tv;
83 register char ts;
84
85 ebuf[5] = '\0'; /* terminate the string in ebuf */
86 ebflag = FALSE;
87
88 tmpval = 0;
89
90 for (i = 1; i < 5; i++) /* convert from ASCII to binary */
91 tmpval = (tmpval * 10) + (ebuf[i] - '0');
92
93 if (ebuf[0] EQ '-')
94 tunval = -tmpval << 1;
95 else
96 tunval = tmpval << 1;
97
98 tv = (tunval < 0 ? -tunval : tunval) >> 1;
99 ts = tunval < 0 ? '-' : '+';
100 sprintf(dspbuf, "Val %c%04d", ts, tv);
101
102 vbank(0);
103 vcputsv(tunob, 64, tdbox[n][4], tdbox[n][5], 18, 54, dspbuf, 14);
104
105 modtun();
106 return(SUCCESS);
107}
108
109/*
110
111*/
112
113/*
114 =============================================================================
115 rd_tval() -- (re)display the field
116 =============================================================================
117*/
118
119short rd_tval(short nn)
120{
121 register short tv, n;
122 register char ts;
123
124 n = nn & 0xFF;
125
126 tv = (tunval < 0 ? -tunval : tunval) >> 1;
127 ts = tunval < 0 ? '-' : '+';
128
129 sprintf(dspbuf, "Val %c%04d", ts, tv);
130
131 vbank(0);
132 vcputsv(tunob, 64, tdbox[n][4], tdbox[n][5], 18, 54, dspbuf, 14);
133 return(SUCCESS);
134}
135
136/*
137
138*/
139
140/*
141 =============================================================================
142 nd_tval() -- handle new data entry
143 =============================================================================
144*/
145
146short nd_tval(short nn, short k)
147{
148 register short ec, n;
149
150 n = nn & 0xFF;
151 ec = stccol - cfetp->flcol; /* setup edit buffer column */
152
153 if (ec EQ 0) {
154
155 if (k EQ 8) {
156
157 ebuf[0] = '-';
158 ebuf[5] = '\0';
159
160 dspbuf[0] = '-';
161 dspbuf[1] = '\0';
162
163 } else if (k EQ 9) {
164
165 ebuf[0] = '+';
166 ebuf[5] = '\0';
167
168 dspbuf[0] = '+';
169 dspbuf[1] = '\0';
170
171 } else {
172
173 return(FAILURE);
174 }
175/*
176
177*/
178 } else {
179
180 ebuf[ec] = k + '0';
181 ebuf[5] = '\0';
182
183 dspbuf[0] = k + '0';
184 dspbuf[1] = '\0';
185 }
186
187 vbank(0);
188 vcputsv(tunob, 64, TDENTRY, tdbox[n][5], stcrow, stccol, dspbuf, 14);
189
190 advtcur();
191 return(SUCCESS);
192}
193
Note: See TracBrowser for help on using the repository browser.