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

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

Removed form-feed comments.

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