[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etioas.c -- line 17 field handlers (I/O Assignment thru Interpolate)
|
---|
| 4 | Version 12 -- 1988-08-22 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[b28a12e] | 8 | #include "ram.h"
|
---|
[f40a309] | 9 |
|
---|
| 10 | /*
|
---|
| 11 | =============================================================================
|
---|
| 12 | Assignment table field handlers
|
---|
| 13 | =============================================================================
|
---|
| 14 | */
|
---|
| 15 |
|
---|
| 16 | /*
|
---|
| 17 | =============================================================================
|
---|
| 18 | et_ioas() -- load edit buffer
|
---|
| 19 | =============================================================================
|
---|
| 20 | */
|
---|
| 21 |
|
---|
[7258c6a] | 22 | int16_t et_ioas(int16_t n)
|
---|
[f40a309] | 23 | {
|
---|
| 24 | sprintf(ebuf, "%02.2d", curasg);
|
---|
| 25 | ebflag = TRUE;
|
---|
| 26 |
|
---|
| 27 | return(SUCCESS);
|
---|
| 28 | }
|
---|
| 29 |
|
---|
[fa38804] | 30 |
|
---|
[f40a309] | 31 | /*
|
---|
| 32 | =============================================================================
|
---|
| 33 | ef_ioas() -- parse edit buffer
|
---|
| 34 | =============================================================================
|
---|
| 35 | */
|
---|
| 36 |
|
---|
[7258c6a] | 37 | int16_t ef_ioas(int16_t n)
|
---|
[f40a309] | 38 | {
|
---|
[7258c6a] | 39 | register int16_t ival;
|
---|
[f40a309] | 40 | register struct s_entry *ep;
|
---|
| 41 |
|
---|
| 42 | ebuf[2] = '\0';
|
---|
| 43 | ival = ((ebuf[0] - '0') * 10) + (ebuf[1] - '0');
|
---|
| 44 |
|
---|
| 45 | ebflag = FALSE;
|
---|
| 46 |
|
---|
| 47 | if (ival GE NASGS)
|
---|
| 48 | return(FAILURE);
|
---|
| 49 |
|
---|
| 50 | getasg(curasg = ival);
|
---|
| 51 | mpcupd();
|
---|
| 52 |
|
---|
| 53 | if (recsw) {
|
---|
| 54 |
|
---|
| 55 | if (E_NULL NE (ep = findev(p_cur, t_cur, EV_ASGN, -1, -1))) {
|
---|
| 56 |
|
---|
| 57 | ep->e_data1 = ival;
|
---|
| 58 |
|
---|
| 59 | } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
|
---|
| 60 |
|
---|
| 61 | ep->e_type = EV_ASGN;
|
---|
| 62 | ep->e_data1 = ival;
|
---|
| 63 | ep->e_time = t_cur;
|
---|
| 64 | p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
|
---|
| 65 | eh_ins(ep, EH_ASGN);
|
---|
| 66 | ctrsw = TRUE;
|
---|
| 67 | se_disp(ep, D_FWD, gdstbc, 1);
|
---|
| 68 | scupd();
|
---|
| 69 | }
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | return(SUCCESS);
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | /*
|
---|
| 76 | =============================================================================
|
---|
| 77 | rd_ioas() -- (re)display the field
|
---|
| 78 | =============================================================================
|
---|
| 79 | */
|
---|
| 80 |
|
---|
[7258c6a] | 81 | int16_t rd_ioas(int16_t n)
|
---|
[f40a309] | 82 | {
|
---|
| 83 | sprintf(dspbuf, "%02.2d", curasg);
|
---|
| 84 |
|
---|
| 85 | if (v_regs[5] & 0x0180)
|
---|
| 86 | vbank(0);
|
---|
| 87 |
|
---|
| 88 | vputs(obj8, 1, 11, dspbuf, SDW04ATR);
|
---|
| 89 | return(SUCCESS);
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | /*
|
---|
| 93 | =============================================================================
|
---|
| 94 | nd_ioas() -- data entry function
|
---|
| 95 | =============================================================================
|
---|
| 96 | */
|
---|
| 97 |
|
---|
[7258c6a] | 98 | int16_t nd_ioas(int16_t n, int16_t k)
|
---|
[f40a309] | 99 | {
|
---|
[7258c6a] | 100 | register int16_t ec;
|
---|
[f40a309] | 101 |
|
---|
| 102 | ec = stccol - cfetp->flcol;
|
---|
| 103 | ebuf[ec] = k + '0';
|
---|
| 104 |
|
---|
| 105 | if (v_regs[5] & 0x0180)
|
---|
| 106 | vbank(0);
|
---|
| 107 |
|
---|
| 108 | vputc(obj8, 1, stccol, k + '0', SDW04DEA);
|
---|
| 109 | advscur();
|
---|
| 110 | return(SUCCESS);
|
---|
| 111 | }
|
---|
| 112 |
|
---|
| 113 | /*
|
---|
| 114 | =============================================================================
|
---|
| 115 | Tuning field handlers
|
---|
| 116 | =============================================================================
|
---|
| 117 | */
|
---|
| 118 |
|
---|
| 119 | /*
|
---|
| 120 | =============================================================================
|
---|
| 121 | et_tune() -- load edit buffer
|
---|
| 122 | =============================================================================
|
---|
| 123 | */
|
---|
| 124 |
|
---|
[7258c6a] | 125 | int16_t et_tune(int16_t n)
|
---|
[f40a309] | 126 | {
|
---|
| 127 | ebuf[0] = '0' + curtun;
|
---|
| 128 | ebuf[1] = '\0';
|
---|
| 129 | ebflag = TRUE;
|
---|
| 130 | return(SUCCESS);
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 | /*
|
---|
| 134 | =============================================================================
|
---|
| 135 | ef_tune() -- parse edit buffer
|
---|
| 136 | =============================================================================
|
---|
| 137 | */
|
---|
| 138 |
|
---|
[7258c6a] | 139 | int16_t ef_tune(int16_t n)
|
---|
[f40a309] | 140 | {
|
---|
[7258c6a] | 141 | register int16_t ival;
|
---|
[f40a309] | 142 | register struct s_entry *ep;
|
---|
| 143 |
|
---|
| 144 | ebuf[1] = '\0';
|
---|
| 145 | ival = ebuf[0] - '0';
|
---|
| 146 | ebflag = FALSE;
|
---|
| 147 | gettun(ival);
|
---|
| 148 |
|
---|
| 149 | if (recsw) {
|
---|
| 150 |
|
---|
| 151 | if (E_NULL NE (ep = findev(p_cur, t_cur, EV_TUNE, -1, -1))) {
|
---|
| 152 |
|
---|
| 153 | ep->e_data1 = ival;
|
---|
| 154 |
|
---|
| 155 | } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
|
---|
| 156 |
|
---|
| 157 | ep->e_type = EV_TUNE;
|
---|
| 158 | ep->e_data1 = ival;
|
---|
| 159 | ep->e_time = t_cur;
|
---|
| 160 | p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
|
---|
| 161 | eh_ins(ep, EH_TUNE);
|
---|
| 162 | ctrsw = TRUE;
|
---|
| 163 | se_disp(ep, D_FWD, gdstbc, 1);
|
---|
| 164 | scupd();
|
---|
| 165 | }
|
---|
| 166 | }
|
---|
| 167 |
|
---|
| 168 | return(SUCCESS);
|
---|
| 169 | }
|
---|
| 170 |
|
---|
| 171 | /*
|
---|
| 172 | =============================================================================
|
---|
| 173 | rd_tune() -- (re)display the field
|
---|
| 174 | =============================================================================
|
---|
| 175 | */
|
---|
| 176 |
|
---|
[7258c6a] | 177 | int16_t rd_tune(int16_t n)
|
---|
[f40a309] | 178 | {
|
---|
| 179 | if (v_regs[5] & 0x0180)
|
---|
| 180 | vbank(0);
|
---|
| 181 |
|
---|
| 182 | vputc(obj8, 1, 19, curtun + '0', SDW05ATR);
|
---|
| 183 |
|
---|
| 184 | return(SUCCESS);
|
---|
| 185 | }
|
---|
| 186 |
|
---|
| 187 | /*
|
---|
| 188 | =============================================================================
|
---|
| 189 | nd_tune() -- data entry function
|
---|
| 190 | =============================================================================
|
---|
| 191 | */
|
---|
| 192 |
|
---|
[7258c6a] | 193 | int16_t nd_tune(int16_t n, int16_t k)
|
---|
[f40a309] | 194 | {
|
---|
[7258c6a] | 195 | register int16_t ec;
|
---|
[f40a309] | 196 |
|
---|
| 197 | ebuf[0] = k + '0';
|
---|
| 198 |
|
---|
| 199 | if (v_regs[5] & 0x0180)
|
---|
| 200 | vbank(0);
|
---|
| 201 |
|
---|
| 202 | vputc(obj8, 1, stccol, k + '0', SDW05DEA);
|
---|
| 203 |
|
---|
| 204 | return(SUCCESS);
|
---|
| 205 | }
|
---|
| 206 |
|
---|
| 207 | /*
|
---|
| 208 | =============================================================================
|
---|
| 209 | Tempo field handlers
|
---|
| 210 | =============================================================================
|
---|
| 211 | */
|
---|
| 212 |
|
---|
| 213 | /*
|
---|
| 214 | =============================================================================
|
---|
| 215 | et_tmpo() -- load edit buffer
|
---|
| 216 | =============================================================================
|
---|
| 217 | */
|
---|
| 218 |
|
---|
[7258c6a] | 219 | int16_t et_tmpo(int16_t n)
|
---|
[f40a309] | 220 | {
|
---|
| 221 | sprintf(ebuf, "%03.3d", tmpoval);
|
---|
| 222 | ebflag = TRUE;
|
---|
| 223 |
|
---|
| 224 | return(SUCCESS);
|
---|
| 225 | }
|
---|
| 226 |
|
---|
| 227 | /*
|
---|
| 228 | =============================================================================
|
---|
| 229 | ef_tmpo() -- parse edit buffer
|
---|
| 230 | =============================================================================
|
---|
| 231 | */
|
---|
| 232 |
|
---|
[7258c6a] | 233 | int16_t ef_tmpo(int16_t n)
|
---|
[f40a309] | 234 | {
|
---|
[7258c6a] | 235 | register int16_t ival;
|
---|
[f40a309] | 236 | register struct s_entry *ep;
|
---|
| 237 |
|
---|
| 238 | ebuf[3] = '\0';
|
---|
| 239 | ival = ((ebuf[0] - '0') * 100) + ((ebuf[1] - '0') * 10)
|
---|
| 240 | + (ebuf[2] - '0');
|
---|
| 241 |
|
---|
| 242 | ebflag = FALSE;
|
---|
| 243 |
|
---|
| 244 | if ((ival GT 240) OR (ival LT 4))
|
---|
| 245 | return(FAILURE);
|
---|
| 246 |
|
---|
| 247 | settmpo(ival);
|
---|
| 248 |
|
---|
| 249 | if (recsw) {
|
---|
| 250 |
|
---|
| 251 | if (E_NULL NE (ep = findev(p_cur, t_cur, EV_TMPO, -1, -1))) {
|
---|
| 252 |
|
---|
| 253 | ep->e_data1 = ival;
|
---|
| 254 |
|
---|
| 255 | } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
|
---|
| 256 |
|
---|
| 257 | ep->e_type = EV_TMPO;
|
---|
| 258 | ep->e_data1 = ival;
|
---|
| 259 | ep->e_time = t_cur;
|
---|
| 260 | p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
|
---|
| 261 | eh_ins(ep, EH_TMPO);
|
---|
| 262 | ctrsw = TRUE;
|
---|
| 263 | se_disp(ep, D_FWD, gdstbc, 1);
|
---|
| 264 | scupd();
|
---|
| 265 | }
|
---|
| 266 | }
|
---|
| 267 |
|
---|
| 268 | return(SUCCESS);
|
---|
| 269 | }
|
---|
| 270 |
|
---|
| 271 | /*
|
---|
| 272 | =============================================================================
|
---|
| 273 | rd_tmpo() -- (re)display the field
|
---|
| 274 | =============================================================================
|
---|
| 275 | */
|
---|
| 276 |
|
---|
[7258c6a] | 277 | int16_t rd_tmpo(int16_t n)
|
---|
[f40a309] | 278 | {
|
---|
| 279 | sprintf(dspbuf, "%03.3d", tmpoval);
|
---|
| 280 |
|
---|
| 281 | if (v_regs[5] & 0x0180)
|
---|
| 282 | vbank(0);
|
---|
| 283 |
|
---|
| 284 | vputs(obj8, 1, 27, dspbuf, SDW06ATR);
|
---|
| 285 |
|
---|
| 286 | return(SUCCESS);
|
---|
| 287 | }
|
---|
| 288 |
|
---|
| 289 | /*
|
---|
| 290 | =============================================================================
|
---|
| 291 | nd_tmpo() -- data entry function
|
---|
| 292 | =============================================================================
|
---|
| 293 | */
|
---|
| 294 |
|
---|
[7258c6a] | 295 | int16_t nd_tmpo(int16_t n, int16_t k)
|
---|
[f40a309] | 296 | {
|
---|
[7258c6a] | 297 | register int16_t ec;
|
---|
[f40a309] | 298 |
|
---|
| 299 | ec = stccol - cfetp->flcol;
|
---|
| 300 | ebuf[ec] = k + '0';
|
---|
| 301 |
|
---|
| 302 | if (v_regs[5] & 0x0180)
|
---|
| 303 | vbank(0);
|
---|
| 304 |
|
---|
| 305 | vputc(obj8, 1, stccol, k + '0', SDW06DEA);
|
---|
| 306 | advscur();
|
---|
| 307 |
|
---|
| 308 | return(SUCCESS);
|
---|
| 309 | }
|
---|
| 310 |
|
---|
| 311 | /*
|
---|
| 312 | =============================================================================
|
---|
| 313 | Interpolate field handlers
|
---|
| 314 | =============================================================================
|
---|
| 315 | */
|
---|
| 316 |
|
---|
| 317 | /*
|
---|
| 318 | =============================================================================
|
---|
| 319 | et_intp() -- load edit buffer
|
---|
| 320 | =============================================================================
|
---|
| 321 | */
|
---|
| 322 |
|
---|
[7258c6a] | 323 | int16_t et_intp(int16_t n)
|
---|
[f40a309] | 324 | {
|
---|
[7258c6a] | 325 | register int16_t th, tl;
|
---|
| 326 | register int32_t tt, sc, sf;
|
---|
[f40a309] | 327 |
|
---|
| 328 | sc = 1000L;
|
---|
| 329 | sf = 100L;
|
---|
| 330 | tt = fromfpu(curintp);
|
---|
| 331 | th = tt / sc;
|
---|
| 332 | tl = (tt - (th * sc)) / sf;
|
---|
| 333 |
|
---|
| 334 | sprintf(ebuf, "%02d.%d", th, tl);
|
---|
| 335 | ebflag = TRUE;
|
---|
| 336 |
|
---|
| 337 | return(SUCCESS);
|
---|
| 338 | }
|
---|
| 339 |
|
---|
| 340 | /*
|
---|
| 341 | =============================================================================
|
---|
| 342 | ef_intp() -- parse edit buffer
|
---|
| 343 | =============================================================================
|
---|
| 344 | */
|
---|
| 345 |
|
---|
[7258c6a] | 346 | int16_t ef_intp(int16_t n)
|
---|
[f40a309] | 347 | {
|
---|
[7258c6a] | 348 | register int16_t i;
|
---|
| 349 | register uint16_t tmpval;
|
---|
[f40a309] | 350 | register struct s_entry *ep;
|
---|
| 351 |
|
---|
| 352 | ebuf[2] = '.'; /* add implied decimal point */
|
---|
| 353 | ebuf[4] = '\0'; /* terminate the string in ebuf */
|
---|
| 354 | ebflag = FALSE;
|
---|
| 355 | tmpval = 0;
|
---|
| 356 |
|
---|
| 357 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
| 358 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 359 |
|
---|
| 360 | tmpval = ((tmpval * 10) + (ebuf[3] - '0')) * 100;
|
---|
| 361 |
|
---|
[7258c6a] | 362 | if (tmpval > (uint16_t)64900)
|
---|
[f40a309] | 363 | return(FAILURE);
|
---|
| 364 |
|
---|
| 365 | if (tmpval EQ 0)
|
---|
| 366 | tmpval = 1;
|
---|
| 367 |
|
---|
| 368 | curintp = tofpu(tmpval);
|
---|
| 369 |
|
---|
| 370 | if (recsw) {
|
---|
| 371 |
|
---|
| 372 | if (E_NULL NE (ep = findev(p_cur, t_cur, EV_INTP, -1, -1))) {
|
---|
| 373 |
|
---|
| 374 | ep->e_data1 = (curintp >> 8);
|
---|
| 375 | ep->e_data2 = 0x00FF & curintp;
|
---|
| 376 |
|
---|
| 377 | } else if (E_NULL NE (ep = e_alc(E_SIZE3))) {
|
---|
| 378 |
|
---|
| 379 | ep->e_type = EV_INTP;
|
---|
| 380 | ep->e_time = t_cur;
|
---|
| 381 | ep->e_data1 = (curintp >> 8);
|
---|
| 382 | ep->e_data2 = 0x00FF & curintp;
|
---|
| 383 | p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
|
---|
| 384 | eh_ins(ep, EH_INTP);
|
---|
| 385 | ctrsw = TRUE;
|
---|
| 386 | se_disp(ep, D_FWD, gdstbc, 1);
|
---|
| 387 | scupd();
|
---|
| 388 | }
|
---|
| 389 | }
|
---|
| 390 |
|
---|
| 391 | return(SUCCESS);
|
---|
| 392 | }
|
---|
| 393 |
|
---|
| 394 | /*
|
---|
| 395 | =============================================================================
|
---|
| 396 | rd_intp() -- (re)display the field
|
---|
| 397 | =============================================================================
|
---|
| 398 | */
|
---|
| 399 |
|
---|
[7258c6a] | 400 | int16_t rd_intp(int16_t n)
|
---|
[f40a309] | 401 | {
|
---|
[7258c6a] | 402 | register int16_t th, tl;
|
---|
| 403 | register int32_t tt, sc, sf;
|
---|
[f40a309] | 404 |
|
---|
| 405 | sc = 1000L;
|
---|
| 406 | sf = 100L;
|
---|
| 407 | tt = fromfpu(curintp);
|
---|
| 408 | th = tt / sc;
|
---|
| 409 | tl = (tt - (th * sc)) / sf;
|
---|
| 410 |
|
---|
| 411 | sprintf(dspbuf, "%02d.%d", th, tl); /* convert to ASCII */
|
---|
| 412 |
|
---|
| 413 | vbank(0); /* display the value */
|
---|
| 414 |
|
---|
| 415 | vputs(obj8, 1, 35, dspbuf, SDW07ATR);
|
---|
| 416 |
|
---|
| 417 | return(SUCCESS);
|
---|
| 418 | }
|
---|
| 419 |
|
---|
| 420 | /*
|
---|
| 421 | =============================================================================
|
---|
| 422 | nd_intp() -- data entry function
|
---|
| 423 | =============================================================================
|
---|
| 424 | */
|
---|
| 425 |
|
---|
[7258c6a] | 426 | int16_t nd_intp(int16_t n, int16_t k)
|
---|
[f40a309] | 427 | {
|
---|
[7258c6a] | 428 | register int16_t ec;
|
---|
[f40a309] | 429 |
|
---|
| 430 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 431 |
|
---|
| 432 | if (ec EQ 2)
|
---|
| 433 | return(FAILURE);
|
---|
| 434 |
|
---|
| 435 | if ((ec EQ 0) AND (k > 6))
|
---|
| 436 | return(FAILURE);
|
---|
| 437 |
|
---|
| 438 | if ((ec EQ 1) AND (ebuf[0] EQ '6') AND (k > 4))
|
---|
| 439 | return(FAILURE);
|
---|
| 440 |
|
---|
| 441 | ebuf[ec] = k + '0';
|
---|
| 442 | ebuf[2] = '.';
|
---|
| 443 | ebuf[4] = '\0';
|
---|
| 444 |
|
---|
| 445 | dspbuf[0] = k + '0';
|
---|
| 446 | dspbuf[1] = '\0';
|
---|
| 447 |
|
---|
| 448 | vbank(0);
|
---|
| 449 |
|
---|
| 450 | vputs(obj8, 1, stccol, dspbuf, SDW07DEA);
|
---|
| 451 |
|
---|
| 452 | advscur();
|
---|
| 453 |
|
---|
| 454 | if (stccol EQ 37)
|
---|
| 455 | advscur();
|
---|
| 456 |
|
---|
| 457 | return(SUCCESS);
|
---|
| 458 | }
|
---|
[6262b5c] | 459 |
|
---|