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