[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 |
|
---|
[6262b5c] | 8 | #include "all.h"
|
---|
[e225e77] | 9 |
|
---|
| 10 | extern void advicur(void);
|
---|
| 11 | extern void dosync(int16_t vce);
|
---|
| 12 |
|
---|
[7258c6a] | 13 | extern uint16_t *instob;
|
---|
[f40a309] | 14 |
|
---|
[7258c6a] | 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;
|
---|
[f40a309] | 20 |
|
---|
[7258c6a] | 21 | extern int8_t dspbuf[];
|
---|
[f40a309] | 22 |
|
---|
[7258c6a] | 23 | extern int16_t idbox[][8];
|
---|
[f40a309] | 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 | */
|
---|
[7258c6a] | 38 |
|
---|
[f40a309] | 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 | =============================================================================
|
---|
[7258c6a] | 55 | */
|
---|
[f40a309] | 56 |
|
---|
[7258c6a] | 57 | int16_t ef_mcfn(int16_t n)
|
---|
[f40a309] | 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
|
---|
[7258c6a] | 83 | =============================================================================
|
---|
[f40a309] | 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 | =============================================================================
|
---|
[7258c6a] | 104 | nd_mcfn() -- handle new data entry
|
---|
[f40a309] | 105 | =============================================================================
|
---|
[7258c6a] | 106 | */
|
---|
[f40a309] | 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 | /*
|
---|
[7258c6a] | 136 | =============================================================================
|
---|
[f40a309] | 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 |
|
---|
[7258c6a] | 157 | /*
|
---|
[f40a309] | 158 | =============================================================================
|
---|
[7258c6a] | 159 | ef_mwsn() -- parse (unload) the edit buffer
|
---|
| 160 | =============================================================================
|
---|
[f40a309] | 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 |
|
---|
[7258c6a] | 221 | */
|
---|
[f40a309] | 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 | /* |
---|
[7258c6a] | 245 |
|
---|
[f40a309] | 246 | */
|
---|
[7258c6a] | 247 |
|
---|
[f40a309] | 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 |
|
---|
[6262b5c] | 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 |
|
---|