source: buchla-68k/ram/etwoff.c@ b28a12e

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

Zero redundant declarations.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*
2 =============================================================================
3 etwoff.c -- waveshape editor - offset value field handlers
4 Version 16 -- 1987-12-22 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "ram.h"
9
10/*
11 =============================================================================
12 et_woff() -- load the edit buffer
13 =============================================================================
14*/
15
16int16_t et_woff(int16_t n)
17{
18 register int16_t hoff;
19 register int8_t hosgn;
20
21 lstwoff = curwoff;
22
23 if (curwoff LT 0) {
24
25 hosgn = '-';
26 hoff = -curwoff;
27
28 } else {
29
30 hosgn = '+';
31 hoff = curwoff;
32 }
33
34 sprintf(ebuf, "%c%04d", hosgn, hoff);
35 ebflag = TRUE;
36
37 return(SUCCESS);
38}
39
40/*
41
42*/
43
44/*
45 =============================================================================
46 ef_woff() -- parse (unload) the edit buffer
47 =============================================================================
48*/
49
50int16_t ef_woff(int16_t n)
51{
52 register int16_t *ov;
53 register int16_t i, tmpval;
54
55 ebuf[5] = '\0'; /* terminate the string in ebuf */
56 ebflag = FALSE;
57
58 tmpval = 0;
59
60 for (i = 1; i < 5; i++) /* convert from ASCII to binary */
61 tmpval = (tmpval * 10) + (ebuf[i] - '0');
62
63 if (tmpval GT 1023)
64 return(FAILURE);
65
66 if (ebuf[0] EQ '-')
67 curwoff = -tmpval;
68 else
69 curwoff = tmpval;
70
71 if (curwdth EQ NUMWIDS)
72 wdintp();
73 else
74 pntsup();
75
76 wdswin(0);
77 wdswin(2);
78 wdswin(4);
79 return(SUCCESS);
80}
81
82/*
83
84*/
85
86/*
87 =============================================================================
88 rd_woff() -- (re)display the field
89 =============================================================================
90*/
91
92int16_t rd_woff(int16_t nn)
93{
94 register int16_t hoff, n;
95 register int8_t hosgn;
96
97 n = nn & 0xFF;
98 lstwoff = curwoff;
99
100 if (curwoff LT 0) {
101
102 hosgn = '-';
103 hoff = -curwoff;
104
105 } else {
106
107 hosgn = '+';
108 hoff = curwoff;
109 }
110
111 sprintf(dspbuf, "%c%04d", hosgn, hoff);
112
113 /* display the value */
114
115 if (v_regs[5] & 0x0180)
116 vbank(0);
117
118 vcputsv(waveob, 64, wdbox[n][4], wdbox[n][5],
119 wdbox[n][6], wdbox[n][7] + WOFF_OFF, dspbuf, 14);
120
121 return(SUCCESS);
122}
123
124/*
125
126*/
127
128/*
129 =============================================================================
130 nd_woff() -- handle new data entry
131 =============================================================================
132*/
133
134int16_t nd_woff(int16_t nn, int16_t k)
135{
136 register int16_t ec, n;
137
138 n = nn & 0xFF;
139 ec = stccol - cfetp->flcol; /* setup edit buffer column */
140
141 if (ec EQ 0) {
142
143 if (k EQ 8) {
144
145 ebuf[0] = '-';
146 ebuf[5] = '\0';
147
148 dspbuf[0] = '-';
149 dspbuf[1] = '\0';
150
151 } else if (k EQ 9) {
152
153 ebuf[0] = '+';
154 ebuf[5] = '\0';
155
156 dspbuf[0] = '+';
157 dspbuf[1] = '\0';
158
159 } else {
160
161 return(FAILURE);
162 }
163
164 } else {
165
166 ebuf[ec] = k + '0';
167 ebuf[5] = '\0';
168
169 dspbuf[0] = k + '0';
170 dspbuf[1] = '\0';
171 }
172/*
173
174*/
175 if (v_regs[5] & 0x0180)
176 vbank(0);
177
178 vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
179 stcrow, stccol, dspbuf, 14);
180
181 advwcur();
182 return(SUCCESS);
183}
184
Note: See TracBrowser for help on using the repository browser.