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