source: buchla-68k/orig/RAM/ETWOFF.C@ b8080f6

Last change on this file since b8080f6 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

  • Property mode set to 100755
File size: 3.6 KB
RevLine 
[3ae31e9]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 short advwcur(), wdswin(), pntsup();
21
22extern unsigned *waveob;
23
24extern short stcrow, stccol, lstwoff, curwoff, curvce, curwslt, curwdth;
25
26extern short wsnmod[12][2];
27
28extern short wdbox[][8];
29
30extern char dspbuf[];
31
32/*
33
34*/
35
36/*
37 =============================================================================
38 et_woff() -- load the edit buffer
39 =============================================================================
40*/
41
42short
43et_woff(n)
44short 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
79ef_woff(n)
80short n;
81{
82 register short *ov;
83 register short i, tmpval;
84
85 ebuf[5] = '\0'; /* terminate the string in ebuf */
86 ebflag = FALSE;
87
88 tmpval = 0;
89
90 for (i = 1; i < 5; i++) /* convert from ASCII to binary */
91 tmpval = (tmpval * 10) + (ebuf[i] - '0');
92
93 if (tmpval GT 1023)
94 return(FAILURE);
95
96 if (ebuf[0] EQ '-')
97 curwoff = -tmpval;
98 else
99 curwoff = tmpval;
100
101 if (curwdth EQ NUMWIDS)
102 wdintp();
103 else
104 pntsup();
105
106 wdswin(0);
107 wdswin(2);
108 wdswin(4);
109 return(SUCCESS);
110}
111
112/*
113
114*/
115
116/*
117 =============================================================================
118 rd_woff() -- (re)display the field
119 =============================================================================
120*/
121
122short
123rd_woff(nn)
124short nn;
125{
126 register short hoff, n;
127 register char hosgn;
128
129 n = nn & 0xFF;
130 lstwoff = curwoff;
131
132 if (curwoff LT 0) {
133
134 hosgn = '-';
135 hoff = -curwoff;
136
137 } else {
138
139 hosgn = '+';
140 hoff = curwoff;
141 }
142
143 sprintf(dspbuf, "%c%04d", hosgn, hoff);
144
145 /* display the value */
146
147 if (v_regs[5] & 0x0180)
148 vbank(0);
149
150 vcputsv(waveob, 64, wdbox[n][4], wdbox[n][5],
151 wdbox[n][6], wdbox[n][7] + WOFF_OFF, dspbuf, 14);
152
153 return(SUCCESS);
154}
155
156/*
157
158*/
159
160/*
161 =============================================================================
162 nd_woff() -- handle new data entry
163 =============================================================================
164*/
165
166short
167nd_woff(nn, k)
168short nn;
169register short k;
170{
171 register short ec, n;
172
173 n = nn & 0xFF;
174 ec = stccol - cfetp->flcol; /* setup edit buffer column */
175
176 if (ec EQ 0) {
177
178 if (k EQ 8) {
179
180 ebuf[0] = '-';
181 ebuf[5] = '\0';
182
183 dspbuf[0] = '-';
184 dspbuf[1] = '\0';
185
186 } else if (k EQ 9) {
187
188 ebuf[0] = '+';
189 ebuf[5] = '\0';
190
191 dspbuf[0] = '+';
192 dspbuf[1] = '\0';
193
194 } else {
195
196 return(FAILURE);
197 }
198
199 } else {
200
201 ebuf[ec] = k + '0';
202 ebuf[5] = '\0';
203
204 dspbuf[0] = k + '0';
205 dspbuf[1] = '\0';
206 }
207/*
208
209*/
210 if (v_regs[5] & 0x0180)
211 vbank(0);
212
213 vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
214 stcrow, stccol, dspbuf, 14);
215
216 advwcur();
217 return(SUCCESS);
218}
Note: See TracBrowser for help on using the repository browser.