source: buchla-68k/ram/ettval.c@ 572daa7

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

Unused variables and parameters.

  • Property mode set to 100644
File size: 3.1 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 "ram.h"
9
10/*
11 =============================================================================
12 modtun() -- indicate that the tuning table was modified
13 =============================================================================
14*/
15
16void modtun(void)
17{
18 if (NOT tunmod) {
19
20 tunmod = TRUE;
21 tdswin(6);
22 }
23}
24
25/*
26 =============================================================================
27 et_tval() -- load the edit buffer
28 =============================================================================
29*/
30
31int16_t et_tval(int16_t n)
32{
33 register int16_t tv;
34 register int8_t ts;
35
36 (void)n;
37
38 tv = (tunval < 0 ? -tunval : tunval) >> 1;
39 ts = tunval < 0 ? '-' : '+';
40
41 sprintf(ebuf, "%c%04d", ts, tv);
42 ebflag = TRUE;
43
44 return(SUCCESS);
45}
46
47/*
48 =============================================================================
49 ef_tval() -- parse (unload) the edit buffer
50 =============================================================================
51*/
52
53int16_t ef_tval(int16_t n)
54{
55 register int16_t i, tmpval, tv;
56 register int8_t ts;
57
58 ebuf[5] = '\0'; /* terminate the string in ebuf */
59 ebflag = FALSE;
60
61 tmpval = 0;
62
63 for (i = 1; i < 5; i++) /* convert from ASCII to binary */
64 tmpval = (tmpval * 10) + (ebuf[i] - '0');
65
66 if (ebuf[0] EQ '-')
67 tunval = -tmpval << 1;
68 else
69 tunval = tmpval << 1;
70
71 tv = (tunval < 0 ? -tunval : tunval) >> 1;
72 ts = tunval < 0 ? '-' : '+';
73 sprintf(dspbuf, "Val %c%04d", ts, tv);
74
75 vbank(0);
76 vcputsv(tunob, 64, tdbox[n][4], tdbox[n][5], 18, 54, dspbuf, 14);
77
78 modtun();
79 return(SUCCESS);
80}
81
82/*
83 =============================================================================
84 rd_tval() -- (re)display the field
85 =============================================================================
86*/
87
88int16_t rd_tval(int16_t nn)
89{
90 register int16_t tv, n;
91 register int8_t ts;
92
93 n = nn & 0xFF;
94
95 tv = (tunval < 0 ? -tunval : tunval) >> 1;
96 ts = tunval < 0 ? '-' : '+';
97
98 sprintf(dspbuf, "Val %c%04d", ts, tv);
99
100 vbank(0);
101 vcputsv(tunob, 64, tdbox[n][4], tdbox[n][5], 18, 54, dspbuf, 14);
102 return(SUCCESS);
103}
104
105/*
106 =============================================================================
107 nd_tval() -- handle new data entry
108 =============================================================================
109*/
110
111int16_t nd_tval(int16_t nn, int16_t k)
112{
113 register int16_t ec, n;
114
115 n = nn & 0xFF;
116 ec = stccol - cfetp->flcol; /* setup edit buffer column */
117
118 if (ec EQ 0) {
119
120 if (k EQ 8) {
121
122 ebuf[0] = '-';
123 ebuf[5] = '\0';
124
125 dspbuf[0] = '-';
126 dspbuf[1] = '\0';
127
128 } else if (k EQ 9) {
129
130 ebuf[0] = '+';
131 ebuf[5] = '\0';
132
133 dspbuf[0] = '+';
134 dspbuf[1] = '\0';
135
136 } else {
137
138 return(FAILURE);
139 }
140
141 } else {
142
143 ebuf[ec] = k + '0';
144 ebuf[5] = '\0';
145
146 dspbuf[0] = k + '0';
147 dspbuf[1] = '\0';
148 }
149
150 vbank(0);
151 vcputsv(tunob, 64, TDENTRY, tdbox[n][5], stcrow, stccol, dspbuf, 14);
152
153 advtcur();
154 return(SUCCESS);
155}
156
157
Note: See TracBrowser for help on using the repository browser.