1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etwavs.c -- waveshape editor - waveshape number field handlers
|
---|
4 | Version 8 -- 1987-12-11 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 | #include "fields.h"
|
---|
10 | #include "vsdd.h"
|
---|
11 | #include "vsddsw.h"
|
---|
12 | #include "graphdef.h"
|
---|
13 |
|
---|
14 | #include "midas.h"
|
---|
15 | #include "wsdsp.h"
|
---|
16 |
|
---|
17 | extern void advwcur(void);
|
---|
18 |
|
---|
19 | extern uint16_t *waveob;
|
---|
20 |
|
---|
21 | extern int16_t stccol, curwave, curvce, curwslt;
|
---|
22 |
|
---|
23 | extern int16_t wsnmod[12][2];
|
---|
24 |
|
---|
25 | extern int16_t wdbox[][8];
|
---|
26 |
|
---|
27 | extern int8_t dspbuf[];
|
---|
28 |
|
---|
29 | /* |
---|
30 |
|
---|
31 | */
|
---|
32 |
|
---|
33 | /*
|
---|
34 | =============================================================================
|
---|
35 | et_wavs() -- load the edit buffer
|
---|
36 | =============================================================================
|
---|
37 | */
|
---|
38 |
|
---|
39 | int16_t et_wavs(int16_t n)
|
---|
40 | {
|
---|
41 | sprintf(ebuf, "%02d", curwave + 1);
|
---|
42 | ebflag = TRUE;
|
---|
43 |
|
---|
44 | return(SUCCESS);
|
---|
45 | }
|
---|
46 |
|
---|
47 | /*
|
---|
48 | =============================================================================
|
---|
49 | ef_wavs() -- parse (unload) the edit buffer
|
---|
50 | =============================================================================
|
---|
51 | */
|
---|
52 |
|
---|
53 | int16_t ef_wavs(int16_t n)
|
---|
54 | {
|
---|
55 | register int16_t i, tmpval;
|
---|
56 |
|
---|
57 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
58 | ebflag = FALSE;
|
---|
59 |
|
---|
60 | tmpval = 0;
|
---|
61 |
|
---|
62 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
63 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
64 |
|
---|
65 | if ((tmpval GT NUMWAVS) OR (tmpval EQ 0))
|
---|
66 | return(FAILURE);
|
---|
67 |
|
---|
68 | wsnmod[curvce][curwslt] = TRUE;
|
---|
69 | curwave = tmpval - 1;
|
---|
70 | return(SUCCESS);
|
---|
71 | }
|
---|
72 |
|
---|
73 | /* |
---|
74 |
|
---|
75 | */
|
---|
76 |
|
---|
77 | /*
|
---|
78 | =============================================================================
|
---|
79 | rd_wavs() -- (re)display the field
|
---|
80 | =============================================================================
|
---|
81 | */
|
---|
82 |
|
---|
83 | int16_t rd_wavs(int16_t nn)
|
---|
84 | {
|
---|
85 | register int16_t n;
|
---|
86 | register uint16_t cx;
|
---|
87 |
|
---|
88 | cx = exp_c(wsnmod[curvce][curwslt] ? WS_CHGC : wdbox[n][4]);
|
---|
89 | n = nn & 0x00FF;
|
---|
90 |
|
---|
91 | sprintf(dspbuf, "%02d", curwave + 1);
|
---|
92 |
|
---|
93 | vbank(0);
|
---|
94 | vcputsv(waveob, 64, cx, wdbox[n][5],
|
---|
95 | wdbox[n][6], wdbox[n][7] + WAVE_OFF, dspbuf, 14);
|
---|
96 |
|
---|
97 | return(SUCCESS);
|
---|
98 | }
|
---|
99 |
|
---|
100 | /*
|
---|
101 | =============================================================================
|
---|
102 | nd_wavs() -- handle new data entry
|
---|
103 | =============================================================================
|
---|
104 | */
|
---|
105 |
|
---|
106 | int16_t nd_wavs(int16_t nn, int16_t k)
|
---|
107 | {
|
---|
108 | register int16_t ec, n;
|
---|
109 |
|
---|
110 | n = nn & 0xFF;
|
---|
111 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
112 | ebuf[ec] = k + '0';
|
---|
113 | ebuf[2] = '\0';
|
---|
114 |
|
---|
115 | dspbuf[0] = k + '0';
|
---|
116 | dspbuf[1] = '\0';
|
---|
117 |
|
---|
118 | vbank(0);
|
---|
119 | vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
|
---|
120 | wdbox[n][6], stccol, dspbuf, 14);
|
---|
121 |
|
---|
122 | advwcur();
|
---|
123 | return(SUCCESS);
|
---|
124 | }
|
---|
125 |
|
---|