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