[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 |
|
---|
[6262b5c] | 8 | #include "all.h"
|
---|
[e225e77] | 9 |
|
---|
[0580615] | 10 | extern void advwcur(void);
|
---|
[7258c6a] | 11 | extern void wdswin(int16_t n);
|
---|
[0580615] | 12 | extern void newws(void);
|
---|
[f40a309] | 13 |
|
---|
[7258c6a] | 14 | extern uint16_t *waveob;
|
---|
[f40a309] | 15 |
|
---|
[7258c6a] | 16 | extern int16_t stccol, curwpnt;
|
---|
[f40a309] | 17 |
|
---|
[7258c6a] | 18 | extern int16_t wdbox[][8];
|
---|
[f40a309] | 19 |
|
---|
[7258c6a] | 20 | extern int8_t dspbuf[];
|
---|
[f40a309] | 21 |
|
---|
| 22 | /* |
---|
| 23 |
|
---|
| 24 | */
|
---|
| 25 |
|
---|
| 26 | /*
|
---|
| 27 | =============================================================================
|
---|
| 28 | et_wpnt() -- load the edit buffer
|
---|
| 29 | =============================================================================
|
---|
| 30 | */
|
---|
[7258c6a] | 31 |
|
---|
[f40a309] | 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 | =============================================================================
|
---|
[7258c6a] | 48 | */
|
---|
[f40a309] | 49 |
|
---|
[7258c6a] | 50 | int16_t ef_wpnt(int16_t n)
|
---|
[f40a309] | 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
|
---|
[7258c6a] | 78 | =============================================================================
|
---|
[f40a309] | 79 | */
|
---|
[7258c6a] | 80 |
|
---|
[f40a309] | 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 | =============================================================================
|
---|
[7258c6a] | 101 | nd_wpnt() -- handle new data entry
|
---|
[f40a309] | 102 | =============================================================================
|
---|
[7258c6a] | 103 | */
|
---|
[f40a309] | 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 |
|
---|
[6262b5c] | 122 | advwcur();
|
---|
| 123 |
|
---|
| 124 | return(SUCCESS);
|
---|
| 125 | }
|
---|
| 126 |
|
---|