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