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