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