[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | idfield.c -- instrument display field processing and cursor motion
|
---|
| 4 | Version 89 -- 1989-11-15 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[b28a12e] | 8 | #include "ram.h"
|
---|
[f40a309] | 9 |
|
---|
[7258c6a] | 10 | int16_t zonemax[9] = { 63, 119, 175, 231, 287, 343, 399, 455, 509};
|
---|
[f40a309] | 11 |
|
---|
[7258c6a] | 12 | int16_t zoneinc[9] = { 2, 2, 4, 9, 18, 36, 73, 146, 303};
|
---|
[f40a309] | 13 |
|
---|
| 14 | struct fet id_fet1[] = {
|
---|
| 15 |
|
---|
| 16 | { 5, 62, 62, 12, et_ires, ef_ires, rd_ires, nd_ires},
|
---|
| 17 | {16, 1, 12, 13, et_imlt, ef_imlt, rd_imlt, nd_imlt},
|
---|
| 18 | {16, 15, 16, 14, et_ipnt, ef_ipnt, rd_ipnt, nd_ipnt},
|
---|
| 19 | {16, 19, 24, 15, et_itim, ef_itim, rd_itim, nd_itim},
|
---|
| 20 | {16, 27, 44, 16, et_ival, ef_ival, rd_ival, nd_ival},
|
---|
| 21 | {16, 47, 62, 17, et_iact, ef_iact, rd_iact, nd_iact},
|
---|
| 22 | {17, 12, 13, 18, et_icnf, ef_icnf, rd_icnf, nd_icnf},
|
---|
| 23 | {17, 23, 24, 19, et_ivce, ef_ivce, rd_ivce, nd_ivce},
|
---|
| 24 | {17, 31, 32, 19, et_idin, ef_idin, rd_idin, nd_idin},
|
---|
| 25 | {17, 57, 58, 0x0015, et_iwsn, ef_iwsn, rd_iwsn, nd_iwsn},
|
---|
| 26 | {17, 61, 62, 0x0115, et_iwsn, ef_iwsn, rd_iwsn, nd_iwsn},
|
---|
| 27 | {18, 36, 46, 0x8014, et_iosc, ef_iosc, rd_iosc, nd_iosc},
|
---|
| 28 | {18, 17, 32, 0, et_null, ef_null, rd_null, nd_null},
|
---|
| 29 | {19, 36, 46, 0x8114, et_iosc, ef_iosc, rd_iosc, nd_iosc},
|
---|
| 30 | {19, 17, 32, 0, et_null, ef_null, rd_null, nd_null},
|
---|
| 31 | {20, 36, 46, 0x8214, et_iosc, ef_iosc, rd_iosc, nd_iosc},
|
---|
| 32 | {20, 17, 32, 0, et_null, ef_null, rd_null, nd_null},
|
---|
| 33 | {21, 36, 46, 0x8314, et_iosc, ef_iosc, rd_iosc, nd_iosc},
|
---|
| 34 | {21, 17, 32, 0, et_null, ef_null, rd_null, nd_null},
|
---|
| 35 |
|
---|
| 36 | { 0, 0, 0, 0x0000, FN_NULL, FN_NULL, FN_NULL, FN_NULL}
|
---|
| 37 | };
|
---|
| 38 |
|
---|
[7258c6a] | 39 | int8_t *srctbl[] = { /* source label table */
|
---|
[f40a309] | 40 |
|
---|
| 41 | " ", /* 0 */
|
---|
| 42 | "Random ", /* 1 */
|
---|
| 43 | "GPC/CV1", /* 2 */
|
---|
| 44 | "???????", /* 3 */
|
---|
| 45 | "???????", /* 4 */
|
---|
| 46 | "Pitch ", /* 5 */
|
---|
| 47 | "Key Prs", /* 6 */
|
---|
| 48 | "Key Vel", /* 7 */
|
---|
| 49 | "Pedal 1", /* 8 */
|
---|
| 50 | "???????", /* 9 */
|
---|
| 51 | "Freq ", /* 10 */
|
---|
| 52 | "PchW/HT", /* 11 */
|
---|
| 53 | "ModW/VT", /* 12 */
|
---|
| 54 | "Brth/LP", /* 13 */
|
---|
| 55 | };
|
---|
| 56 |
|
---|
| 57 | struct curpak id_flds = {
|
---|
| 58 |
|
---|
| 59 | stdctp1, /* curtype */
|
---|
| 60 | nokey, /* premove */
|
---|
| 61 | nokey, /* pstmove */
|
---|
| 62 | cxkstd, /* cx_key */
|
---|
| 63 | cykstd, /* cy_key */
|
---|
| 64 | idcxupd, /* cx_upd */
|
---|
| 65 | idcyupd, /* cy_upd */
|
---|
| 66 | ikyup, /* xy_up */
|
---|
| 67 | ikydn, /* xy_dn */
|
---|
| 68 | idx_key, /* x_key */
|
---|
| 69 | select, /* e_key */
|
---|
| 70 | stdmkey, /* m_key */
|
---|
| 71 | stddkey, /* d_key */
|
---|
| 72 | idnfld, /* not_fld */
|
---|
| 73 | id_fet1, /* curfet */
|
---|
| 74 | idboxes, /* csbp */
|
---|
| 75 | crate1, /* cratex */
|
---|
| 76 | crate1, /* cratey */
|
---|
| 77 | CT_GRAF, /* cmtype */
|
---|
| 78 | ICURX, /* cxval */
|
---|
| 79 | ICURY /* cyval */
|
---|
| 80 | };
|
---|
| 81 |
|
---|
| 82 | /*
|
---|
| 83 | =============================================================================
|
---|
| 84 | ikydn() -- process instrument cursor key down
|
---|
| 85 | =============================================================================
|
---|
| 86 | */
|
---|
| 87 |
|
---|
[0580615] | 88 | void ikydn(void)
|
---|
[f40a309] | 89 | {
|
---|
| 90 | imflag = FALSE;
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | /*
|
---|
| 94 | =============================================================================
|
---|
| 95 | ikyup() -- process instrument cursor key up
|
---|
| 96 | =============================================================================
|
---|
| 97 | */
|
---|
| 98 |
|
---|
[0580615] | 99 | void ikyup(void)
|
---|
[f40a309] | 100 | {
|
---|
| 101 | if (imflag)
|
---|
| 102 | modinst();
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | /*
|
---|
| 106 | =============================================================================
|
---|
| 107 | idcyupd() -- update cursor y location from value
|
---|
| 108 | =============================================================================
|
---|
| 109 | */
|
---|
| 110 |
|
---|
[0580615] | 111 | void idcyupd(void)
|
---|
[f40a309] | 112 | {
|
---|
[7258c6a] | 113 | register int16_t pval, vh, vl;
|
---|
[f40a309] | 114 |
|
---|
| 115 | if (wcflag NE -1) /* ws/cf menu page can't be up */
|
---|
| 116 | return;
|
---|
| 117 |
|
---|
| 118 | if (idimsw) /* no y update if instrument menu is up */
|
---|
| 119 | return;
|
---|
| 120 |
|
---|
| 121 | if (idsrcsw OR idcfsw) { /* see if we're in the menu area */
|
---|
| 122 |
|
---|
| 123 | vtcrow = YTOR(vtyval += cyrate);
|
---|
| 124 |
|
---|
| 125 | if (vtcrow > 24)
|
---|
| 126 | vtyval = RTOY(vtcrow = 24);
|
---|
| 127 | else if (vtcrow < 22)
|
---|
| 128 | vtyval = RTOY(vtcrow = 22);
|
---|
| 129 |
|
---|
| 130 | } else if (idnamsw) { /* see if we're in the typewriter */
|
---|
| 131 |
|
---|
| 132 | vtcyupd();
|
---|
| 133 |
|
---|
| 134 | } else if (pntsv) { /* see if we're moving a point */
|
---|
| 135 |
|
---|
| 136 | pval = (pntptr->ipval >> 5) - (cyrate * 7);
|
---|
| 137 |
|
---|
| 138 | if (pval GT 1000) /* limit at +10.00 */
|
---|
| 139 | pval = 1000;
|
---|
| 140 | else if (pval LT 0) /* limit at +00.00 */
|
---|
| 141 | pval = 0;
|
---|
| 142 |
|
---|
| 143 | cyval = vtoy(pval, 12); /* new cursor location */
|
---|
| 144 | pntptr->ipval = pval << 5; /* update function value */
|
---|
| 145 |
|
---|
| 146 | vh = pval / 100; /* display the new value */
|
---|
| 147 | vl = pval - (vh * 100);
|
---|
| 148 |
|
---|
| 149 | sprintf(bfs, "%02d.%02d", vh, vl);
|
---|
| 150 |
|
---|
| 151 | vbank(0);
|
---|
| 152 | vcputsv(instob, 64, idbox[16][4], idbox[16][5],
|
---|
| 153 | idbox[16][6] + 1, idbox[16][7], bfs, 14);
|
---|
| 154 |
|
---|
| 155 | imflag = TRUE;
|
---|
[fa38804] | 156 |
|
---|
[f40a309] | 157 | } else { /* just moving the cursor */
|
---|
| 158 |
|
---|
| 159 | cyval += cyrate;
|
---|
| 160 |
|
---|
| 161 | if (cyval GT (CYMAX - 1))
|
---|
| 162 | cyval = CYMAX - 1;
|
---|
| 163 | else if (cyval LT 1)
|
---|
| 164 | cyval = 1;
|
---|
| 165 | }
|
---|
| 166 | }
|
---|
| 167 |
|
---|
| 168 | /*
|
---|
| 169 | =============================================================================
|
---|
| 170 | idcxupd() -- update cursor x location from time
|
---|
| 171 | =============================================================================
|
---|
| 172 | */
|
---|
| 173 |
|
---|
[0580615] | 174 | void idcxupd(void)
|
---|
[f40a309] | 175 | {
|
---|
[7258c6a] | 176 | register uint16_t th, tl;
|
---|
| 177 | register uint16_t fptime, stime;
|
---|
| 178 | int16_t zone;
|
---|
[f40a309] | 179 |
|
---|
| 180 | if (idimsw) { /* see if instrument menu is up */
|
---|
| 181 |
|
---|
| 182 | cxval += cxrate;
|
---|
| 183 |
|
---|
| 184 | if (cxval > CTOX(32))
|
---|
| 185 | cxval = CTOX(32);
|
---|
| 186 | else if (cxval < CTOX(26))
|
---|
| 187 | cxval = CTOX(26);
|
---|
| 188 |
|
---|
| 189 | } if (idsrcsw OR idcfsw) { /* see if we're in a submenu */
|
---|
| 190 |
|
---|
| 191 | vtccol = XTOC(vtxval += cxrate);
|
---|
| 192 |
|
---|
| 193 | if (vtccol > 46)
|
---|
| 194 | vtxval = CTOX(vtccol = 46);
|
---|
| 195 | else if (vtccol < 17)
|
---|
| 196 | vtxval = CTOX(vtccol = 17);
|
---|
| 197 |
|
---|
| 198 | } else if (idnamsw) { /* see if we're in the typewriter */
|
---|
| 199 |
|
---|
| 200 | vtcxupd();
|
---|
[fa38804] | 201 |
|
---|
[f40a309] | 202 | } else if (pntsv) { /* see if we're moving a point */
|
---|
| 203 |
|
---|
| 204 | for (zone = 0; zone LE 8; zone++) /* find display zone */
|
---|
| 205 | if (cxval LE zonemax[zone])
|
---|
| 206 | break;
|
---|
| 207 |
|
---|
| 208 | switch (pecase) {
|
---|
| 209 |
|
---|
| 210 | case 0: /* single point */
|
---|
| 211 | case 1: /* last point */
|
---|
| 212 |
|
---|
| 213 | if (cxrate GE 0)
|
---|
| 214 | fptime = addfpu(pntptr->iptim,
|
---|
| 215 | cxrate * zoneinc[zone]);
|
---|
| 216 | else
|
---|
| 217 | fptime = subfpu(pntptr->iptim,
|
---|
| 218 | -cxrate * zoneinc[zone]);
|
---|
| 219 |
|
---|
| 220 | stime = segtime(subj, fptime);
|
---|
| 221 |
|
---|
| 222 | if (stime GE temax) {
|
---|
| 223 |
|
---|
| 224 | setseg(subj, temax - 1);
|
---|
| 225 | break;
|
---|
| 226 |
|
---|
| 227 | } else if (stime EQ 0) {
|
---|
| 228 |
|
---|
| 229 | setseg(subj, 1);
|
---|
| 230 | break;
|
---|
| 231 | }
|
---|
| 232 |
|
---|
| 233 | setseg(subj, stime);
|
---|
| 234 | break;
|
---|
| 235 |
|
---|
[fa38804] | 236 |
|
---|
[f40a309] | 237 | case 2: /* interior point */
|
---|
| 238 |
|
---|
| 239 | if (cxrate GE 0)
|
---|
| 240 | fptime = addfpu(pntptr->iptim, cxrate * zoneinc[zone]);
|
---|
| 241 | else
|
---|
| 242 | fptime = subfpu(pntptr->iptim, -cxrate * zoneinc[zone]);
|
---|
| 243 |
|
---|
| 244 | stime = temin + fromfpu(fptime);
|
---|
| 245 |
|
---|
| 246 | if (stime GE temax)
|
---|
| 247 | break;
|
---|
| 248 |
|
---|
| 249 | setseg(subj, segtime(subj, fptime));
|
---|
| 250 | setseg(subj + 1, temax);
|
---|
| 251 | break;
|
---|
| 252 | }
|
---|
| 253 |
|
---|
| 254 | th = timeto(curfunc, subj); /* display the time */
|
---|
| 255 | tl = th - ((th / 1000) * 1000);
|
---|
| 256 | th /= 1000;
|
---|
| 257 |
|
---|
| 258 | sprintf(bfs, "%02d.%03d", th, tl);
|
---|
| 259 |
|
---|
| 260 | if (v_regs[5] & 0x0180)
|
---|
| 261 | vbank(0);
|
---|
| 262 |
|
---|
| 263 | vcputsv(instob, 64, idbox[15][4], idbox[15][5],
|
---|
| 264 | idbox[15][6] + 1, idbox[15][7], bfs, 14);
|
---|
| 265 |
|
---|
| 266 | imflag = TRUE;
|
---|
| 267 | cxval = ttox(timeto(curfunc, subj), 12);
|
---|
| 268 |
|
---|
| 269 | } else { /* just moving the cursor */
|
---|
| 270 |
|
---|
| 271 | cxval += cxrate;
|
---|
| 272 |
|
---|
| 273 | if (cxval GT (CXMAX- 1))
|
---|
| 274 | cxval = CXMAX - 1;
|
---|
| 275 | else if (cxval LT 1)
|
---|
| 276 | cxval = 1;
|
---|
| 277 | }
|
---|
| 278 | }
|
---|
| 279 |
|
---|
| 280 | /*
|
---|
| 281 | =============================================================================
|
---|
| 282 | idnfld() -- process not-in-field key entry
|
---|
| 283 | =============================================================================
|
---|
| 284 | */
|
---|
| 285 |
|
---|
[7258c6a] | 286 | int16_t idnfld(int16_t k)
|
---|
[f40a309] | 287 | {
|
---|
[7258c6a] | 288 | register int16_t endpnt, basepnt, t, fn;
|
---|
[f40a309] | 289 | register struct idfnhdr *fp;
|
---|
| 290 | register struct instdef *ip;
|
---|
| 291 |
|
---|
| 292 | ip = &vbufs[curvce];
|
---|
| 293 | fp = &ip->idhfnc[curfunc];
|
---|
| 294 |
|
---|
| 295 | if (astat) {
|
---|
| 296 |
|
---|
| 297 | if (whatbox()) {
|
---|
| 298 |
|
---|
| 299 | if (hitbox EQ 12) { /* edit window */
|
---|
| 300 |
|
---|
| 301 | if (k EQ 8) { /* - = toggle I_TM_KEY */
|
---|
| 302 |
|
---|
| 303 | t = (fp->idftmd ^= I_TM_KEY);
|
---|
| 304 |
|
---|
| 305 | if (v_regs[5] & 0x0180)
|
---|
| 306 | vbank(0);
|
---|
| 307 |
|
---|
| 308 | tsplot4(instob, 64,
|
---|
| 309 | ((t & I_TM_KEY) ?
|
---|
| 310 | idbox[curfunc][4] : ID_INST),
|
---|
| 311 | 4, 54, idbxlbl[curfunc], 14);
|
---|
| 312 |
|
---|
| 313 | modinst();
|
---|
| 314 | return(SUCCESS);
|
---|
[fa38804] | 315 |
|
---|
[f40a309] | 316 | } else if (k EQ 9) { /* + = new point */
|
---|
| 317 |
|
---|
| 318 | basepnt = fp->idfpt1;
|
---|
| 319 | endpnt = basepnt + fp->idfpif - 1;
|
---|
| 320 |
|
---|
| 321 | if (fp->idfpif EQ 99)
|
---|
| 322 | return(FAILURE);
|
---|
| 323 |
|
---|
| 324 | if (FALSE EQ inspnt(ip, curfunc, endpnt)) {
|
---|
| 325 |
|
---|
| 326 | return(FAILURE);
|
---|
| 327 |
|
---|
| 328 | } else {
|
---|
| 329 |
|
---|
| 330 | subj = fp->idfpif - 1;
|
---|
| 331 | pntsel();
|
---|
| 332 | pntsv = 1;
|
---|
| 333 | memset(pntptr, 0, sizeof (struct instpnt));
|
---|
| 334 | pntptr->ipval = (pntptr -1)->ipval;
|
---|
| 335 | setseg(subj, timeto(curfunc, subj - 1) + 1);
|
---|
| 336 | edfunc(curfunc);
|
---|
| 337 | showpt(1);
|
---|
| 338 | cxval = ttox(timeto(curfunc, subj), 12);
|
---|
| 339 | cyval = vtoy((pntptr->ipval >> 5), 12);
|
---|
| 340 | arcurs(ID_SELD);
|
---|
| 341 | gcurpos(cxval, cyval);
|
---|
| 342 | modinst();
|
---|
| 343 | return(SUCCESS);
|
---|
| 344 | }
|
---|
| 345 |
|
---|
| 346 | }
|
---|
[fa38804] | 347 |
|
---|
[f40a309] | 348 | } else if (hitbox < 12 ) { /* label window */
|
---|
| 349 |
|
---|
| 350 | fn = (hitbox EQ curfunc) ? 12 : hitbox;
|
---|
| 351 |
|
---|
| 352 | if (k EQ 8) { /* + = toggle I_TM_KEY */
|
---|
| 353 |
|
---|
| 354 | if (v_regs[5] & 0x0180)
|
---|
| 355 | vbank(0);
|
---|
| 356 |
|
---|
| 357 | tsplot4(instob, 64,
|
---|
| 358 | (((ip->idhfnc[fn].idftmd ^= I_TM_KEY) & I_TM_KEY)
|
---|
| 359 | ? idbox[fn][4] : ID_INST),
|
---|
| 360 | idbox[hitbox][6], idbox[hitbox][7],
|
---|
| 361 | idbxlbl[fn], 14);
|
---|
| 362 |
|
---|
| 363 | modinst();
|
---|
| 364 | }
|
---|
| 365 | }
|
---|
| 366 | }
|
---|
| 367 |
|
---|
| 368 | return(FAILURE);
|
---|
| 369 | }
|
---|
[599d89b] | 370 |
|
---|
| 371 | return(FAILURE);
|
---|
[f40a309] | 372 | }
|
---|
| 373 |
|
---|
| 374 | /*
|
---|
| 375 | =============================================================================
|
---|
| 376 | idx_key() -- process the 'X' (delete) key
|
---|
| 377 | =============================================================================
|
---|
| 378 | */
|
---|
| 379 |
|
---|
[0580615] | 380 | void idx_key(void)
|
---|
[f40a309] | 381 | {
|
---|
| 382 | register struct sment *smp;
|
---|
| 383 | register struct valent *vep;
|
---|
| 384 |
|
---|
| 385 | if (astat) {
|
---|
| 386 |
|
---|
| 387 | if (idsrcsw OR idcfsw OR idnamsw OR (wcflag NE -1))
|
---|
| 388 | return;
|
---|
| 389 |
|
---|
| 390 | if (stcrow EQ 16) {
|
---|
| 391 |
|
---|
| 392 | if ((stccol GE 1) AND (stccol LE 7)) {
|
---|
| 393 |
|
---|
| 394 | /* general source */
|
---|
| 395 |
|
---|
| 396 | vep = &valents[0];
|
---|
| 397 | smp = vpsms[(curvce << 4) + fnoff[curfunc]];
|
---|
| 398 |
|
---|
| 399 | if (smp->sm NE SM_NONE) { /* check for new general S/M */
|
---|
| 400 |
|
---|
| 401 | (smp->prv)->nxt = smp->nxt; /* unlink from old S/M chain */
|
---|
| 402 | (smp->nxt)->prv = smp->prv;
|
---|
| 403 |
|
---|
| 404 | smp->prv = (struct sment *)vep; /* link into new S/M chain */
|
---|
| 405 | smp->nxt = vep->nxt;
|
---|
| 406 | (vep->nxt)->prv = smp;
|
---|
| 407 | vep->nxt = smp;
|
---|
| 408 |
|
---|
| 409 | smp->sm = SM_NONE; /* update sment S/M entry */
|
---|
| 410 | }
|
---|
| 411 |
|
---|
| 412 | vbufs[curvce].idhfnc[curfunc].idfsrc = SM_NONE;
|
---|
| 413 | dswin(13);
|
---|
| 414 | modinst();
|
---|
[fa38804] | 415 |
|
---|
[f40a309] | 416 | } else if ((stccol EQ 15) OR (stccol EQ 16)) {
|
---|
| 417 |
|
---|
| 418 | /* current point and points to the right */
|
---|
| 419 |
|
---|
| 420 | delpnts();
|
---|
| 421 |
|
---|
| 422 | } else if ((stccol GE 33) AND (stccol LE 39)) {
|
---|
| 423 |
|
---|
| 424 | /* point source */
|
---|
| 425 |
|
---|
| 426 | pntptr->ipvsrc = SM_NONE;
|
---|
| 427 | dswin(16);
|
---|
| 428 | modinst();
|
---|
| 429 | }
|
---|
| 430 |
|
---|
| 431 | } else if ((stcrow EQ 17) AND
|
---|
| 432 | ((stccol EQ 31) OR (stccol EQ 32))) {
|
---|
| 433 |
|
---|
| 434 | /* entire instrument */
|
---|
| 435 |
|
---|
| 436 | initi(&vbufs[curvce]);
|
---|
| 437 | execins(curvce, 0, 0);
|
---|
| 438 | setinst();
|
---|
| 439 | allwins();
|
---|
| 440 | modinst();
|
---|
| 441 | }
|
---|
| 442 | }
|
---|
| 443 | }
|
---|
| 444 |
|
---|
| 445 | /*
|
---|
| 446 | =============================================================================
|
---|
| 447 | idfield() -- setup field routines for the score display
|
---|
| 448 | =============================================================================
|
---|
| 449 | */
|
---|
| 450 |
|
---|
[0580615] | 451 | void idfield(void)
|
---|
[f40a309] | 452 | {
|
---|
| 453 | idimsw = FALSE;
|
---|
| 454 | curslim = 210;
|
---|
| 455 |
|
---|
| 456 | curset(&id_flds);
|
---|
| 457 | }
|
---|
[6262b5c] | 458 |
|
---|