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

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

Added include files for global functions and variables.

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