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