[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | sqselbx.c -- MIDAS-VII sequence editor box selection functions
|
---|
| 4 | Version 19 -- 1988-11-18 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include "stddefs.h"
|
---|
| 9 | #include "fields.h"
|
---|
| 10 | #include "vsdd.h"
|
---|
| 11 | #include "graphdef.h"
|
---|
| 12 | #include "patch.h"
|
---|
| 13 | #include "macros.h"
|
---|
| 14 | #include "curpak.h"
|
---|
| 15 |
|
---|
| 16 | #include "midas.h"
|
---|
| 17 | #include "ptdisp.h"
|
---|
| 18 |
|
---|
[e225e77] | 19 | #include "memory.h"
|
---|
| 20 |
|
---|
[f40a309] | 21 | #define ST_0 0x01 /* initial Action 1 or Action 2*/
|
---|
| 22 | #define ST_1 0x02 /* operand type */
|
---|
| 23 | #define ST_2 0x04 /* initial Action 3*/
|
---|
| 24 |
|
---|
| 25 | #define ST_OFF 0x00 /* cancel highlighting */
|
---|
| 26 |
|
---|
| 27 | /* |
---|
| 28 |
|
---|
| 29 | */
|
---|
[7258c6a] | 30 |
|
---|
| 31 | extern int16_t cmtype;
|
---|
| 32 | extern int16_t curslin;
|
---|
| 33 | extern int16_t stccol;
|
---|
| 34 | extern int16_t stcrow;
|
---|
| 35 | extern int16_t submenu;
|
---|
| 36 | extern int16_t vtccol;
|
---|
[f40a309] | 37 | extern int16_t vtcrow;
|
---|
[7258c6a] | 38 |
|
---|
[f40a309] | 39 | extern int8_t actlft[];
|
---|
[7258c6a] | 40 |
|
---|
[f40a309] | 41 | extern int16_t sqatype[];
|
---|
[7258c6a] | 42 |
|
---|
[f40a309] | 43 | extern uint16_t *obj11;
|
---|
[7258c6a] | 44 |
|
---|
| 45 | int16_t action; /* current action column */
|
---|
| 46 | int16_t sqdeflg; /* sequence data entry buffer filled */
|
---|
[f40a309] | 47 | int16_t sqmenu; /* sqeuence submenu state */
|
---|
[7258c6a] | 48 |
|
---|
[f40a309] | 49 | int8_t sqdebuf[50]; /* sequence data entry buffer */
|
---|
| 50 |
|
---|
| 51 | struct seqent seqbuf; /* sequence line buffer */
|
---|
[7258c6a] | 52 |
|
---|
[f40a309] | 53 | int16_t sqfnbox(int16_t n);
|
---|
[e225e77] | 54 |
|
---|
| 55 | extern void ctcon(void);
|
---|
| 56 | extern void ctcpos(int16_t row, int16_t col);
|
---|
| 57 | extern void dcursq(void);
|
---|
| 58 | extern void dsqlin(int8_t *buf, int16_t slin);
|
---|
| 59 | extern void dstw(void);
|
---|
| 60 | extern void mtcoff(void);
|
---|
| 61 | extern void mtcpos(int16_t row, int16_t col);
|
---|
| 62 | extern void vsetcv(uint16_t *adr, uint16_t row, uint16_t col, uint16_t cfb, uint16_t len);
|
---|
[f40a309] | 63 |
|
---|
| 64 | /* |
---|
| 65 |
|
---|
[7258c6a] | 66 | */
|
---|
[f40a309] | 67 |
|
---|
| 68 | int8_t sqhilit[][8] = { /* submenu highlight table */
|
---|
| 69 |
|
---|
| 70 | /* start, width, row1, row2, row3, row4, row5, pad */
|
---|
| 71 |
|
---|
| 72 | { 2, 13, ST_0|ST_2, ST_0|ST_2, ST_0|ST_2, ST_0, 0, 0},
|
---|
| 73 | { 17, 11, ST_0|ST_2, ST_0|ST_2, ST_0|ST_2, ST_0, 0, 0},
|
---|
| 74 | { 30, 11, ST_0|ST_2, ST_0|ST_2, 0, ST_0, 0, 0},
|
---|
| 75 | { 43, 8, ST_0|ST_2, ST_0|ST_2, ST_0, ST_0, ST_0, 0},
|
---|
| 76 | { 53, 8, ST_1, ST_1, ST_1, ST_1, 0, 0},
|
---|
| 77 | };
|
---|
| 78 |
|
---|
| 79 | struct selbox sqboxes[] = { /* selection boxes */
|
---|
| 80 |
|
---|
| 81 | {CTOX(1), RTOY(DATAROW), CTOX(48)-1, RTOY(1+DATAROW)-1, 0, sqfnbox}, /* current patch */
|
---|
| 82 |
|
---|
| 83 | { 0, 0, 0, 0, 0, FN_NULL}
|
---|
[7258c6a] | 84 | };
|
---|
[f40a309] | 85 |
|
---|
| 86 | int8_t sqopreq[] = { /* action needs operand type flag table */
|
---|
| 87 |
|
---|
| 88 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1
|
---|
[7258c6a] | 89 | };
|
---|
[f40a309] | 90 |
|
---|
| 91 | int8_t nextact[] = { 24, 36, 6 }; /* next column after action entry */
|
---|
| 92 |
|
---|
| 93 | /* |
---|
[7258c6a] | 94 |
|
---|
[f40a309] | 95 | */
|
---|
| 96 |
|
---|
| 97 | int16_t sqidata[] = { /* intial data by box */
|
---|
| 98 |
|
---|
| 99 | 0x0000, /* " " 0 */
|
---|
| 100 | 0x0000, /* "Kt 001 1 01" 1 */
|
---|
| 101 | 0x0000, /* "Kc 001 1 01" 2 */
|
---|
| 102 | 0x0000, /* "Kr 001 1 01" 3 */
|
---|
| 103 | 0x0000, /* "If 001 1 01" 4 */
|
---|
| 104 | 0x0000, /* "Trig on 01" 5 */
|
---|
| 105 | 0x0000, /* "Trig off 01" 6 */
|
---|
| 106 | 0x0000, /* "Trig tgl 01" 7 */
|
---|
| 107 | 0x0000, /* "If trig 01" 8 */
|
---|
| 108 | 0x0000, /* "Stop " 9 */
|
---|
| 109 | 0x0000, /* "Jump to 000" 10 */
|
---|
| 110 | 0x0000, /* "???????????" 11 */
|
---|
| 111 | 0x0000, /* "If stim act" 12 */
|
---|
| 112 | SQ_VAL, /* "Set R01=00 " 13 */
|
---|
| 113 | SQ_VAL, /* "Inc R01+00 " 14 */
|
---|
| 114 | SQ_VAL, /* "If R01=00 " 15 */
|
---|
| 115 | SQ_VAL, /* "If R01<00 " 16 */
|
---|
| 116 | SQ_VAL /* "If R01>00 " 17 */
|
---|
| 117 | };
|
---|
| 118 |
|
---|
[7258c6a] | 119 | /* |
---|
[f40a309] | 120 |
|
---|
| 121 | */
|
---|
| 122 |
|
---|
| 123 | int8_t actcol[] = { /* action data entry column by action */
|
---|
[7258c6a] | 124 |
|
---|
[f40a309] | 125 | 0, 3, 3, 3, 3, 9, 9, 9, 9, 5, 5, 5, 5, 10, 8, 3, 5
|
---|
[7258c6a] | 126 | };
|
---|
[f40a309] | 127 |
|
---|
[7258c6a] | 128 | int8_t sqvcol[] = { 9, 8, 9, 9 }; /* value entry column - type order */
|
---|
[f40a309] | 129 |
|
---|
| 130 | int8_t seqvcol[] = { 8, 8, 9, 9, 9 }; /* value entry column - box order */
|
---|
| 131 |
|
---|
| 132 | int16_t sqndata[] = { /* data types in box order */
|
---|
| 133 |
|
---|
| 134 | SQ_VAL, SQ_REG, SQ_VLT, SQ_RND
|
---|
| 135 | };
|
---|
| 136 |
|
---|
| 137 | /* |
---|
| 138 |
|
---|
| 139 | */
|
---|
| 140 |
|
---|
| 141 | /*
|
---|
[7258c6a] | 142 | =============================================================================
|
---|
[f40a309] | 143 | hilitsq() -- highlight sequence submenu
|
---|
[7258c6a] | 144 | =============================================================================
|
---|
[f40a309] | 145 | */
|
---|
| 146 |
|
---|
| 147 | void hilitsq(int8_t n)
|
---|
| 148 | {
|
---|
| 149 | register int16_t chr, h, v, w;
|
---|
| 150 |
|
---|
| 151 | sqmenu = n; /* set current submenu type */
|
---|
| 152 |
|
---|
| 153 | for (h = 0; h < 5; h++) { /* scan the columns */
|
---|
| 154 |
|
---|
| 155 | for (v = 0; v < 5; v++) { /* scan the rows */
|
---|
| 156 |
|
---|
| 157 | chr = sqhilit[h][0]; /* starting character */
|
---|
| 158 |
|
---|
| 159 | for (w = sqhilit[h][1]; w-- > 0; )
|
---|
| 160 | vsetcv(obj11, v + 1, chr++,
|
---|
| 161 | (sqhilit[h][v + 2] & n) ?
|
---|
| 162 | PTIATR : PTMATR, 64);
|
---|
| 163 | }
|
---|
| 164 | }
|
---|
| 165 | }
|
---|
| 166 |
|
---|
| 167 | /* |
---|
| 168 |
|
---|
| 169 | */
|
---|
| 170 |
|
---|
[0580615] | 171 | /*
|
---|
[f40a309] | 172 | =============================================================================
|
---|
| 173 | postcm() -- determine state after cursor motion
|
---|
| 174 | =============================================================================
|
---|
| 175 | */
|
---|
| 176 |
|
---|
| 177 | void postcm(void)
|
---|
| 178 | {
|
---|
| 179 | if (inrange(stccol, 12, 22)) {
|
---|
| 180 |
|
---|
| 181 | if (inrange(stccol, 12, 13))
|
---|
| 182 | hilitsq(ST_0);
|
---|
| 183 | else if ((sqopreq[seqbuf.seqact1 & SQ_MACT]) AND (stccol EQ 19))
|
---|
| 184 | hilitsq(ST_1);
|
---|
| 185 | else
|
---|
| 186 | hilitsq(ST_OFF);
|
---|
| 187 |
|
---|
| 188 | return;
|
---|
| 189 |
|
---|
| 190 | } else if (inrange(stccol, 24, 34)) {
|
---|
| 191 |
|
---|
| 192 | if (inrange(stccol, 24, 25))
|
---|
| 193 | hilitsq(ST_0);
|
---|
| 194 | else if ((sqopreq[seqbuf.seqact2 & SQ_MACT]) AND (stccol EQ 31))
|
---|
| 195 | hilitsq(ST_1);
|
---|
| 196 | else
|
---|
| 197 | hilitsq(ST_OFF);
|
---|
| 198 |
|
---|
| 199 | return;
|
---|
| 200 |
|
---|
| 201 | } else if (inrange(stccol, 36, 46)) {
|
---|
| 202 |
|
---|
| 203 | if (inrange(stccol, 36, 37))
|
---|
| 204 | hilitsq(ST_2);
|
---|
| 205 | else if ((sqopreq[seqbuf.seqact3 & SQ_MACT]) AND (stccol EQ 43))
|
---|
| 206 | hilitsq(ST_1);
|
---|
| 207 | else
|
---|
| 208 | hilitsq(ST_OFF);
|
---|
| 209 |
|
---|
| 210 | return;
|
---|
| 211 |
|
---|
| 212 | } else {
|
---|
| 213 |
|
---|
| 214 | hilitsq(ST_OFF);
|
---|
| 215 | return;
|
---|
| 216 | }
|
---|
| 217 | }
|
---|
| 218 |
|
---|
| 219 | /* |
---|
| 220 |
|
---|
| 221 | */
|
---|
[7258c6a] | 222 |
|
---|
[f40a309] | 223 | /*
|
---|
| 224 | =============================================================================
|
---|
| 225 | movestc() -- move cursor and reset highlighting
|
---|
| 226 | =============================================================================
|
---|
| 227 | */
|
---|
| 228 |
|
---|
| 229 | void movestc(int16_t r, int16_t c)
|
---|
| 230 | {
|
---|
| 231 | ctcpos(r, c);
|
---|
| 232 | postcm();
|
---|
| 233 | }
|
---|
[7258c6a] | 234 |
|
---|
[f40a309] | 235 | /*
|
---|
| 236 | =============================================================================
|
---|
| 237 | endssm() -- end patch submenu data entry
|
---|
| 238 | =============================================================================
|
---|
| 239 | */
|
---|
| 240 |
|
---|
| 241 | void endssm(int16_t row, int16_t col)
|
---|
| 242 | {
|
---|
| 243 | submenu = FALSE;
|
---|
| 244 | cmtype = CT_SMTH;
|
---|
| 245 |
|
---|
| 246 | mtcoff();
|
---|
| 247 | ctcon();
|
---|
| 248 | movestc(row, col);
|
---|
| 249 | }
|
---|
| 250 |
|
---|
| 251 | /* |
---|
| 252 |
|
---|
[7258c6a] | 253 | */
|
---|
[f40a309] | 254 |
|
---|
| 255 | /*
|
---|
| 256 | =============================================================================
|
---|
| 257 | setsqm() -- setup submenu
|
---|
| 258 | =============================================================================
|
---|
| 259 | */
|
---|
| 260 |
|
---|
| 261 | void setsqm(int16_t r, int16_t c)
|
---|
| 262 | {
|
---|
| 263 | submenu = TRUE;
|
---|
| 264 | cmtype = CT_MENU;
|
---|
| 265 | mtcpos(r, c);
|
---|
| 266 | }
|
---|
| 267 |
|
---|
| 268 | /* |
---|
[7258c6a] | 269 |
|
---|
[f40a309] | 270 | */
|
---|
[7258c6a] | 271 |
|
---|
| 272 | /*
|
---|
| 273 | =============================================================================
|
---|
| 274 | sqenter() -- enter an action
|
---|
[f40a309] | 275 | =============================================================================
|
---|
| 276 | */
|
---|
| 277 |
|
---|
| 278 | int16_t sqenter(void)
|
---|
| 279 | {
|
---|
| 280 | register int16_t i, lcol;
|
---|
| 281 | register int32_t ltemp;
|
---|
| 282 | register uint16_t *ap, *dp;
|
---|
| 283 | uint16_t theact, port, chan, key, val, obj, dtype;
|
---|
| 284 |
|
---|
| 285 | switch (action) {
|
---|
| 286 |
|
---|
| 287 | case 0:
|
---|
| 288 |
|
---|
| 289 | ap = &seqbuf.seqact1;
|
---|
| 290 | dp = &seqbuf.seqdat1;
|
---|
| 291 | break;
|
---|
| 292 |
|
---|
| 293 | case 1:
|
---|
| 294 |
|
---|
| 295 | ap = &seqbuf.seqact2;
|
---|
| 296 | dp = &seqbuf.seqdat2;
|
---|
| 297 | break;
|
---|
| 298 |
|
---|
| 299 | case 2:
|
---|
| 300 |
|
---|
| 301 | ap = &seqbuf.seqact3;
|
---|
| 302 | dp = &seqbuf.seqdat3;
|
---|
| 303 | break;
|
---|
| 304 |
|
---|
| 305 | default:
|
---|
| 306 |
|
---|
| 307 | action = 0;
|
---|
| 308 | movestc(DATAROW, actlft[action]);
|
---|
| 309 | return(FAILURE);
|
---|
| 310 | }
|
---|
| 311 |
|
---|
| 312 | /* |
---|
| 313 |
|
---|
| 314 | */
|
---|
| 315 | lcol = actlft[action];
|
---|
| 316 | theact = SQ_MACT & *ap;
|
---|
| 317 |
|
---|
| 318 | switch (theact) {
|
---|
| 319 |
|
---|
| 320 | case SQ_TKEY: /* "Kt 001 1 01" */
|
---|
| 321 | case SQ_CKEY: /* "Kc 001 1 01" */
|
---|
| 322 | case SQ_RKEY: /* "Kr 001 1 01" */
|
---|
| 323 | case SQ_IKEY: /* "If 001 1 01" */
|
---|
| 324 |
|
---|
| 325 | ltemp = 0;
|
---|
| 326 |
|
---|
| 327 | for (i = lcol + 3; i < lcol + 6; i++)
|
---|
| 328 | ltemp = (ltemp * 10) + (sqdebuf[i] - '0');
|
---|
| 329 |
|
---|
| 330 | if ((ltemp < 1L) OR (ltemp > 128L)) {
|
---|
| 331 |
|
---|
| 332 | movestc(DATAROW, actlft[action] + 3);
|
---|
| 333 | return(FAILURE);
|
---|
| 334 | }
|
---|
| 335 |
|
---|
| 336 | key = ltemp - 1;
|
---|
| 337 | /* |
---|
| 338 |
|
---|
| 339 | */
|
---|
| 340 | i = sqdebuf[lcol + 7];
|
---|
| 341 |
|
---|
| 342 | if ((i EQ '1') OR (i EQ '2')) {
|
---|
| 343 |
|
---|
| 344 | port = i - '1';
|
---|
| 345 |
|
---|
| 346 | } else if (i EQ 'L') {
|
---|
| 347 |
|
---|
| 348 | port = 2;
|
---|
| 349 |
|
---|
| 350 | } else {
|
---|
| 351 |
|
---|
| 352 | movestc(DATAROW, actlft[action] + 7);
|
---|
| 353 | return(FAILURE);
|
---|
| 354 | }
|
---|
| 355 |
|
---|
| 356 | ltemp = ((sqdebuf[lcol + 9] - '0') * 10) +
|
---|
| 357 | (sqdebuf[lcol + 10] - '0');
|
---|
| 358 |
|
---|
| 359 | if ((ltemp < 1L) OR (ltemp > 16L)) {
|
---|
| 360 |
|
---|
| 361 | movestc(DATAROW, actlft[action] + 9);
|
---|
| 362 | return(FAILURE);
|
---|
| 363 | }
|
---|
| 364 |
|
---|
| 365 | chan = ltemp - 1;
|
---|
| 366 | *dp = (port << 11) | (chan << 7) | key;
|
---|
| 367 |
|
---|
| 368 | break;
|
---|
| 369 | /* |
---|
| 370 |
|
---|
| 371 | */
|
---|
| 372 | case SQ_STRG: /* "Trig on 01" */
|
---|
| 373 | case SQ_CTRG: /* "Trig off 01" */
|
---|
| 374 | case SQ_TTRG: /* "Trig tgl 01" */
|
---|
| 375 |
|
---|
| 376 | ltemp = ((sqdebuf[lcol + 9] - '0') * 10)+
|
---|
| 377 | (sqdebuf[lcol + 10] - '0');
|
---|
| 378 |
|
---|
| 379 | if ((ltemp < 1L) OR (ltemp > 16)) {
|
---|
| 380 |
|
---|
| 381 | movestc(DATAROW, actlft[action] + 9);
|
---|
| 382 | return(FAILURE);
|
---|
| 383 | }
|
---|
| 384 |
|
---|
| 385 | *dp = ltemp - 1;
|
---|
| 386 |
|
---|
| 387 | break;
|
---|
| 388 |
|
---|
| 389 | case SQ_NULL: /* " " */
|
---|
| 390 | case SQ_ITRG: /* "If trig act" */
|
---|
| 391 | case SQ_STOP: /* "Stop " */
|
---|
| 392 | case SQ_ISTM: /* "If stim act" */
|
---|
| 393 |
|
---|
| 394 | break;
|
---|
| 395 |
|
---|
| 396 | case SQ_JUMP: /* "Jump to 000" */
|
---|
| 397 |
|
---|
| 398 | ltemp = 0;
|
---|
| 399 |
|
---|
| 400 | for (i = lcol + 8; i < lcol + 11; i++)
|
---|
| 401 | ltemp = (ltemp * 10) + (sqdebuf[i] - '0');
|
---|
| 402 |
|
---|
| 403 | *dp = ltemp;
|
---|
| 404 |
|
---|
| 405 | break;
|
---|
| 406 | /* |
---|
| 407 |
|
---|
| 408 | */
|
---|
| 409 | case SQ_SREG: /* "Set R01=00 " */
|
---|
| 410 | case SQ_AREG: /* "Inc R01+00 " */
|
---|
| 411 | case SQ_IREQ: /* "If R01=00 " */
|
---|
| 412 | case SQ_IRLT: /* "If R01<00 " */
|
---|
| 413 | case SQ_IRGT: /* "If R01>00 " */
|
---|
| 414 |
|
---|
| 415 | dtype = *dp & SQ_MTYP;
|
---|
| 416 |
|
---|
| 417 | ltemp = ((sqdebuf[lcol + 5] - '0') * 10) +
|
---|
| 418 | (sqdebuf[lcol + 6] - '0');
|
---|
| 419 |
|
---|
| 420 | if ((ltemp < 1) OR (ltemp > 16)) {
|
---|
| 421 |
|
---|
| 422 | movestc(DATAROW, actlft[action] + 5);
|
---|
| 423 | return(FAILURE);
|
---|
| 424 | }
|
---|
| 425 |
|
---|
| 426 | obj = ltemp - 1;
|
---|
| 427 |
|
---|
| 428 | switch (dtype) {
|
---|
| 429 |
|
---|
| 430 | case SQ_REG: /* register */
|
---|
| 431 |
|
---|
| 432 | ltemp = ((sqdebuf[lcol + 9] - '0') * 10) +
|
---|
| 433 | (sqdebuf[lcol + 10] - '0');
|
---|
| 434 |
|
---|
| 435 | if ((ltemp < 1) OR (ltemp > 16)) {
|
---|
| 436 |
|
---|
| 437 | movestc(DATAROW, actlft[action] + 9);
|
---|
| 438 | return(FAILURE);
|
---|
| 439 | }
|
---|
| 440 |
|
---|
| 441 | val = ltemp - 1;
|
---|
| 442 | break;
|
---|
| 443 |
|
---|
| 444 | case SQ_VAL: /* constant value */
|
---|
| 445 |
|
---|
| 446 | val = ((sqdebuf[lcol + 8] - '0') * 10) +
|
---|
| 447 | (sqdebuf[lcol + 9] - '0');
|
---|
| 448 |
|
---|
| 449 | break;
|
---|
| 450 | /* |
---|
| 451 |
|
---|
| 452 | */
|
---|
| 453 | case SQ_VLT: /* control voltage */
|
---|
| 454 |
|
---|
| 455 | val = (sqdebuf[lcol + 9] - '0') - 1;
|
---|
| 456 | break;
|
---|
| 457 |
|
---|
| 458 | case SQ_RND: /* random value */
|
---|
| 459 |
|
---|
| 460 | val = sqdebuf[lcol + 9] - '0';
|
---|
| 461 | break;
|
---|
| 462 |
|
---|
| 463 | default:
|
---|
| 464 |
|
---|
| 465 | movestc(DATAROW, actlft[action] + 8);
|
---|
| 466 | return(FAILURE);
|
---|
| 467 | }
|
---|
| 468 |
|
---|
| 469 | if (((*ap & SQ_MACT) EQ SQ_AREG) AND
|
---|
| 470 | (sqdebuf[lcol + 7] EQ '-'))
|
---|
| 471 | val |= 0x1000;
|
---|
| 472 |
|
---|
| 473 | *ap = (*ap & SQ_MACT) | (obj << 8);
|
---|
| 474 | *dp = (*dp & SQ_MTYP) | val;
|
---|
| 475 |
|
---|
| 476 | break;
|
---|
| 477 |
|
---|
| 478 | default:
|
---|
| 479 |
|
---|
| 480 | movestc(DATAROW, actlft[action]);
|
---|
| 481 | return(FAILURE);
|
---|
| 482 | }
|
---|
| 483 | /* |
---|
| 484 |
|
---|
| 485 | */
|
---|
| 486 | memcpyw(&seqtab[curslin], &seqbuf, NSEQW);
|
---|
| 487 | dsqlin(sqdebuf, curslin);
|
---|
[7258c6a] | 488 | sqdeflg = TRUE;
|
---|
[f40a309] | 489 | dcursq();
|
---|
[7258c6a] | 490 | movestc(DATAROW, nextact[action]);
|
---|
| 491 | return(SUCCESS);
|
---|
| 492 | }
|
---|
| 493 |
|
---|
[f40a309] | 494 | /* |
---|
| 495 |
|
---|
| 496 | */
|
---|
| 497 |
|
---|
| 498 | /*
|
---|
| 499 | =============================================================================
|
---|
| 500 | sqfnbox() -- sequence display box hit processor
|
---|
| 501 | =============================================================================
|
---|
| 502 | */
|
---|
| 503 |
|
---|
| 504 | int16_t sqfnbox(int16_t n)
|
---|
| 505 | {
|
---|
| 506 | int16_t act, vtype;
|
---|
| 507 | register int16_t box;
|
---|
| 508 | register int16_t i;
|
---|
| 509 | register int32_t ltemp;
|
---|
| 510 |
|
---|
| 511 | if (NOT submenu) { /* SEQUENCE DATA ENTRY LINE */
|
---|
| 512 |
|
---|
| 513 | if (inrange(stccol, 2, 4)) { /* Line */
|
---|
| 514 |
|
---|
| 515 | ltemp = 0;
|
---|
| 516 |
|
---|
| 517 | for (i = 2; i < 5; i++)
|
---|
| 518 | ltemp = (ltemp * 10) + (sqdebuf[i] - '0');
|
---|
| 519 |
|
---|
| 520 | curslin = ltemp;
|
---|
| 521 | sqdeflg = FALSE;
|
---|
| 522 | dstw();
|
---|
| 523 | movestc(DATAROW, 2);
|
---|
| 524 | return(SUCCESS);
|
---|
| 525 |
|
---|
| 526 | } else if (inrange(stccol, 6, 10)) { /* Time */
|
---|
| 527 |
|
---|
| 528 | ltemp = 0;
|
---|
| 529 |
|
---|
| 530 | for (i = 6; i < 8; i++)
|
---|
| 531 | ltemp = (ltemp * 10) + (sqdebuf[i] - '0');
|
---|
| 532 |
|
---|
| 533 | for (i = 9; i < 11; i++)
|
---|
| 534 | ltemp = (ltemp * 10) + (sqdebuf[i] - '0');
|
---|
| 535 |
|
---|
| 536 | seqtab[curslin].seqtime = ltemp;
|
---|
| 537 | seqbuf.seqtime = ltemp;
|
---|
| 538 | dsqlin(sqdebuf, curslin);
|
---|
| 539 | sqdeflg = TRUE;
|
---|
| 540 | dcursq();
|
---|
| 541 | movestc(DATAROW, 12);
|
---|
| 542 | return(SUCCESS);
|
---|
| 543 | /* |
---|
| 544 |
|
---|
| 545 | */
|
---|
| 546 | } else if (inrange(stccol, 12, 22)) { /* Action 1 */
|
---|
| 547 |
|
---|
| 548 | action = 0;
|
---|
| 549 |
|
---|
| 550 | if (inrange(stccol, 12, 13)) {
|
---|
| 551 |
|
---|
| 552 | setsqm(19, 2);
|
---|
| 553 | return(SUCCESS);
|
---|
| 554 |
|
---|
| 555 | } else if ((sqopreq[seqbuf.seqact1 & SQ_MACT]) AND
|
---|
| 556 | (stccol EQ 19)) {
|
---|
| 557 |
|
---|
| 558 | setsqm(19, 53);
|
---|
| 559 | return(SUCCESS);
|
---|
| 560 |
|
---|
| 561 | } else {
|
---|
| 562 |
|
---|
| 563 | return(sqenter());
|
---|
| 564 | }
|
---|
| 565 |
|
---|
| 566 | } else if (inrange(stccol, 24, 34)) { /* Action 2 */
|
---|
| 567 |
|
---|
| 568 | action = 1;
|
---|
| 569 |
|
---|
| 570 | if (inrange(stccol, 24, 25)) {
|
---|
| 571 |
|
---|
| 572 | setsqm(19, 2);
|
---|
| 573 | return(SUCCESS);
|
---|
| 574 |
|
---|
| 575 | } else if ((sqopreq[seqbuf.seqact2 & SQ_MACT]) AND
|
---|
| 576 | (stccol EQ 31)) {
|
---|
| 577 |
|
---|
| 578 | setsqm(19, 53);
|
---|
| 579 | return(SUCCESS);
|
---|
| 580 |
|
---|
| 581 | } else {
|
---|
| 582 |
|
---|
| 583 | return(sqenter());
|
---|
| 584 | }
|
---|
| 585 | /* |
---|
| 586 |
|
---|
| 587 | */
|
---|
| 588 | } else if (inrange(stccol, 36, 46)) { /* Action 3 */
|
---|
| 589 |
|
---|
| 590 | action = 2;
|
---|
| 591 |
|
---|
| 592 | if (inrange(stccol, 36, 37)) {
|
---|
| 593 |
|
---|
| 594 | setsqm(19, 2);
|
---|
| 595 | return(SUCCESS);
|
---|
| 596 |
|
---|
| 597 | } else if ((sqopreq[seqbuf.seqact3 & SQ_MACT]) AND
|
---|
| 598 | (stccol EQ 43)) {
|
---|
| 599 |
|
---|
| 600 | setsqm(19, 53);
|
---|
| 601 | return(SUCCESS);
|
---|
| 602 |
|
---|
| 603 | } else {
|
---|
| 604 |
|
---|
| 605 | return(sqenter());
|
---|
| 606 | }
|
---|
| 607 |
|
---|
| 608 | } else
|
---|
| 609 | return(FAILURE);
|
---|
| 610 | /* |
---|
| 611 |
|
---|
| 612 | */
|
---|
| 613 | } else { /* SUBMENU SELECTION */
|
---|
| 614 |
|
---|
| 615 | /* determine the "box" we're pointing at */
|
---|
| 616 |
|
---|
| 617 | if (inrange(vtccol, 2, 14))
|
---|
| 618 | box = vtcrow - 18;
|
---|
| 619 | else if (inrange(vtccol, 17, 27))
|
---|
| 620 | box = vtcrow - 14;
|
---|
| 621 | else if (inrange(vtccol, 30, 40))
|
---|
| 622 | box = vtcrow - 10;
|
---|
| 623 | else if (inrange(vtccol, 43, 50))
|
---|
| 624 | box = vtcrow - 6;
|
---|
| 625 | else if (inrange(vtccol, 53, 60))
|
---|
| 626 | box = vtcrow - 1;
|
---|
| 627 | else
|
---|
| 628 | return(FAILURE);
|
---|
| 629 | /* |
---|
| 630 |
|
---|
| 631 | */
|
---|
| 632 | switch (sqmenu) { /* switch on submenu type */
|
---|
| 633 |
|
---|
| 634 | case ST_0: /* Action 1 or Action 2 type */
|
---|
| 635 | case ST_2: /* Action 3 type */
|
---|
| 636 |
|
---|
| 637 | if (inrange(box, 18, 21))
|
---|
| 638 | return(FAILURE);
|
---|
| 639 |
|
---|
| 640 | switch (action) {
|
---|
| 641 |
|
---|
| 642 | case 0: /* action 1 */
|
---|
| 643 |
|
---|
| 644 | act = SQ_MACT & (seqbuf.seqact1 = sqatype[box]);
|
---|
| 645 | vtype = 0x000F & ((seqbuf.seqdat1 = sqidata[box]) >> 8);
|
---|
| 646 | break;
|
---|
| 647 |
|
---|
| 648 | case 1: /* action 2 */
|
---|
| 649 |
|
---|
| 650 | act = SQ_MACT & (seqbuf.seqact2 = sqatype[box]);
|
---|
| 651 | vtype = 0x000F & ((seqbuf.seqdat2 = sqidata[box]) >> 8);
|
---|
| 652 | break;
|
---|
| 653 |
|
---|
| 654 | case 2: /* action 3 */
|
---|
| 655 |
|
---|
| 656 | if ((box EQ 4) OR (box EQ 8) OR (box EQ 12) OR
|
---|
| 657 | inrange(box, 15, 17))
|
---|
| 658 | return(FAILURE);
|
---|
| 659 |
|
---|
| 660 | act = SQ_MACT & (seqbuf.seqact3 = sqatype[box]);
|
---|
| 661 | vtype = 0x000F & ((seqbuf.seqdat3 = sqidata[box]) >> 8);
|
---|
| 662 | break;
|
---|
| 663 | }
|
---|
| 664 |
|
---|
| 665 | memcpyw(&seqtab[curslin], &seqbuf, NSEQW);
|
---|
| 666 | dsqlin(sqdebuf, curslin);
|
---|
| 667 | sqdeflg = TRUE;
|
---|
| 668 | dcursq();
|
---|
| 669 |
|
---|
| 670 | if (sqopreq[act])
|
---|
| 671 | endssm(stcrow, actlft[action] + sqvcol[vtype]);
|
---|
| 672 | else if ((act EQ SQ_ISTM) OR (act EQ SQ_STOP))
|
---|
| 673 | endssm(stcrow, nextact[action]);
|
---|
| 674 | else
|
---|
| 675 | endssm(stcrow, actlft[action] + actcol[act]);
|
---|
| 676 |
|
---|
| 677 | return(SUCCESS);
|
---|
| 678 | /* |
---|
| 679 |
|
---|
| 680 | */
|
---|
| 681 | case ST_1: /* operand type */
|
---|
| 682 |
|
---|
| 683 | if (NOT inrange(box, 18, 21))
|
---|
| 684 | return(FAILURE);
|
---|
| 685 |
|
---|
| 686 | switch (action) {
|
---|
| 687 |
|
---|
| 688 | case 0: /* action 1 */
|
---|
| 689 |
|
---|
| 690 | if (NOT sqopreq[act = SQ_MACT & seqbuf.seqact1])
|
---|
| 691 | return(FAILURE);
|
---|
| 692 |
|
---|
| 693 | seqbuf.seqdat1 = (seqbuf.seqdat1 & SQ_MFLG) | sqndata[box - 18];
|
---|
| 694 | break;
|
---|
| 695 |
|
---|
| 696 | case 1: /* action 2 */
|
---|
| 697 |
|
---|
| 698 | if (NOT sqopreq[act = SQ_MACT & seqbuf.seqact2])
|
---|
| 699 | return(FAILURE);
|
---|
| 700 |
|
---|
| 701 | seqbuf.seqdat2 = (seqbuf.seqdat2 & SQ_MFLG) | sqndata[box - 18];
|
---|
| 702 | break;
|
---|
| 703 |
|
---|
| 704 | case 2: /* action 3 */
|
---|
| 705 |
|
---|
| 706 | if (NOT sqopreq[act = SQ_MACT & seqbuf.seqact3])
|
---|
| 707 | return(FAILURE);
|
---|
| 708 |
|
---|
| 709 | seqbuf.seqdat3 = (seqbuf.seqdat3 & SQ_MFLG) | sqndata[box - 18];
|
---|
| 710 | break;
|
---|
| 711 | }
|
---|
| 712 |
|
---|
| 713 | break;
|
---|
| 714 |
|
---|
| 715 | default: /* -BOGUS- */
|
---|
| 716 |
|
---|
| 717 | endssm(stcrow, stccol);
|
---|
| 718 | return(FAILURE);
|
---|
| 719 | }
|
---|
| 720 |
|
---|
| 721 | memcpyw(&seqtab[curslin], &seqbuf, NSEQW);
|
---|
| 722 | dsqlin(sqdebuf, curslin);
|
---|
| 723 | sqdeflg = TRUE;
|
---|
| 724 | dcursq();
|
---|
| 725 | endssm(stcrow, actlft[action] + seqvcol[box - 18]);
|
---|
| 726 | return(SUCCESS);
|
---|
| 727 | }
|
---|
| 728 |
|
---|
| 729 | return(FAILURE);
|
---|
| 730 | }
|
---|