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

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

Added missing includes and declarations.

  • Property mode set to 100644
File size: 3.5 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
20#include "stdio.h"
21
22extern void advwcur(void);
23extern void wdswin(int16_t n);
24extern void pntsup(void);
25
26extern void wdintp(void);
27
28extern uint16_t *waveob;
29
30extern int16_t stcrow, stccol, lstwoff, curwoff, curvce, curwslt, curwdth;
31
32extern int16_t wsnmod[12][2];
33
34extern int16_t wdbox[][8];
35
36extern int8_t dspbuf[];
37
38/*
39
40*/
41
42/*
43 =============================================================================
44 et_woff() -- load the edit buffer
45 =============================================================================
46*/
47
48int16_t et_woff(int16_t n)
49{
50 register int16_t hoff;
51 register int8_t hosgn;
52
53 lstwoff = curwoff;
54
55 if (curwoff LT 0) {
56
57 hosgn = '-';
58 hoff = -curwoff;
59
60 } else {
61
62 hosgn = '+';
63 hoff = curwoff;
64 }
65
66 sprintf(ebuf, "%c%04d", hosgn, hoff);
67 ebflag = TRUE;
68
69 return(SUCCESS);
70}
71
72/*
73
74*/
75
76/*
77 =============================================================================
78 ef_woff() -- parse (unload) the edit buffer
79 =============================================================================
80*/
81
82int16_t ef_woff(int16_t n)
83{
84 register int16_t *ov;
85 register int16_t i, tmpval;
86
87 ebuf[5] = '\0'; /* terminate the string in ebuf */
88 ebflag = FALSE;
89
90 tmpval = 0;
91
92 for (i = 1; i < 5; i++) /* convert from ASCII to binary */
93 tmpval = (tmpval * 10) + (ebuf[i] - '0');
94
95 if (tmpval GT 1023)
96 return(FAILURE);
97
98 if (ebuf[0] EQ '-')
99 curwoff = -tmpval;
100 else
101 curwoff = tmpval;
102
103 if (curwdth EQ NUMWIDS)
104 wdintp();
105 else
106 pntsup();
107
108 wdswin(0);
109 wdswin(2);
110 wdswin(4);
111 return(SUCCESS);
112}
113
114/*
115
116*/
117
118/*
119 =============================================================================
120 rd_woff() -- (re)display the field
121 =============================================================================
122*/
123
124int16_t rd_woff(int16_t nn)
125{
126 register int16_t hoff, n;
127 register int8_t 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
166int16_t nd_woff(int16_t nn, int16_t k)
167{
168 register int16_t ec, n;
169
170 n = nn & 0xFF;
171 ec = stccol - cfetp->flcol; /* setup edit buffer column */
172
173 if (ec EQ 0) {
174
175 if (k EQ 8) {
176
177 ebuf[0] = '-';
178 ebuf[5] = '\0';
179
180 dspbuf[0] = '-';
181 dspbuf[1] = '\0';
182
183 } else if (k EQ 9) {
184
185 ebuf[0] = '+';
186 ebuf[5] = '\0';
187
188 dspbuf[0] = '+';
189 dspbuf[1] = '\0';
190
191 } else {
192
193 return(FAILURE);
194 }
195
196 } else {
197
198 ebuf[ec] = k + '0';
199 ebuf[5] = '\0';
200
201 dspbuf[0] = k + '0';
202 dspbuf[1] = '\0';
203 }
204/*
205
206*/
207 if (v_regs[5] & 0x0180)
208 vbank(0);
209
210 vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
211 stcrow, stccol, dspbuf, 14);
212
213 advwcur();
214 return(SUCCESS);
215}
Note: See TracBrowser for help on using the repository browser.