| [f40a309] | 1 | /*
|
|---|
| 2 | =============================================================================
|
|---|
| 3 | etmcfn.c -- instrument editor - ws/cf menu field handlers
|
|---|
| 4 | Version 7 -- 1988-08-26 -- 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 dosync(int16_t vce);
|
|---|
| 25 |
|
|---|
| [7258c6a] | 26 | extern uint16_t *instob;
|
|---|
| [f40a309] | 27 |
|
|---|
| [7258c6a] | 28 | extern int16_t curvce;
|
|---|
| 29 | extern int16_t stccol;
|
|---|
| 30 | extern int16_t stcrow;
|
|---|
| 31 | extern int16_t wmcsel;
|
|---|
| 32 | extern int16_t wmctag;
|
|---|
| [f40a309] | 33 |
|
|---|
| [7258c6a] | 34 | extern int8_t dspbuf[];
|
|---|
| [f40a309] | 35 |
|
|---|
| [7258c6a] | 36 | extern int16_t idbox[][8];
|
|---|
| [f40a309] | 37 |
|
|---|
| 38 | extern struct instdef vbufs[];
|
|---|
| 39 |
|
|---|
| 40 | extern struct wstbl wslib[];
|
|---|
| 41 |
|
|---|
| 42 | /* |
|---|
| 43 |
|
|---|
| 44 | */
|
|---|
| 45 |
|
|---|
| 46 | /*
|
|---|
| 47 | =============================================================================
|
|---|
| 48 | et_mcfn() -- load the edit buffer
|
|---|
| 49 | =============================================================================
|
|---|
| 50 | */
|
|---|
| [7258c6a] | 51 |
|
|---|
| [f40a309] | 52 | int16_t et_mcfn(int16_t n)
|
|---|
| 53 | {
|
|---|
| 54 | sprintf(ebuf, "%02d", vbufs[curvce].idhcfg);
|
|---|
| 55 | ebflag = TRUE;
|
|---|
| 56 |
|
|---|
| 57 | return(SUCCESS);
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | /* |
|---|
| 61 |
|
|---|
| 62 | */
|
|---|
| 63 |
|
|---|
| 64 | /*
|
|---|
| 65 | =============================================================================
|
|---|
| 66 | ef_mcfn() -- parse (unload) the edit buffer
|
|---|
| 67 | =============================================================================
|
|---|
| [7258c6a] | 68 | */
|
|---|
| [f40a309] | 69 |
|
|---|
| [7258c6a] | 70 | int16_t ef_mcfn(int16_t n)
|
|---|
| [f40a309] | 71 | {
|
|---|
| 72 | register int16_t tmpval;
|
|---|
| 73 |
|
|---|
| 74 | wmctag = FALSE;
|
|---|
| 75 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
|---|
| 76 | ebflag = FALSE;
|
|---|
| 77 |
|
|---|
| 78 | tmpval = ((ebuf[0] - '0') * 10) + (ebuf[1] - '0');
|
|---|
| 79 |
|
|---|
| 80 | if (tmpval GE NUMCFG) /* check against limit */
|
|---|
| 81 | return(FAILURE);
|
|---|
| 82 |
|
|---|
| 83 | vbufs[curvce].idhcfg = tmpval;
|
|---|
| 84 | dosync(curvce);
|
|---|
| 85 | wmctag = TRUE;
|
|---|
| 86 | return(SUCCESS);
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | /* |
|---|
| 90 |
|
|---|
| 91 | */
|
|---|
| 92 |
|
|---|
| 93 | /*
|
|---|
| 94 | =============================================================================
|
|---|
| 95 | rd_mcfn() -- (re)display the field
|
|---|
| [7258c6a] | 96 | =============================================================================
|
|---|
| [f40a309] | 97 | */
|
|---|
| 98 |
|
|---|
| 99 | int16_t rd_mcfn(int16_t n)
|
|---|
| 100 | {
|
|---|
| 101 | sprintf(dspbuf, "%02d", vbufs[curvce].idhcfg);
|
|---|
| 102 |
|
|---|
| 103 | if (v_regs[5] & 0x0180)
|
|---|
| 104 | vbank(0);
|
|---|
| 105 |
|
|---|
| 106 | vcputsv(instob, 64, CFBX18, CBBX18, 24, 16, dspbuf, 14);
|
|---|
| 107 |
|
|---|
| 108 | return(SUCCESS);
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 | /* |
|---|
| 112 |
|
|---|
| 113 | */
|
|---|
| 114 |
|
|---|
| 115 | /*
|
|---|
| 116 | =============================================================================
|
|---|
| [7258c6a] | 117 | nd_mcfn() -- handle new data entry
|
|---|
| [f40a309] | 118 | =============================================================================
|
|---|
| [7258c6a] | 119 | */
|
|---|
| [f40a309] | 120 |
|
|---|
| 121 | int16_t nd_mcfn(int16_t n, int16_t k)
|
|---|
| 122 | {
|
|---|
| 123 | register int16_t ec, c;
|
|---|
| 124 |
|
|---|
| 125 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
|---|
| 126 | ebuf[ec] = k + '0'; /* enter new data in buffer */
|
|---|
| 127 | ebuf[2] = '\0'; /* make sure string is terminated */
|
|---|
| 128 |
|
|---|
| 129 | dspbuf[0] = k + '0'; /* setup for display */
|
|---|
| 130 | dspbuf[1] = '\0';
|
|---|
| 131 |
|
|---|
| 132 | if (v_regs[5] & 0x0180)
|
|---|
| 133 | vbank(0);
|
|---|
| 134 |
|
|---|
| 135 | /* display the new data */
|
|---|
| 136 |
|
|---|
| 137 | vcputsv(instob, 64, ID_ENTRY, CBBX18, stcrow, stccol, dspbuf, 14);
|
|---|
| 138 |
|
|---|
| 139 | advicur(); /* advance cursor */
|
|---|
| 140 |
|
|---|
| 141 | return(SUCCESS);
|
|---|
| 142 | }
|
|---|
| 143 |
|
|---|
| 144 | /* |
|---|
| 145 |
|
|---|
| 146 | */
|
|---|
| 147 |
|
|---|
| 148 | /*
|
|---|
| [7258c6a] | 149 | =============================================================================
|
|---|
| [f40a309] | 150 | et_mwsn() -- load the edit buffer
|
|---|
| 151 | =============================================================================
|
|---|
| 152 | */
|
|---|
| 153 |
|
|---|
| 154 | int16_t et_mwsn(int16_t nn)
|
|---|
| 155 | {
|
|---|
| 156 | wmcsel = (nn & 0xFF00) ? 1 : 0;
|
|---|
| 157 |
|
|---|
| 158 | sprintf(ebuf, "%02d", 1 + (wmcsel ? vbufs[curvce].idhwsb
|
|---|
| 159 | : vbufs[curvce].idhwsa));
|
|---|
| 160 |
|
|---|
| 161 | ebflag = TRUE;
|
|---|
| 162 |
|
|---|
| 163 | return(SUCCESS);
|
|---|
| 164 | }
|
|---|
| 165 |
|
|---|
| 166 | /* |
|---|
| 167 |
|
|---|
| 168 | */
|
|---|
| 169 |
|
|---|
| [7258c6a] | 170 | /*
|
|---|
| [f40a309] | 171 | =============================================================================
|
|---|
| [7258c6a] | 172 | ef_mwsn() -- parse (unload) the edit buffer
|
|---|
| 173 | =============================================================================
|
|---|
| [f40a309] | 174 | */
|
|---|
| 175 |
|
|---|
| 176 | int16_t ef_mwsn(int16_t nn)
|
|---|
| 177 | {
|
|---|
| 178 | register int16_t tmpval;
|
|---|
| 179 | register int16_t *fpuws;
|
|---|
| 180 |
|
|---|
| 181 | wmcsel = (nn & 0xFF00) ? 1 : 0;
|
|---|
| 182 |
|
|---|
| 183 | wmctag = FALSE;
|
|---|
| 184 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
|---|
| 185 | ebflag = FALSE;
|
|---|
| 186 |
|
|---|
| 187 | /* convert from ASCII to binary */
|
|---|
| 188 |
|
|---|
| 189 | tmpval = ((ebuf[0] -'0') * 10) + (ebuf[1] - '0');
|
|---|
| 190 |
|
|---|
| 191 | if ((tmpval < 1) OR (tmpval > NUMWAVS))
|
|---|
| 192 | return(FAILURE);
|
|---|
| 193 | /* |
|---|
| 194 |
|
|---|
| 195 | */
|
|---|
| 196 | if (wmcsel) {
|
|---|
| 197 |
|
|---|
| 198 | /* slot B */
|
|---|
| 199 | vbufs[curvce].idhwsb = tmpval - 1;
|
|---|
| 200 |
|
|---|
| 201 | memcpyw(vbufs[curvce].idhwvbf, &wslib[tmpval - 1],
|
|---|
| 202 | NUMHARM + (2 * NUMWPNT));
|
|---|
| 203 |
|
|---|
| 204 | fpuws = io_fpu + FPU_OWST + (curvce << 9) + 1;
|
|---|
| 205 |
|
|---|
| 206 | memcpyw(fpuws, vbufs[curvce].idhwvbf, NUMWPNT);
|
|---|
| 207 |
|
|---|
| 208 | *(fpuws - 1) = vbufs[curvce].idhwvbf[0];
|
|---|
| 209 | *(fpuws + NUMWPNT) = vbufs[curvce].idhwvbf[NUMWPNT - 1];
|
|---|
| 210 |
|
|---|
| 211 | } else {
|
|---|
| 212 |
|
|---|
| 213 | /* slot A */
|
|---|
| 214 |
|
|---|
| 215 | vbufs[curvce].idhwsa = tmpval - 1;
|
|---|
| 216 |
|
|---|
| 217 | memcpyw(vbufs[curvce].idhwvaf, &wslib[tmpval - 1],
|
|---|
| 218 | NUMHARM + (2 * NUMWPNT));
|
|---|
| 219 |
|
|---|
| 220 | fpuws = io_fpu + FPU_OWST + (curvce << 9) + 0x100 + 1;
|
|---|
| 221 |
|
|---|
| 222 | memcpyw(fpuws, vbufs[curvce].idhwvaf, NUMWPNT);
|
|---|
| 223 |
|
|---|
| 224 | *(fpuws - 1) = vbufs[curvce].idhwvaf[0];
|
|---|
| 225 | *(fpuws + NUMWPNT) = vbufs[curvce].idhwvaf[NUMWPNT - 1];
|
|---|
| 226 | }
|
|---|
| 227 |
|
|---|
| 228 | wmctag = TRUE;
|
|---|
| 229 | return(SUCCESS);
|
|---|
| 230 | }
|
|---|
| 231 |
|
|---|
| 232 | /* |
|---|
| 233 |
|
|---|
| [7258c6a] | 234 | */
|
|---|
| [f40a309] | 235 |
|
|---|
| 236 | /*
|
|---|
| 237 | =============================================================================
|
|---|
| 238 | rd_mwsn() -- (re)display the field
|
|---|
| 239 | =============================================================================
|
|---|
| 240 | */
|
|---|
| 241 |
|
|---|
| 242 | int16_t rd_mwsn(int16_t nn)
|
|---|
| 243 | {
|
|---|
| 244 | wmcsel = (nn & 0xFF00) ? 1 : 0;
|
|---|
| 245 |
|
|---|
| 246 | sprintf(dspbuf, "%02d", 1 + (wmcsel ? vbufs[curvce].idhwsb
|
|---|
| 247 | : vbufs[curvce].idhwsa));
|
|---|
| 248 |
|
|---|
| 249 | if (v_regs[5] & 0x0180)
|
|---|
| 250 | vbank(0);
|
|---|
| 251 |
|
|---|
| 252 | vcputsv(instob, 64, CFBX23, CBBX23, 24, wmcsel ? 16 : 12, dspbuf, 14);
|
|---|
| 253 |
|
|---|
| 254 | return(SUCCESS);
|
|---|
| 255 | }
|
|---|
| 256 |
|
|---|
| 257 | /* |
|---|
| [7258c6a] | 258 |
|
|---|
| [f40a309] | 259 | */
|
|---|
| [7258c6a] | 260 |
|
|---|
| [f40a309] | 261 | /*
|
|---|
| 262 | =============================================================================
|
|---|
| 263 | nd_mwsn() -- handle new data entry
|
|---|
| 264 | =============================================================================
|
|---|
| 265 | */
|
|---|
| 266 |
|
|---|
| 267 | int16_t nd_mwsn(int16_t nn, int16_t k)
|
|---|
| 268 | {
|
|---|
| 269 | register int16_t ec, c;
|
|---|
| 270 |
|
|---|
| 271 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
|---|
| 272 | ebuf[ec] = k + '0'; /* enter new data in buffer */
|
|---|
| 273 | ebuf[2] = '\0'; /* make sure string is terminated */
|
|---|
| 274 |
|
|---|
| 275 | dspbuf[0] = k + '0'; /* setup for display */
|
|---|
| 276 | dspbuf[1] = '\0';
|
|---|
| 277 |
|
|---|
| 278 | if (v_regs[5] & 0x0180)
|
|---|
| 279 | vbank(0); /* display the new data */
|
|---|
| 280 |
|
|---|
| 281 | vcputsv(instob, 64, ID_ENTRY, CBBX23, stcrow, stccol, dspbuf, 14);
|
|---|
| 282 |
|
|---|
| 283 | advicur(); /* advance cursor */
|
|---|
| 284 |
|
|---|
| 285 | return(SUCCESS);
|
|---|
| 286 | }
|
|---|