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