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