[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etiwsn.c -- MIDAS instrument editor - waveshape number handlers
|
---|
| 4 | Version 6 -- 1988-04-19 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include "stddefs.h"
|
---|
| 9 | #include "fields.h"
|
---|
| 10 | #include "hwdefs.h"
|
---|
| 11 | #include "fpu.h"
|
---|
| 12 | #include "vsdd.h"
|
---|
| 13 | #include "vsddsw.h"
|
---|
| 14 | #include "graphdef.h"
|
---|
| 15 |
|
---|
| 16 | #include "midas.h"
|
---|
| 17 | #include "instdsp.h"
|
---|
| 18 | #include "wsdsp.h"
|
---|
| 19 |
|
---|
[e225e77] | 20 | #include "memory.h"
|
---|
| 21 | #include "stdio.h"
|
---|
| 22 |
|
---|
| 23 | extern void advicur(void);
|
---|
| 24 | extern void dswin(int16_t n);
|
---|
| 25 | extern void modinst(void);
|
---|
| 26 |
|
---|
[7258c6a] | 27 | extern uint16_t *instob;
|
---|
[f40a309] | 28 |
|
---|
[7258c6a] | 29 | extern int16_t stcrow, stccol, curvce;
|
---|
| 30 | extern int16_t idbox[][8];
|
---|
[f40a309] | 31 |
|
---|
[7258c6a] | 32 | extern int8_t dspbuf[];
|
---|
[f40a309] | 33 |
|
---|
| 34 | extern struct instdef vbufs[];
|
---|
| 35 | extern struct wstbl wslib[];
|
---|
| 36 |
|
---|
| 37 | /* |
---|
| 38 |
|
---|
| 39 | */
|
---|
| 40 |
|
---|
| 41 | /*
|
---|
| 42 | =============================================================================
|
---|
| 43 | et_iwsn() -- load the edit buffer
|
---|
| 44 | =============================================================================
|
---|
| 45 | */
|
---|
[7258c6a] | 46 |
|
---|
[f40a309] | 47 | int16_t et_iwsn(int16_t nn)
|
---|
[7258c6a] | 48 | {
|
---|
[f40a309] | 49 | register int16_t m;
|
---|
| 50 |
|
---|
| 51 | m = nn >> 8;
|
---|
| 52 |
|
---|
| 53 | sprintf(ebuf, "%02d", m ? vbufs[curvce].idhwsb + 1
|
---|
| 54 | : vbufs[curvce].idhwsa + 1);
|
---|
| 55 | ebflag = TRUE;
|
---|
| 56 |
|
---|
| 57 | return(SUCCESS);
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | /* |
---|
| 61 |
|
---|
| 62 | */
|
---|
| 63 |
|
---|
| 64 | /*
|
---|
| 65 | =============================================================================
|
---|
| 66 | ef_iwsn() -- parse (unload) the edit buffer
|
---|
| 67 | =============================================================================
|
---|
[7258c6a] | 68 | */
|
---|
[f40a309] | 69 |
|
---|
[7258c6a] | 70 | int16_t ef_iwsn(int16_t nn)
|
---|
| 71 | {
|
---|
[f40a309] | 72 | register int16_t i, tmpval, m;
|
---|
| 73 | register int16_t *fpuws;
|
---|
| 74 |
|
---|
| 75 | m = nn >> 8;
|
---|
| 76 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
| 77 | ebflag = FALSE;
|
---|
| 78 |
|
---|
| 79 | tmpval = 0;
|
---|
| 80 |
|
---|
| 81 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
| 82 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 83 |
|
---|
| 84 | if ((tmpval EQ 0) OR (tmpval GT NUMWAVS))
|
---|
| 85 | return(FAILURE);
|
---|
| 86 |
|
---|
| 87 | if (m) {
|
---|
| 88 |
|
---|
| 89 | /* slot B */
|
---|
| 90 | vbufs[curvce].idhwsb = tmpval - 1;
|
---|
| 91 |
|
---|
| 92 | memcpyw(vbufs[curvce].idhwvbf, &wslib[tmpval - 1],
|
---|
| 93 | NUMHARM + (2 * NUMWPNT));
|
---|
| 94 |
|
---|
| 95 | fpuws = io_fpu + FPU_OWST + (curvce << 9) + 1;
|
---|
| 96 |
|
---|
| 97 | memcpyw(fpuws, vbufs[curvce].idhwvbf, NUMWPNT);
|
---|
| 98 |
|
---|
| 99 | *(fpuws - 1) = vbufs[curvce].idhwvbf[0];
|
---|
| 100 | *(fpuws + NUMWPNT) = vbufs[curvce].idhwvbf[NUMWPNT - 1];
|
---|
| 101 |
|
---|
| 102 | } else {
|
---|
| 103 |
|
---|
| 104 | /* slot A */
|
---|
| 105 |
|
---|
| 106 | vbufs[curvce].idhwsa = tmpval - 1;
|
---|
| 107 |
|
---|
| 108 | memcpyw(vbufs[curvce].idhwvaf, &wslib[tmpval - 1],
|
---|
| 109 | NUMHARM + (2 * NUMWPNT));
|
---|
| 110 |
|
---|
| 111 | fpuws = io_fpu + FPU_OWST + (curvce << 9) + 0x100 + 1;
|
---|
| 112 |
|
---|
| 113 | memcpyw(fpuws, vbufs[curvce].idhwvaf, NUMWPNT);
|
---|
| 114 |
|
---|
| 115 | *(fpuws - 1) = vbufs[curvce].idhwvaf[0];
|
---|
| 116 | *(fpuws + NUMWPNT) = vbufs[curvce].idhwvaf[NUMWPNT - 1];
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 | dswin(21);
|
---|
| 120 | modinst();
|
---|
| 121 | return(SUCCESS);
|
---|
| 122 | }
|
---|
| 123 |
|
---|
| 124 | /* |
---|
| 125 |
|
---|
| 126 | */
|
---|
| 127 |
|
---|
| 128 | /*
|
---|
| 129 | =============================================================================
|
---|
| 130 | rd_iwsn() -- (re)display the field
|
---|
[7258c6a] | 131 | =============================================================================
|
---|
[f40a309] | 132 | */
|
---|
[7258c6a] | 133 |
|
---|
[f40a309] | 134 | int16_t rd_iwsn(int16_t nn)
|
---|
| 135 | {
|
---|
| 136 | register int16_t m, n;
|
---|
| 137 |
|
---|
| 138 | m = (nn >> 8) & 0x00FF;
|
---|
| 139 | n = nn & 0x00FF;
|
---|
| 140 |
|
---|
| 141 | sprintf(dspbuf, "%02d", m ? vbufs[curvce].idhwsb + 1
|
---|
| 142 | : vbufs[curvce].idhwsa + 1);
|
---|
| 143 |
|
---|
| 144 | vbank(0);
|
---|
| 145 |
|
---|
| 146 | vcputsv(instob, 64, (m ? WSBFC : WSAFC), idbox[n][5],
|
---|
| 147 | cfetp->frow, cfetp->flcol, dspbuf, 14);
|
---|
| 148 |
|
---|
| 149 | return(SUCCESS);
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 | /* |
---|
| 153 |
|
---|
| 154 | */
|
---|
| 155 |
|
---|
| 156 | /*
|
---|
| 157 | =============================================================================
|
---|
[7258c6a] | 158 | nd_iwsn() -- handle new data entry
|
---|
[f40a309] | 159 | =============================================================================
|
---|
[7258c6a] | 160 | */
|
---|
[f40a309] | 161 |
|
---|
| 162 | int16_t nd_iwsn(int16_t nn, int16_t k)
|
---|
| 163 | {
|
---|
| 164 | register int16_t ec, c, n;
|
---|
| 165 |
|
---|
| 166 | n = nn & 0x00FF;
|
---|
| 167 |
|
---|
| 168 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 169 | ebuf[ec] = k + '0'; /* enter new data in buffer */
|
---|
| 170 | ebuf[2] = '\0'; /* make sure string is terminated */
|
---|
| 171 |
|
---|
| 172 | dspbuf[0] = k + '0'; /* setup for display */
|
---|
| 173 | dspbuf[1] = '\0';
|
---|
| 174 |
|
---|
| 175 | vbank(0); /* display the new data */
|
---|
| 176 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5], stcrow, stccol, dspbuf, 14);
|
---|
| 177 |
|
---|
| 178 | advicur(); /* advance cursor */
|
---|
| 179 |
|
---|
| 180 | return(SUCCESS);
|
---|
| 181 | }
|
---|
| 182 |
|
---|