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