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