[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | ptselbx.c -- MIDAS-VII Patch editor box selection functions
|
---|
| 4 | Version 45 -- 1988-12-08 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #define DEBUGIT 0
|
---|
| 9 | #define SNAPDUMP 0
|
---|
| 10 |
|
---|
| 11 | #include "stddefs.h"
|
---|
| 12 | #include "fields.h"
|
---|
| 13 | #include "vsdd.h"
|
---|
| 14 | #include "graphdef.h"
|
---|
| 15 | #include "patch.h"
|
---|
| 16 | #include "macros.h"
|
---|
| 17 | #include "smdefs.h"
|
---|
| 18 | #include "curpak.h"
|
---|
| 19 |
|
---|
| 20 | #include "midas.h"
|
---|
| 21 | #include "ptdisp.h"
|
---|
| 22 |
|
---|
| 23 | #if SNAPDUMP
|
---|
| 24 | short snapit = 0;
|
---|
| 25 | #endif
|
---|
| 26 |
|
---|
| 27 | #if (SNAPDUMP|DEBUGIT)
|
---|
| 28 | extern short debugsw;
|
---|
| 29 |
|
---|
| 30 | short debug01 = 1;
|
---|
| 31 | #endif
|
---|
| 32 |
|
---|
| 33 | #define HT_0 0x01 /* definer, stimulus */
|
---|
| 34 | #define HT_1 0x02 /* source */
|
---|
| 35 | #define HT_2 0x04 /* destination */
|
---|
| 36 | #define HT_3 0x08 /* oscillator */
|
---|
| 37 | #define HT_4 0x10 /* level, index, freq, location, filter */
|
---|
| 38 | #define HT_5 0x20 /* filq, dynamc, vout, depth, rate, inten, aux */
|
---|
| 39 | #define HT_OFF 0x00 /* no submenu highlighted */
|
---|
| 40 |
|
---|
| 41 | /* |
---|
| 42 |
|
---|
| 43 | */
|
---|
[0580615] | 44 |
|
---|
| 45 | extern void enterit(void);
|
---|
| 46 | extern short nokey(void);
|
---|
| 47 | extern short cnvp2c(void);
|
---|
[f40a309] | 48 | extern short dec2fr(char *s);
|
---|
[0580615] | 49 |
|
---|
[f40a309] | 50 | extern unsigned exp_c(unsigned c);
|
---|
| 51 |
|
---|
| 52 | extern short CurLine;
|
---|
| 53 |
|
---|
| 54 | extern short cents;
|
---|
| 55 | extern short cmtype;
|
---|
| 56 | extern short cxval;
|
---|
| 57 | extern short cyval;
|
---|
| 58 | extern short hitcx;
|
---|
| 59 | extern short hitcy;
|
---|
| 60 | extern short stccol;
|
---|
| 61 | extern short stcrow;
|
---|
| 62 | extern short submenu;
|
---|
| 63 | extern short vtccol;
|
---|
| 64 | extern short vtcrow;
|
---|
| 65 |
|
---|
| 66 | extern short ndvals[];
|
---|
[0c834c5] | 67 |
|
---|
[f40a309] | 68 | extern unsigned *obj11;
|
---|
| 69 |
|
---|
| 70 | extern struct selbox *csbp;
|
---|
| 71 | extern struct selbox *curboxp;
|
---|
| 72 |
|
---|
| 73 | extern char *smdata[];
|
---|
| 74 | extern char *ssdata[];
|
---|
| 75 | extern char *stdata[];
|
---|
| 76 | extern char *trdata[];
|
---|
[0580615] | 77 |
|
---|
[f40a309] | 78 | short ptfnbox(short n);
|
---|
| 79 |
|
---|
| 80 | /* |
---|
| 81 |
|
---|
| 82 | */
|
---|
| 83 |
|
---|
| 84 | short ptegood; /* pte buffer -- entire entry valid flag */
|
---|
| 85 |
|
---|
| 86 | short ptedfok; /* pte buffer -- def valid flag */
|
---|
| 87 | short ptestok; /* pte buffer -- stm valid flag */
|
---|
| 88 | short ptedsok; /* pte buffer -- destination valid flag */
|
---|
| 89 | short ptedtok; /* pte buffer -- datum valid flag */
|
---|
| 90 |
|
---|
| 91 | short ptedef; /* pte buffer -- definer number */
|
---|
| 92 | short ptestm; /* pte buffer -- stimulus number */
|
---|
| 93 | short ptespec; /* pte buffer -- address type */
|
---|
| 94 | short ptesuba; /* pte buffer -- sub-address */
|
---|
| 95 | short ptedat1; /* pte buffer -- data word 1 */
|
---|
| 96 | short ptedat2; /* pte buffer -- data word 2 */
|
---|
| 97 |
|
---|
| 98 | short ptedftp; /* definer / stimulus entry flag */
|
---|
| 99 |
|
---|
| 100 | short ptedfst; /* current definer/stimulus data entry format */
|
---|
| 101 | short ptedest; /* current destination data entry format */
|
---|
| 102 | short ptedata; /* current datum data entry format */
|
---|
| 103 |
|
---|
| 104 | short ptemenu; /* current submenu highlighting */
|
---|
| 105 |
|
---|
| 106 | short pteset; /* pte buffer setup flag */
|
---|
| 107 | short ptbflag; /* pdbuf setup flag */
|
---|
| 108 |
|
---|
| 109 | short ptecpos; /* current patch entry index */
|
---|
| 110 | short ptepred; /* predecessor entry index */
|
---|
| 111 | short ptesucc; /* successor entry index */
|
---|
| 112 |
|
---|
| 113 | struct patch ptebuf; /* pte buffer -- patch table format */
|
---|
| 114 |
|
---|
| 115 | char ptdebuf[50]; /* patch edit buffer */
|
---|
| 116 |
|
---|
| 117 | /* |
---|
| 118 |
|
---|
| 119 | */
|
---|
| 120 |
|
---|
| 121 | char *rawdfst[] = { /* def/stm field initial contents */
|
---|
| 122 |
|
---|
| 123 | "Key 001 1 01",
|
---|
| 124 | "Rel 001 1 01",
|
---|
| 125 | "Trig 01 ",
|
---|
| 126 | "Pulse 1 "
|
---|
| 127 | };
|
---|
| 128 |
|
---|
| 129 | char *rawdest[] = { /* destination field initial contents */
|
---|
| 130 |
|
---|
| 131 | "??????? 00 ??", /* ?????? 00 */
|
---|
| 132 | "K 001 1 01 ", /* PA_KEY 01 */
|
---|
| 133 | "Trigger 01 ", /* PA_TRG 02 */
|
---|
| 134 | "Pulse 1 ", /* PA_PLS 03 */
|
---|
| 135 | "LED A ", /* PA_LED 04 */
|
---|
| 136 | "Seq 01 Lin ", /* PA_SLIN 05 */
|
---|
| 137 | "Seq 01 Ctl ", /* PA_SCTL 06 */
|
---|
| 138 | "Tune Table ", /* PA_TUNE 07 */
|
---|
| 139 | "Reg 01 Set ", /* PA_RSET 08 */
|
---|
| 140 | "Reg 01 Add ", /* PA_RADD 09 */
|
---|
| 141 | "Instrument V1", /* PA_INST 10 */
|
---|
| 142 | "Osc 1 Int V1", /* PA_OSC 11 */
|
---|
| 143 | "WaveshapeA V1", /* PA_WAVA 12 */
|
---|
| 144 | "WaveshapeB V1", /* PA_WAVB 13 */
|
---|
| 145 | "Configure V1", /* PA_CNFG 14 */
|
---|
| 146 | "Level Srce V1", /* PA_LEVL 15 */
|
---|
| 147 | "Ind 1 Srce V1", /* PA_INDX 16 */
|
---|
| 148 | "Frq 1 Srce V1", /* PA_FREQ 17 */
|
---|
| 149 | "Filtr Srce V1", /* PA_FILT 18 */
|
---|
| 150 | "Fil Q Srce V1", /* PA_FILQ 19 */
|
---|
| 151 | "Loctn Srce V1", /* PA_LOCN 20 */
|
---|
| 152 | "Dynmc Srce V1", /* PA_DYNM 21 */
|
---|
| 153 | "Aux Srce ", /* PA_AUX 22 */
|
---|
| 154 | "Rate Srce ", /* PA_RATE 23 */
|
---|
| 155 | "Inten Srce ", /* PA_INTN 24 */
|
---|
| 156 | "Depth Srce ", /* PA_DPTH 25 */
|
---|
| 157 | "Vlt 1 Srce " /* PA_VOUT 26 */
|
---|
| 158 | };
|
---|
| 159 |
|
---|
| 160 | /* |
---|
| 161 |
|
---|
| 162 | */
|
---|
| 163 |
|
---|
| 164 | char *rawmode[] = { "Frq ", "Pch ", "Int ", "Rat " }; /* oscillator modes */
|
---|
| 165 | char *rawmdat[] = { "00.1 ", "0C 00", "+0000", "1/1 " }; /* oscillator data */
|
---|
| 166 |
|
---|
| 167 | short omtabl[] = { PSO_FRQ, PSO_PCH, PSO_INT, PSO_RAT }; /* oscillator modes */
|
---|
| 168 | short omdtab[] = { 2, 320, 0, 0 }; /* oscillator data */
|
---|
| 169 | short omftab[] = { 6, 7, 4, 5 }; /* mode data format */
|
---|
| 170 |
|
---|
| 171 | char *rawfpud[] = { "PchWh", "+0.00", "00001", "\2400.00", "Start" };
|
---|
| 172 |
|
---|
| 173 | short fpudtab[] = { SM_HTPW, 0, 1, 0, 1 };
|
---|
| 174 | short fpuetab[] = { 11, 1, 2, 3, 9 };
|
---|
| 175 |
|
---|
| 176 | short dfsttab[] = { 0x0000, 0x8000, 0x1100, 0x1180 };
|
---|
| 177 |
|
---|
| 178 | short defcols[] = { 2, 6, 7, 8}; /* def data entry columns */
|
---|
| 179 | short stmcols[] = { 15, 19, 20, 21}; /* stm data entry columns */
|
---|
| 180 |
|
---|
| 181 | short dstcols[] = { /* destination data entry columns */
|
---|
| 182 |
|
---|
| 183 | /* -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 */
|
---|
| 184 | 28, 30, 36, 34, 32, 32, 42, 39, 34, 32, 32, 34
|
---|
| 185 | };
|
---|
| 186 |
|
---|
| 187 | short dfsttp[] = { 1, 1, 2, 3 }; /* def/stm formats */
|
---|
| 188 |
|
---|
| 189 | short datasrc[] = {
|
---|
| 190 |
|
---|
| 191 | SM_HTPW, SM_VTMW, SM_LPBR, SM_PED1, SM_CTL1,
|
---|
| 192 | SM_PTCH, SM_FREQ, SM_KVEL, SM_KPRS, SM_RAND
|
---|
| 193 | };
|
---|
| 194 |
|
---|
| 195 | /* |
---|
| 196 |
|
---|
| 197 | */
|
---|
| 198 |
|
---|
| 199 | short destype[] = { /* destination type table */
|
---|
| 200 |
|
---|
| 201 | PA_KEY, -1, PA_TRG, PA_PLS, PA_LED,
|
---|
| 202 | PA_SLIN, PA_SCTL, PA_TUNE, PA_RSET, PA_RADD,
|
---|
| 203 | PA_INST, PA_OSC, PA_WAVA, PA_WAVB, PA_CNFG,
|
---|
| 204 | PA_INDX, PA_FREQ, -1, -1, -1,
|
---|
| 205 | PA_LEVL, PA_LOCN, PA_FILT, PA_FILQ, PA_DYNM,
|
---|
| 206 | PA_VOUT, PA_DPTH, PA_RATE, PA_INTN, PA_AUX,
|
---|
| 207 | -1, -1, -1, -1, -1,
|
---|
| 208 | -1, -1, -1, -1, -1,
|
---|
| 209 | -1, -1, -1, -1, -1
|
---|
| 210 | };
|
---|
| 211 |
|
---|
| 212 | char destfmt[] = { /* destination data entry format table */
|
---|
| 213 |
|
---|
| 214 | 0, -1, 1, 2, 3, /* 1 .. 5 */
|
---|
| 215 | 4, 4, 5, 4, 4, /* 6 .. 10 */
|
---|
| 216 | 6, 9, 6, 6, 6, /* 11 .. 15 */
|
---|
| 217 | 9, 9, -1, -1, -1, /* 16 .. 20 */
|
---|
| 218 | 10, 10, 10, 10, 10, /* 21 .. 25 */
|
---|
| 219 | 8, 7, 7, 7, 7 /* 26 .. 30 */
|
---|
| 220 | };
|
---|
| 221 |
|
---|
| 222 | char datafmt[] = { /* datum data entry format table */
|
---|
| 223 |
|
---|
| 224 | 8, -1, 9, 8, 14,
|
---|
| 225 | 13, 9, 18, 12, 12,
|
---|
| 226 | 15, 4, 16, 16, 17,
|
---|
| 227 | 11, 11, -1, -1, -1,
|
---|
| 228 | 11, 11, 11, 11, 11,
|
---|
| 229 | 11, 11, 11, 11, 11
|
---|
| 230 | };
|
---|
| 231 |
|
---|
| 232 | /* |
---|
| 233 |
|
---|
| 234 | */
|
---|
| 235 |
|
---|
| 236 | char desdatf[] = { /* data entry default flags */
|
---|
| 237 |
|
---|
| 238 | 2, 0, 2, 2, 1,
|
---|
| 239 | 1, 2, 1, 3, 3,
|
---|
| 240 | 1, 0, 1, 1, 1,
|
---|
| 241 | 2, 2, 0, 0, 0,
|
---|
| 242 | 2, 2, 2, 2, 2,
|
---|
| 243 | 2, 2, 2, 2, 2
|
---|
| 244 | };
|
---|
| 245 |
|
---|
| 246 | short desdat1[] = { /* data word 1 defaults */
|
---|
| 247 |
|
---|
| 248 | 0, 0, 0, 0, 0,
|
---|
| 249 | 0, 0, 0, 0, 0,
|
---|
| 250 | 0, 0, 0, 0, 0,
|
---|
| 251 | 0, 0, 0, 0, 0,
|
---|
| 252 | 0, 0, 0, 0, 0,
|
---|
| 253 | 0, 0, 0, 0, 0
|
---|
| 254 | };
|
---|
| 255 |
|
---|
| 256 | short desdat2[] = { /* data word 2 defaults */
|
---|
| 257 |
|
---|
| 258 | 0, 0, 1, 0, 0,
|
---|
| 259 | 0, 1, 0, 0, 1,
|
---|
| 260 | 0, 0, 0, 0, 0,
|
---|
| 261 | SM_HTPW, SM_HTPW, 0, 0, 0,
|
---|
| 262 | SM_HTPW, SM_HTPW, SM_HTPW, SM_HTPW, SM_HTPW,
|
---|
| 263 | SM_HTPW, SM_HTPW, SM_HTPW, SM_HTPW, SM_HTPW
|
---|
| 264 | };
|
---|
| 265 |
|
---|
| 266 | /* |
---|
| 267 |
|
---|
| 268 | */
|
---|
| 269 |
|
---|
| 270 | char *rawdata[] = {
|
---|
| 271 |
|
---|
| 272 | "Trans", " ", "Start", "Trans", "000 ",
|
---|
| 273 | "000 ", "Start", "0 ", "+00 ", "+01 ",
|
---|
| 274 | "00 ", "+0000", "01 ", "01 ", "00 ",
|
---|
| 275 | "PchWh", "PchWh", " ", " ", " ",
|
---|
| 276 | "PchWh", "PchWh", "PchWh", "PchWh", "PchWh",
|
---|
| 277 | "PchWh", "PchWh", "PchWh", "PchWh", "PchWh"
|
---|
| 278 | };
|
---|
| 279 |
|
---|
| 280 | char hilitab[][8] = { /* submenu highlight table */
|
---|
| 281 |
|
---|
| 282 | /* start, width, row1, row2, row3, row4, row5, pad */
|
---|
| 283 |
|
---|
| 284 | { 2, 3, HT_0|HT_2, HT_0, HT_0|HT_2, HT_0|HT_2, HT_2, 0},
|
---|
| 285 | { 7, 6, HT_2, HT_2, HT_2, HT_2, HT_2, 0},
|
---|
| 286 | { 15, 5, HT_2, HT_2, HT_2, HT_2, HT_2, 0},
|
---|
| 287 | { 22, 5, HT_2, HT_2|HT_3, HT_3, HT_3, HT_3, 0},
|
---|
| 288 | { 29, 5, HT_2, HT_2, HT_2, HT_2, HT_2, 0},
|
---|
| 289 | { 36, 5, HT_2, HT_2, HT_2, HT_2, HT_2, 0},
|
---|
| 290 | { 43, 4, HT_4|HT_5, HT_4|HT_5, HT_4|HT_5, HT_4|HT_5, 0, 0},
|
---|
| 291 | { 49, 5, HT_1, HT_1, HT_1, HT_1, HT_1, 0},
|
---|
| 292 | { 56, 5, HT_1, HT_1, HT_1, HT_1, HT_1, 0}
|
---|
| 293 | };
|
---|
| 294 |
|
---|
| 295 | struct selbox ptboxes[] = { /* selection boxes */
|
---|
| 296 |
|
---|
| 297 | {CTOX(1), RTOY(DATAROW), CTOX(48)-1, RTOY(1+DATAROW)-1, 0, ptfnbox}, /* current patch */
|
---|
| 298 |
|
---|
| 299 | { 0, 0, 0, 0, 0, FN_NULL}
|
---|
| 300 | };
|
---|
| 301 |
|
---|
| 302 | /* |
---|
| 303 |
|
---|
[0580615] | 304 | */
|
---|
[f40a309] | 305 |
|
---|
| 306 | /*
|
---|
| 307 | =============================================================================
|
---|
| 308 | hilitpm() -- highlight patch submenu
|
---|
| 309 | =============================================================================
|
---|
| 310 | */
|
---|
| 311 |
|
---|
| 312 | void hilitpm(char n)
|
---|
| 313 | {
|
---|
| 314 | register short chr, h, v, w;
|
---|
| 315 |
|
---|
| 316 | ptemenu = n; /* set current submenu type */
|
---|
| 317 |
|
---|
| 318 | for (h = 0; h < 9; h++) { /* scan the columns */
|
---|
| 319 |
|
---|
| 320 | for (v = 0; v < 5; v++) { /* scan the rows */
|
---|
| 321 |
|
---|
| 322 | chr = hilitab[h][0]; /* starting character */
|
---|
| 323 |
|
---|
| 324 | for (w = hilitab[h][1]; w-- > 0; )
|
---|
| 325 | vsetcv(obj11, v + 1, chr++,
|
---|
| 326 | (hilitab[h][v + 2] & n) ?
|
---|
| 327 | PTIATR : PTMATR, 64);
|
---|
| 328 | }
|
---|
| 329 | }
|
---|
| 330 | }
|
---|
| 331 |
|
---|
| 332 | /* |
---|
[0580615] | 333 |
|
---|
[f40a309] | 334 | */
|
---|
| 335 |
|
---|
| 336 | /*
|
---|
| 337 | =============================================================================
|
---|
| 338 | aftercm() -- determine state after cursor motion
|
---|
| 339 | =============================================================================
|
---|
| 340 | */
|
---|
| 341 |
|
---|
| 342 | void aftercm(void)
|
---|
| 343 | {
|
---|
| 344 | switch (stccol) { /* switch based on current cursor column */
|
---|
| 345 |
|
---|
| 346 | case 2: /* definer */
|
---|
| 347 | case 3:
|
---|
| 348 | case 4:
|
---|
| 349 | hilitpm(HT_0);
|
---|
| 350 | break;
|
---|
| 351 |
|
---|
| 352 | case 15: /* stimulus */
|
---|
| 353 | case 16:
|
---|
| 354 | case 17:
|
---|
| 355 |
|
---|
| 356 | hilitpm(HT_0);
|
---|
| 357 | break;
|
---|
| 358 |
|
---|
| 359 | case 28: /* destination */
|
---|
| 360 |
|
---|
| 361 | hilitpm(HT_2);
|
---|
| 362 | break;
|
---|
| 363 |
|
---|
| 364 | /* |
---|
| 365 |
|
---|
| 366 | */
|
---|
| 367 | case 34: /* may be a destination sub-address */
|
---|
| 368 | case 35:
|
---|
| 369 | case 36:
|
---|
| 370 | case 37:
|
---|
| 371 |
|
---|
| 372 | if (ptedsok) { /* if destination is good ... */
|
---|
| 373 |
|
---|
| 374 | switch (PE_SPEC & ptespec) {
|
---|
| 375 |
|
---|
| 376 | case PA_OSC:
|
---|
| 377 |
|
---|
| 378 | hilitpm(HT_3);
|
---|
| 379 | break;
|
---|
| 380 |
|
---|
| 381 | case PA_LEVL:
|
---|
| 382 | case PA_INDX:
|
---|
| 383 | case PA_FREQ:
|
---|
| 384 | case PA_LOCN:
|
---|
| 385 | case PA_FILT:
|
---|
| 386 |
|
---|
| 387 | hilitpm(HT_4);
|
---|
| 388 | break;
|
---|
| 389 |
|
---|
| 390 | case PA_FILQ:
|
---|
| 391 | case PA_DYNM:
|
---|
| 392 | case PA_VOUT:
|
---|
| 393 | case PA_DPTH:
|
---|
| 394 | case PA_RATE:
|
---|
| 395 | case PA_INTN:
|
---|
| 396 | case PA_AUX:
|
---|
| 397 |
|
---|
| 398 | hilitpm(HT_5);
|
---|
| 399 | break;
|
---|
| 400 |
|
---|
| 401 | default:
|
---|
| 402 |
|
---|
| 403 | hilitpm(HT_OFF);
|
---|
| 404 | break;
|
---|
| 405 | }
|
---|
| 406 |
|
---|
| 407 | } else {
|
---|
| 408 |
|
---|
| 409 | hilitpm(HT_OFF);
|
---|
| 410 | }
|
---|
| 411 |
|
---|
| 412 | break;
|
---|
| 413 | /* |
---|
| 414 |
|
---|
| 415 | */
|
---|
| 416 | case 42: /* datum */
|
---|
| 417 |
|
---|
| 418 | if (ptedtok) { /* if datum is valid ... */
|
---|
| 419 |
|
---|
| 420 | switch (PE_SPEC & ptespec) {
|
---|
| 421 |
|
---|
| 422 | case PA_LEVL:
|
---|
| 423 | case PA_INDX:
|
---|
| 424 | case PA_FREQ:
|
---|
| 425 | case PA_LOCN:
|
---|
| 426 | case PA_FILT:
|
---|
| 427 | case PA_FILQ:
|
---|
| 428 | case PA_DYNM:
|
---|
| 429 | case PA_VOUT:
|
---|
| 430 | case PA_DPTH:
|
---|
| 431 | case PA_RATE:
|
---|
| 432 | case PA_INTN:
|
---|
| 433 | case PA_AUX:
|
---|
| 434 |
|
---|
| 435 | if (ptedat1 EQ PSA_SRC)
|
---|
| 436 | hilitpm(HT_1);
|
---|
| 437 | else
|
---|
| 438 | hilitpm(HT_OFF);
|
---|
| 439 |
|
---|
| 440 | break;
|
---|
| 441 |
|
---|
| 442 | default:
|
---|
| 443 |
|
---|
| 444 | hilitpm(HT_OFF);
|
---|
| 445 | break;
|
---|
| 446 | }
|
---|
| 447 |
|
---|
| 448 | } else {
|
---|
| 449 |
|
---|
| 450 | hilitpm(HT_OFF);
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 | break;
|
---|
| 454 |
|
---|
| 455 | default: /* not in a starting place */
|
---|
| 456 |
|
---|
| 457 | hilitpm(HT_OFF);
|
---|
| 458 | break;
|
---|
| 459 | }
|
---|
[0580615] | 460 | }
|
---|
[f40a309] | 461 |
|
---|
| 462 | /* |
---|
| 463 |
|
---|
| 464 | */
|
---|
| 465 |
|
---|
| 466 | /*
|
---|
| 467 | =============================================================================
|
---|
| 468 | movectc() -- move cursor and reset highlighting
|
---|
| 469 | =============================================================================
|
---|
| 470 | */
|
---|
| 471 |
|
---|
[0580615] | 472 | void movectc(short r, short c)
|
---|
[f40a309] | 473 | {
|
---|
| 474 | ctcpos(r, c);
|
---|
| 475 | aftercm();
|
---|
| 476 | }
|
---|
| 477 |
|
---|
| 478 | /*
|
---|
| 479 | =============================================================================
|
---|
| 480 | endpsm() -- end patch submenu data entry
|
---|
| 481 | =============================================================================
|
---|
| 482 | */
|
---|
| 483 |
|
---|
| 484 | void endpsm(short row, short col)
|
---|
| 485 | {
|
---|
| 486 | submenu = FALSE;
|
---|
| 487 | cmtype = CT_SMTH;
|
---|
| 488 |
|
---|
| 489 | ptegood = ptedfok AND ptestok AND ptedsok AND ptedtok;
|
---|
| 490 |
|
---|
| 491 | mtcoff();
|
---|
| 492 | movectc(row, col);
|
---|
| 493 |
|
---|
[0580615] | 494 | srdspte();
|
---|
[f40a309] | 495 | }
|
---|
| 496 |
|
---|
| 497 | /* |
---|
| 498 |
|
---|
| 499 | */
|
---|
| 500 |
|
---|
| 501 | /*
|
---|
| 502 | =============================================================================
|
---|
| 503 | edefstm() -- enter a def or a stm field
|
---|
| 504 | =============================================================================
|
---|
| 505 | */
|
---|
| 506 |
|
---|
| 507 | void edefstm(short du, short n)
|
---|
| 508 | {
|
---|
| 509 | short chan, port, stim;
|
---|
| 510 | register short i, left, right;
|
---|
| 511 | register long ltemp;
|
---|
| 512 |
|
---|
| 513 | #if DEBUGIT
|
---|
| 514 | if (debugsw AND snapit)
|
---|
| 515 | printf("edefstm(%d): pte stok=%d dfok=%d\n",
|
---|
| 516 | n, ptestok, ptedfok);
|
---|
| 517 | #endif
|
---|
| 518 |
|
---|
| 519 | if (n) {
|
---|
| 520 |
|
---|
| 521 | if (NOT ptestok) {
|
---|
| 522 |
|
---|
| 523 | movectc(DATAROW, 15);
|
---|
| 524 | return;
|
---|
| 525 | }
|
---|
| 526 |
|
---|
| 527 | } else {
|
---|
| 528 |
|
---|
| 529 | if (NOT ptedfok) {
|
---|
| 530 |
|
---|
| 531 | movectc(DATAROW, 2);
|
---|
| 532 | return;
|
---|
| 533 | }
|
---|
| 534 | }
|
---|
| 535 |
|
---|
| 536 | port = ((n ? ptestm : ptedef) >> 11) & 0x0003;
|
---|
| 537 | chan = ((n ? ptestm : ptedef) >> 7) & 0x000F;
|
---|
| 538 | stim = (n ? ptestm : ptedef) & 0x007F;
|
---|
| 539 |
|
---|
| 540 | /* |
---|
| 541 |
|
---|
| 542 | */
|
---|
| 543 |
|
---|
| 544 | if ( (port EQ 0) OR (port EQ 1) OR
|
---|
| 545 | ((port EQ 2) AND (chan < 2)) ) { /* key / rel */
|
---|
| 546 |
|
---|
| 547 | ltemp = 0; /* stimulus number */
|
---|
| 548 | left = n ? 19 : 6;
|
---|
| 549 | right = n ? 22 : 9;
|
---|
| 550 |
|
---|
| 551 | for (i = left; i < right; i++)
|
---|
| 552 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
| 553 |
|
---|
| 554 | if ((ltemp EQ 0) OR (ltemp > 128L)) {
|
---|
| 555 |
|
---|
| 556 | movectc(DATAROW, left);
|
---|
| 557 | return;
|
---|
| 558 | }
|
---|
| 559 |
|
---|
| 560 | stim = ltemp - 1;
|
---|
| 561 |
|
---|
| 562 | if (port EQ 2) {
|
---|
| 563 |
|
---|
| 564 | chan = 0;
|
---|
| 565 |
|
---|
| 566 | } else {
|
---|
| 567 |
|
---|
| 568 | ltemp = 0; /* channel */
|
---|
| 569 | left = n ? 25 : 12;
|
---|
| 570 | right = n ? 27 : 14;
|
---|
| 571 |
|
---|
| 572 | for (i = left; i < right; i++)
|
---|
| 573 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
| 574 |
|
---|
| 575 | if ((ltemp EQ 0) OR (ltemp > 16L)) {
|
---|
| 576 |
|
---|
| 577 | movectc(DATAROW, left);
|
---|
| 578 | return;
|
---|
| 579 | }
|
---|
| 580 |
|
---|
| 581 | chan = ltemp - 1;
|
---|
| 582 | }
|
---|
| 583 |
|
---|
| 584 | if (n)
|
---|
| 585 | ptestm = (ptestm & 0x8000) | (port << 11) | (chan << 7) | stim;
|
---|
| 586 | else
|
---|
| 587 | ptedef = (ptedef & 0x8000) | (port << 11) | (chan << 7) | stim;
|
---|
| 588 | /* |
---|
| 589 |
|
---|
| 590 | */
|
---|
| 591 | } else if ((port EQ 2) AND (chan EQ 2)) { /* Trig */
|
---|
| 592 |
|
---|
| 593 | ltemp = 0;
|
---|
| 594 | left = n ? 20 : 7;
|
---|
| 595 | right = n ? 22 : 9;
|
---|
| 596 |
|
---|
| 597 | for (i = left; i < right; i++)
|
---|
| 598 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
| 599 |
|
---|
| 600 | if ((ltemp EQ 0) OR (ltemp > 16L)) {
|
---|
| 601 |
|
---|
| 602 | movectc(DATAROW, left);
|
---|
| 603 | return;
|
---|
| 604 | }
|
---|
| 605 |
|
---|
| 606 | stim = ltemp - 1;
|
---|
| 607 |
|
---|
| 608 | if (n)
|
---|
| 609 | ptestm = 0x1100 | stim;
|
---|
| 610 | else
|
---|
| 611 | ptedef = 0x1100 | stim;
|
---|
| 612 | /* |
---|
| 613 |
|
---|
| 614 | */
|
---|
| 615 | } else if ((port EQ 2) AND (chan EQ 3)) { /* Pulse */
|
---|
| 616 |
|
---|
| 617 | left = n ? 21 : 8;
|
---|
| 618 | ltemp = ptdebuf[left] - '0';
|
---|
| 619 |
|
---|
| 620 | if ((ltemp EQ 0) OR (ltemp > 2L)) {
|
---|
| 621 |
|
---|
| 622 | movectc(DATAROW, left);
|
---|
| 623 | return;
|
---|
| 624 | }
|
---|
| 625 |
|
---|
| 626 | stim = ltemp - 1;
|
---|
| 627 |
|
---|
| 628 | if (n)
|
---|
| 629 | ptestm = 0x1180 | stim;
|
---|
| 630 | else
|
---|
| 631 | ptedef = 0x1180 | stim;
|
---|
| 632 |
|
---|
| 633 | } else {
|
---|
| 634 |
|
---|
| 635 | movectc(DATAROW, n ? 15 : 2);
|
---|
| 636 | return;
|
---|
| 637 | }
|
---|
| 638 |
|
---|
| 639 | if (n)
|
---|
| 640 | ptestok = TRUE;
|
---|
| 641 | else
|
---|
| 642 | ptedfok = TRUE;
|
---|
| 643 |
|
---|
| 644 | #if SNAPDUMP
|
---|
| 645 | if (debugsw AND snapit)
|
---|
| 646 | SnapPTV("edefstm");
|
---|
| 647 | #endif
|
---|
| 648 |
|
---|
[0580615] | 649 | if (du) { /* if display is to be updated ... */
|
---|
[f40a309] | 650 |
|
---|
| 651 | srdspte();
|
---|
| 652 | movectc(DATAROW, n ? 28 : 15);
|
---|
| 653 | }
|
---|
| 654 | }
|
---|
| 655 |
|
---|
| 656 | /* |
---|
| 657 |
|
---|
| 658 | */
|
---|
| 659 |
|
---|
| 660 | /*
|
---|
| 661 | =============================================================================
|
---|
| 662 | ptdest() -- enter patch destination field
|
---|
| 663 | =============================================================================
|
---|
| 664 | */
|
---|
| 665 |
|
---|
| 666 | void ptdest(short du)
|
---|
| 667 | {
|
---|
| 668 | register long ltemp;
|
---|
| 669 | register short i, left, right, stim;
|
---|
| 670 | short port, chan;
|
---|
| 671 |
|
---|
| 672 | #if DEBUGIT
|
---|
| 673 | if (debugsw AND debug01)
|
---|
| 674 | printf("ptdest(%d): entry -- ptedest = %d\n", du, ptedest);
|
---|
| 675 | #endif
|
---|
| 676 |
|
---|
| 677 | switch (ptedest) {
|
---|
| 678 |
|
---|
| 679 | case 0: /* key */
|
---|
| 680 |
|
---|
| 681 | ltemp = 0;
|
---|
| 682 | left = 30;
|
---|
| 683 | right = 33;
|
---|
| 684 |
|
---|
| 685 | for (i = left; i < right; i++)
|
---|
| 686 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
| 687 |
|
---|
| 688 | if ((ltemp EQ 0) OR (ltemp > 128L)) {
|
---|
| 689 |
|
---|
| 690 | movectc(DATAROW, left);
|
---|
| 691 | return;
|
---|
| 692 | }
|
---|
| 693 |
|
---|
| 694 | stim = ltemp - 1;
|
---|
| 695 | ltemp = 0;
|
---|
| 696 | left = 36;
|
---|
| 697 | right = 38;
|
---|
| 698 |
|
---|
| 699 | for (i = left; i < right; i++)
|
---|
| 700 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
| 701 |
|
---|
| 702 | if ((ltemp EQ 0) OR (ltemp > 16L)) {
|
---|
| 703 |
|
---|
| 704 | movectc(DATAROW, left);
|
---|
| 705 | return;
|
---|
| 706 | }
|
---|
| 707 |
|
---|
| 708 | chan = ltemp - 1;
|
---|
| 709 | /* |
---|
| 710 |
|
---|
| 711 | */
|
---|
| 712 | if (ptdebuf[34] EQ 'L') {
|
---|
| 713 |
|
---|
| 714 | port = 2;
|
---|
| 715 | chan = 0;
|
---|
| 716 |
|
---|
| 717 | } else {
|
---|
| 718 |
|
---|
| 719 | port = ptdebuf[34] - '1';
|
---|
| 720 | }
|
---|
| 721 |
|
---|
| 722 | ptesuba = (port << 11) | (chan << 7) | stim;
|
---|
| 723 | break;
|
---|
| 724 | /* |
---|
| 725 |
|
---|
| 726 | */
|
---|
| 727 | case 1: /* trigger */
|
---|
| 728 |
|
---|
| 729 | ltemp = 0;
|
---|
| 730 | left = 36;
|
---|
| 731 | right = 38;
|
---|
| 732 |
|
---|
| 733 | for (i = left; i < right; i++)
|
---|
| 734 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
| 735 |
|
---|
| 736 | if ((ltemp EQ 0) OR (ltemp > 16L)) {
|
---|
| 737 |
|
---|
| 738 | movectc(DATAROW, left);
|
---|
| 739 | return;
|
---|
| 740 | }
|
---|
| 741 |
|
---|
| 742 | stim = ltemp - 1;
|
---|
| 743 | ptesuba = 0x1100 | stim;
|
---|
| 744 | break;
|
---|
| 745 |
|
---|
| 746 | case 2: /* pulse */
|
---|
| 747 |
|
---|
| 748 | ptesuba = ptdebuf[34] - '1';
|
---|
| 749 | break;
|
---|
| 750 |
|
---|
| 751 | case 3: /* led */
|
---|
| 752 |
|
---|
| 753 | ptesuba = ptdebuf[32] - 'A';
|
---|
| 754 | break;
|
---|
| 755 |
|
---|
| 756 | case 4: /* seq / reg */
|
---|
| 757 |
|
---|
| 758 | ltemp = 0;
|
---|
| 759 | left = 32;
|
---|
| 760 | right = 34;
|
---|
| 761 |
|
---|
| 762 | for (i = left; i < right; i++)
|
---|
| 763 | ltemp = (ltemp * 10) + ptdebuf[i] - '0';
|
---|
| 764 |
|
---|
| 765 | if ((ltemp EQ 0) OR (ltemp > 16L)) {
|
---|
| 766 |
|
---|
| 767 | movectc(DATAROW, left);
|
---|
| 768 | return;
|
---|
| 769 | }
|
---|
| 770 |
|
---|
| 771 | ptesuba = ltemp - 1;
|
---|
| 772 | break;
|
---|
| 773 |
|
---|
| 774 | /* |
---|
| 775 |
|
---|
| 776 | */
|
---|
| 777 | case 5: /* tuning */
|
---|
| 778 | case 7: /* aux, rate, inten, depth */
|
---|
| 779 |
|
---|
| 780 | break;
|
---|
| 781 |
|
---|
| 782 | case 6: /* inst, wave, config */
|
---|
| 783 | case 10: /* level, filtr, fil Q, loctn, dynmc */
|
---|
| 784 |
|
---|
| 785 | if (ptdebuf[39] EQ 'V')
|
---|
| 786 | stim = 0;
|
---|
| 787 | else
|
---|
| 788 | stim = 12;
|
---|
| 789 |
|
---|
| 790 | i = ptdebuf[40] & 0x00FF;
|
---|
| 791 |
|
---|
| 792 | if (i GE '\254')
|
---|
| 793 | stim += i - '\242';
|
---|
| 794 | else
|
---|
| 795 | stim += i - '0';
|
---|
| 796 |
|
---|
| 797 | --stim;
|
---|
| 798 | ptesuba = stim << 8;
|
---|
| 799 | break;
|
---|
| 800 |
|
---|
| 801 | case 8: /* vlt */
|
---|
| 802 |
|
---|
| 803 | ptesuba = ptdebuf[32] - '0';
|
---|
| 804 | break;
|
---|
| 805 | /* |
---|
| 806 |
|
---|
| 807 | */
|
---|
| 808 | case 9: /* osc, ind, frq */
|
---|
| 809 |
|
---|
| 810 | if (ptdebuf[39] EQ 'V')
|
---|
| 811 | stim = 0;
|
---|
| 812 | else
|
---|
| 813 | stim = 12;
|
---|
| 814 |
|
---|
| 815 | i = ptdebuf[40] & 0x00FF;
|
---|
| 816 |
|
---|
| 817 | if (i GE '\254')
|
---|
| 818 | stim += i - '\242';
|
---|
| 819 | else
|
---|
| 820 | stim += i - '0';
|
---|
| 821 |
|
---|
| 822 | --stim;
|
---|
| 823 | ptesuba = (stim << 8) | (ptdebuf[32] - '0');
|
---|
| 824 | break;
|
---|
| 825 |
|
---|
| 826 | default: /* something weird got in here ... */
|
---|
| 827 |
|
---|
| 828 | movectc(DATAROW, 28);
|
---|
| 829 | return;
|
---|
| 830 | }
|
---|
| 831 |
|
---|
| 832 | ptedsok = TRUE;
|
---|
| 833 |
|
---|
| 834 | #if SNAPDUMP
|
---|
| 835 | if (debugsw AND snapit)
|
---|
| 836 | SnapPTV("ptdest");
|
---|
| 837 | #endif
|
---|
| 838 |
|
---|
[0580615] | 839 | if (du) {
|
---|
[f40a309] | 840 |
|
---|
| 841 | srdspte();
|
---|
| 842 | movectc(DATAROW, 42);
|
---|
| 843 | }
|
---|
| 844 |
|
---|
| 845 | #if DEBUGIT
|
---|
| 846 | if (debugsw AND debug01)
|
---|
| 847 | printf("ptdest(%d): exit\n", du);
|
---|
| 848 | #endif
|
---|
| 849 | }
|
---|
| 850 |
|
---|
| 851 | /* |
---|
| 852 |
|
---|
| 853 | */
|
---|
| 854 |
|
---|
| 855 | /*
|
---|
| 856 | =============================================================================
|
---|
| 857 | epatch() -- enter patch and reposition cursor to the DEF field
|
---|
| 858 | =============================================================================
|
---|
| 859 | */
|
---|
| 860 |
|
---|
| 861 | void epatch(void)
|
---|
| 862 | {
|
---|
| 863 | #if DEBUGIT
|
---|
| 864 | if (debugsw AND debug01)
|
---|
| 865 | printf("epatch(): entry\n");
|
---|
| 866 | #endif
|
---|
| 867 |
|
---|
| 868 | ptedtok = TRUE; /* data just got parsed or we wouldn't be here */
|
---|
| 869 | edefstm(0, 0); /* parse def */
|
---|
| 870 | edefstm(0, 1); /* parse stm */
|
---|
| 871 | ptdest(0); /* parse dest */
|
---|
| 872 | entrpte(); /* enter the patch */
|
---|
| 873 | srdspte(); /* adjust the display */
|
---|
[0580615] | 874 | movectc(DATAROW, 2); /* reposition the cursor */
|
---|
[f40a309] | 875 |
|
---|
| 876 | #if SNAPDUMP
|
---|
| 877 | if (debugsw AND snapit)
|
---|
| 878 | SnapPTV("epatch");
|
---|
| 879 | #endif
|
---|
| 880 |
|
---|
| 881 | #if DEBUGIT
|
---|
| 882 | if (debugsw AND debug01)
|
---|
| 883 | printf("epatch(): exit\n");
|
---|
| 884 | #endif
|
---|
| 885 | }
|
---|
[0580615] | 886 |
|
---|
[f40a309] | 887 | /* |
---|
| 888 |
|
---|
| 889 | */
|
---|
| 890 |
|
---|
| 891 | /*
|
---|
| 892 | =============================================================================
|
---|
| 893 | badpdat() -- position cursor at bad data field
|
---|
| 894 | =============================================================================
|
---|
| 895 | */
|
---|
| 896 |
|
---|
| 897 | void badpdat(void)
|
---|
| 898 | {
|
---|
| 899 | ptedtok = FALSE;
|
---|
| 900 | movectc(DATAROW, 42);
|
---|
| 901 | }
|
---|
[0580615] | 902 |
|
---|
[f40a309] | 903 | /*
|
---|
| 904 | =============================================================================
|
---|
| 905 | setsubm() -- setup submenu
|
---|
| 906 | =============================================================================
|
---|
| 907 | */
|
---|
| 908 |
|
---|
| 909 | void setsubm(short r, short c)
|
---|
| 910 | {
|
---|
| 911 | submenu = TRUE;
|
---|
| 912 | cmtype = CT_MENU;
|
---|
| 913 | mtcpos(r, c);
|
---|
| 914 | }
|
---|
| 915 |
|
---|
| 916 | /* |
---|
| 917 |
|
---|
| 918 | */
|
---|
| 919 |
|
---|
| 920 | /*
|
---|
| 921 | =============================================================================
|
---|
| 922 | ptfnbox() -- patch display box hit processor
|
---|
| 923 | =============================================================================
|
---|
| 924 | */
|
---|
| 925 |
|
---|
| 926 | short ptfnbox(short n)
|
---|
| 927 | {
|
---|
| 928 | register short i, box, ptd, ptt;
|
---|
| 929 | register long ltemp;
|
---|
| 930 |
|
---|
| 931 | if (NOT submenu) { /* PATCH DATA ENTRY LINE */
|
---|
| 932 |
|
---|
| 933 | if (inrange(stccol, 2, 13)) { /* DEFINER */
|
---|
| 934 |
|
---|
| 935 | ptedftp = 1; /* def */
|
---|
| 936 |
|
---|
| 937 | if (inrange(stccol, 2, 4)) { /* select */
|
---|
| 938 |
|
---|
| 939 | setsubm(19, 2);
|
---|
| 940 |
|
---|
| 941 | } else { /* enter */
|
---|
| 942 |
|
---|
| 943 | edefstm(0, 1);
|
---|
| 944 | ptdest(0);
|
---|
| 945 | edefstm(1, 0);
|
---|
| 946 | }
|
---|
| 947 |
|
---|
| 948 | return(SUCCESS);
|
---|
| 949 |
|
---|
| 950 | } else if (inrange(stccol, 15, 26)) { /* STIMULUS */
|
---|
| 951 |
|
---|
| 952 | ptedftp = 2; /* stm */
|
---|
| 953 |
|
---|
| 954 | if (inrange(stccol, 15, 17)) { /* select */
|
---|
| 955 |
|
---|
| 956 | setsubm(19, 2);
|
---|
| 957 |
|
---|
| 958 | } else { /* enter */
|
---|
| 959 |
|
---|
| 960 | edefstm(0 ,0);
|
---|
| 961 | ptdest(0);
|
---|
| 962 | edefstm(1, 1);
|
---|
| 963 | }
|
---|
| 964 |
|
---|
| 965 | return(SUCCESS);
|
---|
| 966 | /* |
---|
| 967 |
|
---|
| 968 | */
|
---|
| 969 | } else if (inrange(stccol, 28, 40)) { /* DESTINATION */
|
---|
| 970 |
|
---|
| 971 | ptedftp = 0; /* not def/stm */
|
---|
| 972 |
|
---|
| 973 | if (stccol EQ 28) { /* select */
|
---|
| 974 |
|
---|
| 975 | setsubm(19, 2);
|
---|
| 976 |
|
---|
| 977 | } else if (ptemenu EQ HT_3) {
|
---|
| 978 |
|
---|
| 979 | setsubm(20, 22);
|
---|
| 980 |
|
---|
| 981 | } else if ((ptemenu EQ HT_4) OR
|
---|
| 982 | (ptemenu EQ HT_5)) {
|
---|
| 983 |
|
---|
| 984 | setsubm(19, 43);
|
---|
| 985 |
|
---|
| 986 | } else { /* enter */
|
---|
| 987 |
|
---|
| 988 | edefstm(0, 0);
|
---|
| 989 | edefstm(0, 1);
|
---|
| 990 | ptdest(1);
|
---|
| 991 | }
|
---|
| 992 |
|
---|
| 993 | return(SUCCESS);
|
---|
| 994 | /* |
---|
| 995 |
|
---|
| 996 | */
|
---|
| 997 | } else if (inrange(stccol, 42, 46)) { /* DATUM */
|
---|
| 998 |
|
---|
| 999 | ptedftp = 0; /* not def/stm */
|
---|
| 1000 | setptcv(); /* setup control variables */
|
---|
| 1001 |
|
---|
| 1002 | #if DEBUGIT
|
---|
| 1003 | if (debugsw AND debug01)
|
---|
| 1004 | SnapPTV("ptfnbox");
|
---|
| 1005 | #endif
|
---|
| 1006 | switch (ptedata) { /* switch on Datum format */
|
---|
| 1007 |
|
---|
| 1008 | case 0: /* -none- */
|
---|
| 1009 |
|
---|
| 1010 | ptedtok = FALSE;
|
---|
| 1011 | return(FAILURE);
|
---|
| 1012 |
|
---|
| 1013 | case 1: /* multiplier -- +1.00 */
|
---|
| 1014 |
|
---|
| 1015 | ebuf[0] = ptdebuf[43];
|
---|
| 1016 | ebuf[1] = ptdebuf[45];
|
---|
| 1017 | ebuf[2] = ptdebuf[46];
|
---|
| 1018 | ebuf[3] = ptdebuf[42];
|
---|
| 1019 |
|
---|
| 1020 | if (0xFFFF EQ (i = dec2fr(ebuf))) {
|
---|
| 1021 |
|
---|
| 1022 | badpdat();
|
---|
| 1023 | return(FAILURE);
|
---|
| 1024 | }
|
---|
| 1025 |
|
---|
| 1026 | ptedat2 = i;
|
---|
| 1027 | epatch(); /* enter -- multiplier */
|
---|
| 1028 | return(SUCCESS);
|
---|
| 1029 | /* |
---|
| 1030 |
|
---|
| 1031 | */
|
---|
| 1032 | case 2: /* time -- 32767 */
|
---|
| 1033 |
|
---|
| 1034 | ltemp = 0;
|
---|
| 1035 |
|
---|
| 1036 | for (i = 42; i < 47; i++)
|
---|
| 1037 | ltemp = (ltemp * 10) + (ptdebuf[i] - '0');
|
---|
| 1038 |
|
---|
| 1039 | if (ltemp > 32767L) {
|
---|
| 1040 |
|
---|
| 1041 | badpdat();
|
---|
| 1042 | return(FAILURE);
|
---|
| 1043 | }
|
---|
| 1044 |
|
---|
| 1045 | ptedat2 = tofpu((unsigned short)ltemp);
|
---|
| 1046 | epatch(); /* enter -- time */
|
---|
| 1047 | return(SUCCESS);
|
---|
| 1048 |
|
---|
| 1049 | case 3: /* value -- +10.00 */
|
---|
| 1050 |
|
---|
| 1051 | i = ptdebuf[42] & 0x00FF;
|
---|
| 1052 |
|
---|
| 1053 | if ((i EQ '\240') OR (i EQ '\241'))
|
---|
| 1054 | ltemp = 1000;
|
---|
| 1055 | else
|
---|
| 1056 | ltemp = 0;
|
---|
| 1057 |
|
---|
| 1058 | ltemp += ((ptdebuf[43] - '0') * 100) +
|
---|
| 1059 | ((ptdebuf[45] - '0') * 10) +
|
---|
| 1060 | (ptdebuf[46] - '0');
|
---|
| 1061 |
|
---|
| 1062 | if (ltemp > 1000L) {
|
---|
| 1063 |
|
---|
| 1064 | badpdat();
|
---|
| 1065 | return(FAILURE);
|
---|
| 1066 | }
|
---|
| 1067 |
|
---|
| 1068 | if ((i EQ '-') OR (i EQ '\241'))
|
---|
| 1069 | ltemp = -ltemp;
|
---|
| 1070 |
|
---|
| 1071 | ptedat2 = ltemp << 5;
|
---|
| 1072 | epatch(); /* enter -- value */
|
---|
| 1073 | return(SUCCESS);
|
---|
| 1074 |
|
---|
| 1075 | /* |
---|
| 1076 |
|
---|
| 1077 | */
|
---|
| 1078 | case 4: /* interval -- +1200 */
|
---|
| 1079 |
|
---|
| 1080 | ltemp = 0;
|
---|
| 1081 |
|
---|
| 1082 | for (i = 43; i < 47; i++)
|
---|
| 1083 | ltemp = (ltemp * 10) + (ptdebuf[i] - '0');
|
---|
| 1084 |
|
---|
| 1085 | if (ltemp > 1200L) {
|
---|
| 1086 |
|
---|
| 1087 | badpdat();
|
---|
| 1088 | return(FAILURE);
|
---|
| 1089 | }
|
---|
| 1090 |
|
---|
| 1091 | if (ptdebuf[42] EQ '-')
|
---|
| 1092 | ltemp = -ltemp;
|
---|
| 1093 |
|
---|
| 1094 | ptedat2 = ltemp << 1;
|
---|
| 1095 | epatch(); /* enter -- interval */
|
---|
| 1096 | return(SUCCESS);
|
---|
| 1097 | /* |
---|
| 1098 |
|
---|
| 1099 | */
|
---|
| 1100 | case 5: /* ratio -- 9/9 */
|
---|
| 1101 |
|
---|
| 1102 | ptedat2 = ndvals[ptdebuf[42] - '0'] -
|
---|
| 1103 | ndvals[ptdebuf[44] - '0'];
|
---|
| 1104 |
|
---|
| 1105 | epatch(); /* enter -- ratio */
|
---|
| 1106 | return(SUCCESS);
|
---|
| 1107 |
|
---|
| 1108 | case 6: /* frequency -- 15.9 */
|
---|
| 1109 |
|
---|
| 1110 | ltemp = ((ptdebuf[42] - '0') * 100) +
|
---|
| 1111 | ((ptdebuf[43] - '0') * 10) +
|
---|
| 1112 | (ptdebuf[45] - '0');
|
---|
| 1113 |
|
---|
| 1114 | if (ltemp > 159L) {
|
---|
| 1115 |
|
---|
| 1116 | badpdat();
|
---|
| 1117 | return(FAILURE);
|
---|
| 1118 | }
|
---|
| 1119 |
|
---|
| 1120 | ptedat2 = ltemp << 1;
|
---|
| 1121 | epatch(); /* enter -- frequency */
|
---|
| 1122 | return(SUCCESS);
|
---|
| 1123 |
|
---|
| 1124 | case 7: /* pitch -- 9C#99 */
|
---|
| 1125 |
|
---|
| 1126 | memcpy(ebuf,& ptdebuf[42], 5);
|
---|
| 1127 |
|
---|
| 1128 | if (FAILURE EQ cnvp2c()) {
|
---|
| 1129 |
|
---|
| 1130 | badpdat();
|
---|
| 1131 | return(FAILURE);
|
---|
| 1132 | }
|
---|
| 1133 |
|
---|
| 1134 | ptedat2 = cents;
|
---|
| 1135 | epatch(); /* enter - pitch */
|
---|
| 1136 | return(SUCCESS);
|
---|
| 1137 | /* |
---|
| 1138 |
|
---|
| 1139 | */
|
---|
| 1140 | case 8: /* trans/stop/start */
|
---|
| 1141 | case 9: /* stop/start */
|
---|
| 1142 | case 10: /* off/on */
|
---|
| 1143 |
|
---|
| 1144 | epatch(); /* enter -- control */
|
---|
| 1145 | return(SUCCESS);
|
---|
| 1146 |
|
---|
| 1147 | case 11: /* source */
|
---|
| 1148 |
|
---|
| 1149 | if (stccol EQ 42)
|
---|
| 1150 | setsubm(19, 49); /* select */
|
---|
| 1151 | else
|
---|
| 1152 | epatch(); /* enter -- source */
|
---|
| 1153 |
|
---|
| 1154 | return(SUCCESS);
|
---|
| 1155 |
|
---|
| 1156 | case 12: /* register/value -- R16 | +99 */
|
---|
| 1157 |
|
---|
| 1158 | ltemp = ((ptdebuf[43] - '0') * 10) +
|
---|
| 1159 | (ptdebuf[44] - '0');
|
---|
| 1160 |
|
---|
| 1161 | if (ptdebuf[42] EQ 'R') {
|
---|
| 1162 |
|
---|
| 1163 | if ((ltemp EQ 0) OR (ltemp > 16L)) {
|
---|
| 1164 |
|
---|
| 1165 | badpdat();
|
---|
| 1166 | return(FAILURE);
|
---|
| 1167 | }
|
---|
| 1168 |
|
---|
| 1169 | --ltemp;
|
---|
| 1170 | ptedat1 = 1;
|
---|
| 1171 |
|
---|
| 1172 | } else {
|
---|
| 1173 |
|
---|
| 1174 | ptedat1 = 0;
|
---|
| 1175 | }
|
---|
| 1176 |
|
---|
| 1177 | ptedat2 = ltemp;
|
---|
| 1178 | epatch(); /* enter -- register | value */
|
---|
| 1179 | return(SUCCESS);
|
---|
| 1180 | /* |
---|
| 1181 |
|
---|
| 1182 | */
|
---|
| 1183 | case 13: /* sequence line */
|
---|
| 1184 |
|
---|
| 1185 | ltemp = 0;
|
---|
| 1186 |
|
---|
| 1187 | for (i = 42; i < 45; i++)
|
---|
| 1188 | ltemp = (ltemp * 10) + (ptdebuf[i] - '0');
|
---|
| 1189 |
|
---|
| 1190 | ptedat1 = ltemp;
|
---|
| 1191 | epatch(); /* enter -- sequence line */
|
---|
| 1192 | return(SUCCESS);
|
---|
| 1193 |
|
---|
| 1194 | case 14: /* LED controls */
|
---|
| 1195 |
|
---|
| 1196 | ltemp = 0;
|
---|
| 1197 |
|
---|
| 1198 | if (ptesuba & 0x0001) {
|
---|
| 1199 |
|
---|
| 1200 | for (i = 42; i < 46; i++)
|
---|
| 1201 | ltemp = (ltemp << 2) | (ptdebuf[i] - '0');
|
---|
| 1202 |
|
---|
| 1203 | ptedat1 = ltemp << 8;
|
---|
| 1204 |
|
---|
| 1205 | } else {
|
---|
| 1206 |
|
---|
| 1207 | for (i = 42; i < 45; i++)
|
---|
| 1208 | ltemp = (ltemp << 2) | (ptdebuf[i] - '0');
|
---|
| 1209 |
|
---|
| 1210 | ptedat1 = ltemp << 10;
|
---|
| 1211 | }
|
---|
| 1212 |
|
---|
| 1213 | epatch(); /* enter -- LED controls */
|
---|
| 1214 | return(SUCCESS);
|
---|
| 1215 |
|
---|
| 1216 | /* |
---|
| 1217 |
|
---|
| 1218 | */
|
---|
| 1219 | case 15: /* instrument number */
|
---|
| 1220 |
|
---|
| 1221 | ltemp = ((ptdebuf[42] - '0') * 10) +
|
---|
| 1222 | (ptdebuf[43] - '0');
|
---|
| 1223 |
|
---|
| 1224 | if (ltemp > 40L) {
|
---|
| 1225 |
|
---|
| 1226 | badpdat();
|
---|
| 1227 | return(FAILURE);
|
---|
| 1228 | }
|
---|
| 1229 |
|
---|
| 1230 | ptedat1 = ltemp;
|
---|
| 1231 | epatch(); /* enter -- instrument number */
|
---|
| 1232 | return(SUCCESS);
|
---|
| 1233 |
|
---|
| 1234 | case 16: /* waveshape number */
|
---|
| 1235 |
|
---|
| 1236 | ltemp = ((ptdebuf[42] - '0') * 10) +
|
---|
| 1237 | (ptdebuf[43] - '0');
|
---|
| 1238 |
|
---|
| 1239 | if ((ltemp EQ 0) OR (ltemp > 20L)) {
|
---|
| 1240 |
|
---|
| 1241 | badpdat();
|
---|
| 1242 | return(FAILURE);
|
---|
| 1243 | }
|
---|
| 1244 |
|
---|
| 1245 | ptedat1 = ltemp;
|
---|
| 1246 | epatch(); /* enter -- waveshape number */
|
---|
| 1247 | return(SUCCESS);
|
---|
| 1248 | /* |
---|
| 1249 |
|
---|
| 1250 | */
|
---|
| 1251 | case 17: /* configuration number */
|
---|
| 1252 |
|
---|
| 1253 | ltemp = ((ptdebuf[42] - '0') * 10) +
|
---|
| 1254 | (ptdebuf[43] - '0');
|
---|
| 1255 |
|
---|
| 1256 | if (ltemp > 11L) {
|
---|
| 1257 |
|
---|
| 1258 | badpdat();
|
---|
| 1259 | return(FAILURE);
|
---|
| 1260 | }
|
---|
| 1261 |
|
---|
| 1262 | ptedat1 = ltemp;
|
---|
| 1263 | epatch(); /* enter -- configuration number */
|
---|
| 1264 | return(SUCCESS);
|
---|
| 1265 |
|
---|
| 1266 | case 18: /* tuning table number */
|
---|
| 1267 |
|
---|
| 1268 | ptedat1 = ptdebuf[42] - '0';
|
---|
| 1269 | epatch(); /* enter -- tuning table number */
|
---|
| 1270 | return(SUCCESS);
|
---|
| 1271 |
|
---|
| 1272 | default: /* something weird got in here ... */
|
---|
| 1273 |
|
---|
| 1274 | ptedtok = FALSE;
|
---|
| 1275 | return(FAILURE);
|
---|
| 1276 | }
|
---|
| 1277 | }
|
---|
| 1278 |
|
---|
| 1279 | return(FAILURE);
|
---|
| 1280 | /* |
---|
| 1281 |
|
---|
| 1282 | */
|
---|
| 1283 | } else { /* SUBMENU SELECTION */
|
---|
| 1284 |
|
---|
| 1285 | /* determine the "box" we're pointing at */
|
---|
| 1286 |
|
---|
| 1287 | if (inrange(vtccol, 2, 4))
|
---|
| 1288 | box = vtcrow - 18;
|
---|
| 1289 | else if (inrange(vtccol, 7, 12))
|
---|
| 1290 | box = vtcrow - 13;
|
---|
| 1291 | else if (inrange(vtccol, 15, 19))
|
---|
| 1292 | box = vtcrow - 8;
|
---|
| 1293 | else if (inrange(vtccol, 22, 26))
|
---|
| 1294 | box = vtcrow - 3;
|
---|
| 1295 | else if (inrange(vtccol, 29, 33))
|
---|
| 1296 | box = vtcrow + 2;
|
---|
| 1297 | else if (inrange(vtccol, 36, 40))
|
---|
| 1298 | box = vtcrow + 7;
|
---|
| 1299 | else if (inrange(vtccol, 43, 46))
|
---|
| 1300 | box = vtcrow + 12;
|
---|
| 1301 | else if (inrange(vtccol, 49, 53))
|
---|
| 1302 | box = vtcrow + 17;
|
---|
| 1303 | else if (inrange(vtccol, 56, 60))
|
---|
| 1304 | box = vtcrow + 22;
|
---|
| 1305 | else
|
---|
| 1306 | return(FAILURE);
|
---|
| 1307 |
|
---|
| 1308 | /* |
---|
| 1309 |
|
---|
| 1310 | */
|
---|
| 1311 | switch (ptemenu) { /* switch on submenu type */
|
---|
| 1312 |
|
---|
| 1313 | case HT_0: /* DEFINERS / STIMULLI */
|
---|
| 1314 |
|
---|
| 1315 | if (inrange(box, 1, 4)) { /* Key, Rel, Trg, Pls */
|
---|
| 1316 |
|
---|
| 1317 | i = box - 1;
|
---|
| 1318 | ptedfst = dfsttp[i];
|
---|
| 1319 |
|
---|
| 1320 | if (ptedftp EQ 1) { /* def */
|
---|
| 1321 |
|
---|
| 1322 | ptedfok = TRUE;
|
---|
| 1323 | ptbflag = TRUE;
|
---|
| 1324 |
|
---|
| 1325 | ptedef = dfsttab[i];
|
---|
| 1326 |
|
---|
| 1327 | strcpy(&ptdebuf[2], rawdfst[i]);
|
---|
| 1328 |
|
---|
| 1329 | UpdVid(7, 2, rawdfst[i], PTDATR);
|
---|
| 1330 | endpsm(DATAROW, defcols[ptedfst]);
|
---|
| 1331 |
|
---|
| 1332 | return(SUCCESS);
|
---|
| 1333 |
|
---|
| 1334 | } else if (ptedftp EQ 2) { /* stm */
|
---|
| 1335 |
|
---|
| 1336 | ptestok = TRUE;
|
---|
| 1337 | ptbflag = TRUE;
|
---|
| 1338 |
|
---|
| 1339 | ptestm = dfsttab[i];
|
---|
| 1340 |
|
---|
| 1341 | strcpy(&ptdebuf[15], rawdfst[i]);
|
---|
| 1342 |
|
---|
| 1343 | UpdVid(7, 15, rawdfst[i], PTDATR);
|
---|
| 1344 | endpsm(DATAROW, stmcols[ptedfst]);
|
---|
| 1345 |
|
---|
| 1346 | return(SUCCESS);
|
---|
| 1347 | }
|
---|
| 1348 | }
|
---|
| 1349 |
|
---|
| 1350 | return(FAILURE);
|
---|
| 1351 | /* |
---|
| 1352 |
|
---|
| 1353 | */
|
---|
| 1354 | case HT_1: /* SOURCES */
|
---|
| 1355 |
|
---|
| 1356 | if (inrange(box, 36, 45)) {
|
---|
| 1357 |
|
---|
| 1358 | ptedtok = TRUE;
|
---|
| 1359 | ptbflag = TRUE;
|
---|
| 1360 |
|
---|
| 1361 | ptedat2 = datasrc[box - 36];
|
---|
| 1362 |
|
---|
| 1363 | strcpy(&ptdebuf[42], smdata[ptedat2]);
|
---|
| 1364 |
|
---|
| 1365 | UpdVid(7, 42, smdata[ptedat2], PTDATR);
|
---|
| 1366 | endpsm(DATAROW, 46);
|
---|
| 1367 |
|
---|
| 1368 | return(SUCCESS);
|
---|
| 1369 | }
|
---|
| 1370 |
|
---|
| 1371 | return(FAILURE);
|
---|
| 1372 | /* |
---|
| 1373 |
|
---|
| 1374 | */
|
---|
| 1375 | case HT_2: /* DESTINATIONS */
|
---|
| 1376 |
|
---|
| 1377 | i = box - 1;
|
---|
| 1378 | ptt = destype[i];
|
---|
| 1379 |
|
---|
| 1380 | if (ptt NE -1) {
|
---|
| 1381 |
|
---|
| 1382 | ptedsok = TRUE;
|
---|
| 1383 | ptedtok = TRUE;
|
---|
| 1384 | ptbflag = TRUE;
|
---|
| 1385 |
|
---|
| 1386 | ptedest = destfmt[i];
|
---|
| 1387 | ptedata = datafmt[i];
|
---|
| 1388 | ptespec = ptt;
|
---|
| 1389 | ptesuba = 0x0000;
|
---|
| 1390 | ptedat1 = 0x0000;
|
---|
| 1391 | ptedat2 = 0x0000;
|
---|
| 1392 |
|
---|
| 1393 | if (ptd = desdatf[i]) {
|
---|
| 1394 |
|
---|
| 1395 | if (ptd & 1)
|
---|
| 1396 | ptedat1 = desdat1[i];
|
---|
| 1397 |
|
---|
| 1398 | if (ptd & 2)
|
---|
| 1399 | ptedat2 = desdat2[i];
|
---|
| 1400 | }
|
---|
| 1401 |
|
---|
| 1402 | strcpy(&ptdebuf[28], rawdest[ptt]);
|
---|
| 1403 | strcpy(&ptdebuf[42], rawdata[i]);
|
---|
| 1404 |
|
---|
| 1405 | UpdVid(7, 28, rawdest[ptt], PTDATR);
|
---|
| 1406 | UpdVid(7, 42, rawdata[i], PTDATR);
|
---|
| 1407 | endpsm(DATAROW, dstcols[1 + ptedest]);
|
---|
| 1408 |
|
---|
| 1409 | return(SUCCESS);
|
---|
| 1410 | }
|
---|
| 1411 |
|
---|
| 1412 | return(FAILURE);
|
---|
| 1413 | /* |
---|
| 1414 |
|
---|
| 1415 | */
|
---|
| 1416 | case HT_3: /* OSCILLATOR MODES */
|
---|
| 1417 |
|
---|
| 1418 | if (inrange(box, 17, 20)) {
|
---|
| 1419 |
|
---|
| 1420 | i = box - 17;
|
---|
| 1421 |
|
---|
| 1422 | ptedsok = TRUE;
|
---|
| 1423 | ptedtok = TRUE;
|
---|
| 1424 | ptbflag = TRUE;
|
---|
| 1425 |
|
---|
| 1426 | ptedat1 = omtabl[i];
|
---|
| 1427 | ptedat2 = omdtab[i];
|
---|
| 1428 |
|
---|
| 1429 | ptedata = omftab[i];
|
---|
| 1430 |
|
---|
| 1431 | strcpy(&ptdebuf[34], rawmode[i]);
|
---|
| 1432 | strcpy(&ptdebuf[42], rawmdat[i]);
|
---|
| 1433 |
|
---|
| 1434 | UpdVid(7, 34, rawmode[i], PTDATR);
|
---|
| 1435 | UpdVid(7, 42, rawmdat[i], PTDATR);
|
---|
| 1436 | endpsm(DATAROW, 39);
|
---|
| 1437 |
|
---|
| 1438 | return(SUCCESS);
|
---|
| 1439 | }
|
---|
| 1440 |
|
---|
| 1441 | return(FAILURE);
|
---|
| 1442 | /* |
---|
| 1443 |
|
---|
| 1444 | */
|
---|
| 1445 | case HT_5: /* FPU OUTPUTS WITHOUT FUNCTIONS */
|
---|
| 1446 |
|
---|
| 1447 | if (NOT inrange(box, 31, 34))
|
---|
| 1448 | return(FAILURE);
|
---|
| 1449 |
|
---|
| 1450 | case HT_4: /* FPU OUTPUTS WITH FUNCTIONS */
|
---|
| 1451 |
|
---|
| 1452 | if (NOT inrange(box, 31, 35))
|
---|
| 1453 | return(FAILURE);
|
---|
| 1454 |
|
---|
| 1455 | i = box - 31;
|
---|
| 1456 |
|
---|
| 1457 | ptedsok = TRUE;
|
---|
| 1458 | ptedtok = TRUE;
|
---|
| 1459 | ptbflag = TRUE;
|
---|
| 1460 |
|
---|
| 1461 | ptedat1 = i;
|
---|
| 1462 | ptedat2 = fpudtab[i];
|
---|
| 1463 |
|
---|
| 1464 | ptedata = fpuetab[i];
|
---|
| 1465 |
|
---|
| 1466 | strcpy(&ptdebuf[34], stdata[i]);
|
---|
| 1467 | strcpy(&ptdebuf[42], rawfpud[i]);
|
---|
| 1468 |
|
---|
| 1469 | UpdVid(7, 34, stdata[i], PTDATR);
|
---|
| 1470 | UpdVid(7, 42, rawfpud[i], PTDATR);
|
---|
| 1471 | endpsm(DATAROW, 42);
|
---|
| 1472 |
|
---|
| 1473 | return(SUCCESS);
|
---|
| 1474 |
|
---|
| 1475 | default: /* -BOGUS- */
|
---|
| 1476 |
|
---|
| 1477 | endpsm(stcrow, stccol);
|
---|
| 1478 |
|
---|
| 1479 | return(FAILURE);
|
---|
| 1480 | }
|
---|
| 1481 | }
|
---|
| 1482 |
|
---|
| 1483 | return(FAILURE);
|
---|
| 1484 | }
|
---|