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

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

Removed form-feed comments.

  • Property mode set to 100644
File size: 2.9 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 ef_woff() -- parse (unload) the edit buffer
43 =============================================================================
44*/
45
46int16_t ef_woff(int16_t n)
47{
48 register int16_t *ov;
49 register int16_t i, tmpval;
50
51 ebuf[5] = '\0'; /* terminate the string in ebuf */
52 ebflag = FALSE;
53
54 tmpval = 0;
55
56 for (i = 1; i < 5; i++) /* convert from ASCII to binary */
57 tmpval = (tmpval * 10) + (ebuf[i] - '0');
58
59 if (tmpval GT 1023)
60 return(FAILURE);
61
62 if (ebuf[0] EQ '-')
63 curwoff = -tmpval;
64 else
65 curwoff = tmpval;
66
67 if (curwdth EQ NUMWIDS)
68 wdintp();
69 else
70 pntsup();
71
72 wdswin(0);
73 wdswin(2);
74 wdswin(4);
75 return(SUCCESS);
76}
77
78/*
79 =============================================================================
80 rd_woff() -- (re)display the field
81 =============================================================================
82*/
83
84int16_t rd_woff(int16_t nn)
85{
86 register int16_t hoff, n;
87 register int8_t hosgn;
88
89 n = nn & 0xFF;
90 lstwoff = curwoff;
91
92 if (curwoff LT 0) {
93
94 hosgn = '-';
95 hoff = -curwoff;
96
97 } else {
98
99 hosgn = '+';
100 hoff = curwoff;
101 }
102
103 sprintf(dspbuf, "%c%04d", hosgn, hoff);
104
105 /* display the value */
106
107 if (v_regs[5] & 0x0180)
108 vbank(0);
109
110 vcputsv(waveob, 64, wdbox[n][4], wdbox[n][5],
111 wdbox[n][6], wdbox[n][7] + WOFF_OFF, dspbuf, 14);
112
113 return(SUCCESS);
114}
115
116/*
117 =============================================================================
118 nd_woff() -- handle new data entry
119 =============================================================================
120*/
121
122int16_t nd_woff(int16_t nn, int16_t k)
123{
124 register int16_t ec, n;
125
126 n = nn & 0xFF;
127 ec = stccol - cfetp->flcol; /* setup edit buffer column */
128
129 if (ec EQ 0) {
130
131 if (k EQ 8) {
132
133 ebuf[0] = '-';
134 ebuf[5] = '\0';
135
136 dspbuf[0] = '-';
137 dspbuf[1] = '\0';
138
139 } else if (k EQ 9) {
140
141 ebuf[0] = '+';
142 ebuf[5] = '\0';
143
144 dspbuf[0] = '+';
145 dspbuf[1] = '\0';
146
147 } else {
148
149 return(FAILURE);
150 }
151
152 } else {
153
154 ebuf[ec] = k + '0';
155 ebuf[5] = '\0';
156
157 dspbuf[0] = k + '0';
158 dspbuf[1] = '\0';
159 }
160
161 if (v_regs[5] & 0x0180)
162 vbank(0);
163
164 vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
165 stcrow, stccol, dspbuf, 14);
166
167 advwcur();
168 return(SUCCESS);
169}
170
Note: See TracBrowser for help on using the repository browser.