1 tdlr(1):
   2 /*        all peripheral operations   */
   3 tdl.tppos_save = vdec4; /* save posible number for fsfxx, bsfxx, bkfxx */
   4 tdl.tmnem = inst$tdli(dovar1);
   5 check =fixed(inst$tdlr_type_conv_control((dovar1-1)*12+24));
   6 
   7 
   8 per_op_common:
   9 tdl.topcd = tst.opd(check + 1); /* op def to topcd */
  10 if tdl.topcd.op_type >-1 then goto move_standards_to_call;
  11 inv_data = "trying to issue illegal op-code to device";
  12 goto say_invalid_instruction;
  13 
  14 
  15 move_standards_to_call:
  16 tdl.tdata = tdl.tdatas;
  17 tdl.tdtyp = tdl.tdtyps;
  18 tdl.tcwdl = tdl.tcwdls;
  19 tdl.testat = tdl.testas;
  20 tio.tadwd = tdl.tadwds;
  21 tdl.tpmb.op_code = tdl.tpmbs.op_code;
  22 if tdl.tpxdio ^=0 then goto prdup;
  23 if tdl.tdcws.wc = 0 then goto use_tpmax;
  24 if tdl.tdcws.wc >320 then goto use_tpmax;
  25 tio.tdcw.wc = bit(fixed(tdl.tdcws.wc,12),12);
  26 goto used_std_dcw_wc;
  27 
  28 
  29 use_tpmax:
  30 tio.tdcw.wc = bit(fixed(tst.max,12),12);
  31 goto used_tpmax_wc;
  32 
  33 
  34 used_std_dcw_wc:
  35 tdl.tdtcal_reladd = 0;
  36 tdl.tdtcal_wc = fixed(tio.tdcw.wc);
  37 
  38 
  39 used_tpmax_wc:
  40 if chgmode = -1 then goto set_length;
  41 tdl.tpmb.op_code = tdl.topcd.op_code;
  42 tdl.tpmb.iom_cmd = tdl.topcd.ioc_cmd;
  43 tdl.tpmb.reccnt = tdl.topcd.record_count;
  44 if tdl.topcd.op_type = 0 then goto tis_non_data;
  45 if tdl.topcd.op_type = 1 then goto tis_write;
  46 if tdl.topcd.op_type = 2 then goto tis_address;
  47 if tdl.topcd.op_type = 3 then goto tis_read;
  48 inv_data = "op-code <0 in perif--should not happen";
  49 goto say_invalid_instruction;
  50 
  51 
  52 tis_non_data:
  53 status_zero_ptr = addr(tdl.status);
  54 status_zero = "000000000000000000000000000000000000"b;
  55 
  56 
  57 tis_address:
  58 tio.tdcw.wc = "000000000001"b; /*  address word wc = "000000000001"b */
  59 tdl.tcwdl = 0;
  60 tdl.tdtyp = 0;
  61 tio.tdcw.add= rel(addr(tio.tadwd));
  62 goto cmd_common;
  63 
  64 
  65 tis_write:
  66 tio.tdcw.add = rel(addr(tio.twarea));
  67 goto tis_write_read;
  68 
  69 
  70 tis_read:
  71 tio.tdcw.add = rel(addr(tio.trarea));
  72 
  73 
  74 tis_write_read:
  75 tdl.tncflg = 0;
  76 status_zero_ptr = addr(tdl.status);
  77 status_zero = "000000000000000000000000000000000000"b;
  78 
  79 
  80 cmd_common:
  81 tdl.testat.major_status= tdl.topcd.major_status;
  82 tdl.testat.sub_status= tdl.topcd.sub_status;
  83 tdl.testat.ignore_ss = tdl.topcd.ignore_ss;
  84 if tdl.tmiflg = 0 then goto dont_force_ignore_ss;
  85 tdl.testat.ignore_ss = "1"b;
  86 
  87 
  88 dont_force_ignore_ss:
  89 tdl.testat.expected_interrupts = tdl.topcd.expected_interrupts;
  90 
  91 
  92 prdup:
  93 tdl.trrec = "000000"b;
  94 tdl.trwrd = "000000000000"b;
  95 cmpflg = 0;
  96 if tdl.tmiflg ^=0 then goto prinit;
  97 /* mass storage checks here----assume not ram   */
  98 
  99 
 100 prcmp:
 101 prsav:
 102 if tdl.tpxdio ^= 0 then goto prinit;
 103 tdl.tscnt(11) = tdl.line_number;
 104 tdl.tsfld(11) = tdl.topfld;
 105 
 106 
 107 prinit:
 108 tdl.tnrflg,tdl.tnmflg,tdl.tntflg,tdl.trflg,tdl.tnsflg,tdl.second_io_of_dual = 0;
 109 chgmode = 1; /* set to previous  */
 110 if cmpflg ^=0 then goto nxfld;
 111 
 112 
 113 prcmp1:
 114 if tdl.tcwdl ^=0 then goto lcset;
 115 tdl.tfdcwp = addr(tio.tdcw);
 116 goto nxfld;
 117 
 118 
 119 set_length:
 120 if tdl.tcwdl ^=0 then goto lcset;
 121 tdl.tfdcwp = addr(tio.tdcw);
 122 goto nxfld;
 123 
 124 
 125 tdlr(2):
 126 /*     LPdd.U or dd     */
 127 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
 128 tdl.line_number = fdec1;
 129 goto nxlin;
 130 
 131 
 132 tdlr(3):
 133 /*     $     */
 134 tdl.do_dual_io = 1;
 135 goto nxfld;
 136 
 137 
 138 tdlr(4):
 139 /*     *     */
 140 if tdl.terflg ^=0 then goto skipf;
 141 goto nxfld;
 142 
 143 
 144 tdlr(5):
 145 /*       Aoooooooooooo--      */
 146 /*
 147 
 148 set address
 149 
 150 */
 151 tio.tadwd = bit (fixed(octnum,36));
 152 goto nxfld;
 153 
 154 
 155 tdlr(6):
 156 /*       AAoooooooooooo--    */
 157 /*
 158 
 159 add to address
 160 
 161 */
 162 
 163 tio.tadwd = bit(fixed(fixed(octnum,36) + fixed(tio.tadwd,36),36));
 164 goto nxfld;
 165 
 166 
 167 tdlr(7):
 168 /*    ABT    */
 169 goto set_obsolete_msg;
 170 
 171 
 172 tdlr(8):
 173 /*        ADoooooooooooo--            */
 174 tdl.tdtyp = 4;
 175 goto dtypst;
 176 
 177 
 178 tdlr(9):
 179 /*     ADROT     */
 180 tdl.tdtyp = 10;
 181 goto dtypst;
 182 
 183 
 184 tdlr(10):
 185 /*     AL--dddd     */
 186 if vdec4 > 321 then goto say_too_big;
 187 vdec4 = vdec4 + tdl.tdtcal_wc;
 188 if vdec4 > 321 then goto say_too_big;
 189 call set_dcw_len;
 190 goto nxfld;
 191 
 192 
 193 tdlr(11):
 194 /*     AMdd.--dddd    */
 195 goto set_obsolete_msg;
 196 
 197 
 198 tdlr(12):
 199 /*     AOPoo     */
 200 tdl.tmnem = inst$tdli(dovar1);
 201 check = octnum + fixed(tdl.tpmb.op_code);
 202 if check <64 then goto per_op_common;
 203 check = check - 64;
 204 goto per_op_common;
 205 
 206 
 207 tdlr(13):
 208 /*     ARAN     */
 209 /*
 210 
 211       aran - generate random seek address
 212 
 213 */
 214   call random_$uniform(seed,random_no);
 215   adrange = adhi - adlow ;
 216   adproduct = adrange * random_no;
 217   tio.tadwd = bit((adproduct + adlow),36);
 218   go to nxfld;
 219 
 220 tdlr(14):
 221 /*     B-d     */
 222 tdl.tscnt(vdec4+1) = tdl.tscnt(11);
 223 tdl.tsfld(vdec4+1) = tdl.tsfld(11);
 224 skip_field_no = 2; /* preset for loop off */
 225 if tdl.loop = 0 then goto fldct;
 226 /* loop on--skip 0 if error, 1 if no error */
 227 if tdl.terflg = 0 then goto nxfld;
 228 skip_field_no = 1;
 229 goto fldct;
 230 
 231 
 232 
 233 tdlr(15):
 234 /*     CHG     */
 235 chgmode = -1;
 236 goto move_standards_to_call;
 237 
 238 
 239 tdlr(16):
 240 /*     CHMoooooooooooo--     */
 241 tdl.tchmsk = bit(fixed(octnum,36));
 242 goto nxfld;
 243 
 244 
 245 tdlr(17):
 246 /*     CHXIdd.--dd     */
 247 if tdl.man ^=0 then goto ill_eep;
 248 tdl.eep_tally = tdl.eep_tally + vdec4;
 249 goto nxfld;
 250 
 251 
 252 tdlr(18):
 253 /*     CHXddd.ddd.--dd     */
 254 if tdl.man ^=0 then goto ill_eep;
 255 fix_bit = 1;
 256 if fdec2 =1 then fix_bit = 9;  /* first 8 bits not used */
 257 
 258 do dovar1 = 1 to fdec2*2;
 259 substr(tdl.eep_line,tdl.eep_tally-1+dovar1,1) =
 260  substr(page_no_char,(fixed(substr(string(addrel(addr(tio.trarea),fdec1)->data_move),fix_bit+(dovar1-1)*4,4)))+1,1);
 261 end;
 262 
 263 tdl.eep_tally = tdl.eep_tally + 2*fdec2;
 264 if tdl.talpha ^= "chxs.." then goto nxfld;
 265 substr(tdl.eep_line,tdl.eep_tally,1) = " ";
 266 tdl.eep_tally = tdl.eep_tally + 1;
 267 goto nxfld;
 268 
 269 
 270 
 271 
 272 tdlr(19):
 273 /*     CHXSddd.ddd.--dd     */
 274 goto tdlr(18);
 275 
 276 
 277 tdlr(20):
 278 /*     CKF--dd     */
 279 /*
 280 
 281 check flag and skip field if not set
 282 
 283 */
 284 if vdec4 > 35 then goto flag_error;
 285 if tdl.tflag(vdec4+1) ^= 0 then goto nxfld;
 286 goto skipf;
 287 
 288 
 289 flag_error:
 290 inv_data = "only 36 flags available, 0-35";
 291 goto say_invalid_instruction;
 292 
 293 
 294 tdlr(21):
 295 /*     CL--dd     */
 296 tdl.loopct(vdec4+1) = 0;
 297 goto nxfld;
 298 
 299 
 300 tdlr(22):
 301 /*     CLK--dddddd      */
 302 tdl.pagclk = (vdec4*1000)/64; /* convert 1/64 ms to us */
 303 tdl.clock_dispatch = nxfld;
 304 tdl.clock_going = 1;  /* set clock going */
 305 call timer_manager_$alarm_wakeup(tdl.pagclk,"10"b,tdl.clock_event);
 306 /*  time is in micro seconds  */
 307 
 308 clock_common:
 309 goto main_dispatch_queue_service; /* go away untill called */
 310 
 311 
 312 tdlr(23):
 313 /*     CLKRAN--dddddd     */
 314 goto set_obsolete_msg;
 315 
 316 
 317 tdlr(24):
 318 /*     CMP-d     */
 319 tdl.tncflg = 0;
 320 cmpflg = 1;
 321 if vdec4 = 0 then goto prcmp;
 322 tdl.interrupts.init = "1"b; /* fake an initiate interrupt */
 323 goto prcmp;
 324 
 325 
 326 tdlr(25):
 327 /*     CODEdd     */
 328 goto set_obsolete_msg;
 329 
 330 
 331 tdlr(26):
 332 /*     CSW--dd     */
 333 goto set_obsolete_msg;
 334 
 335 
 336 tdlr(27):
 337 /*     CWdAddd.--dddd     */
 338 /* in order to permit effective subtraction from the offset and or
 339    word count, the offset addition is performed moduluo 512
 340    and the word count addition is performed moduluo 4096 */
 341 if tio.tdcww(fdec1+1).typ = "10"b|tio.tdcww(fdec1+1).char = "111"b
 342        then goto cwa_bad;
 343 /* bad if tdcw or idcw-----cant add to them  */
 344 fdec2 = mod(fdec2 +
 345     fixed(tio.tdcww(fdec1+1).add)-fixed(rel(addr(tio.twarea(1)))),512);
 346 vdec4 = mod(vdec4 + fixed(tio.tdcww(fdec1+1).wc),4096);
 347 if fdec2 >320 then goto say_too_big;
 348 if fdec2 + vdec4 > 320 then goto say_too_big;
 349 if vdec4 = 0 then goto say_too_big;
 350 /* compute offset and word count for common routine */
 351 goto complete_dcw_add;
 352 
 353 cwa_bad:
 354 inv_data = "trying to add offset or length to a tdcw or idcw";
 355 goto say_invalid_instruction;
 356 
 357 
 358 tdlr(28):
 359 /*     CWdBd     */
 360 if fdec1 = 0 then goto lcset_error;
 361 tio.tdcww(fdec1+1).add = rel(addr(tio.tdcww(vdec4+1).add));
 362 tio.tdcwr(fdec1+1).add = rel(addr(tio.tdcwr(vdec4+1).add));
 363 tio.tdcww(fdec1+1).char = "000"b;
 364 tio.tdcwr(fdec1+1).char = "000"b;
 365 tio.tdcww(fdec1+1).typ = "10"b;
 366 tio.tdcwr(fdec1+1).typ = "10"b;
 367 tio.tdcww(fdec1+1).wc = "000000000000"b;
 368 tio.tdcwr(fdec1+1).wc = "000000000000"b;
 369 tdl.tcwdl = fdec1+1;
 370 tdl.tfdcwp = addrel(addr(tio.tdcww(1)),fdec1);
 371 goto nxfld;
 372 
 373 
 374 tdlr(29):
 375 /*     CWdI     */
 376 if fdec1 = 0 then goto lcset_error;
 377 if tdl.man ^=0 then goto ill_eep;
 378 tio.tdcww(fdec1+1).add = "000000000000000000"b;
 379 tio.tdcww(fdec1+1).wc = "000000000000"b;
 380 tio.tdcww(fdec1+1).char = "111"b;
 381 tio.tdcww(fdec1+1).typ = "00"b;
 382 tio.tdcww(fdec1+1).w_c = "0"b;
 383 tdl.tfdcwp = addr(tio.tdcww(fdec1+1));
 384 tdl.tcwdl = fdec1+1;
 385 goto nxfld;
 386 
 387 
 388 tdlr(30):
 389 /*     CWdNddd.--dddd     */
 390 work_num = 3; /*  IONTP dcw type  */
 391 goto pdcw_com;
 392 
 393 
 394 tdlr(31):
 395 /*     CWdPddd.--dddd     */
 396 work_num = 1;  /*  IOTP dcw type  */
 397 
 398 pdcw_com:
 399 if fdec1 ^=9 then goto set_dcw; /*  not last--is ok */
 400 inv_data = "trying to set up the last dcw as an iontp or iotp";
 401 goto say_invalid_instruction;
 402 
 403 
 404 tdlr(32):
 405 /*     CWdSddd.--dddd     */
 406 work_num = 0;  /* dcw type is stop  */
 407 
 408 set_dcw:
 409 if fdec2 >320 then goto say_too_big;
 410 if fdec2 + vdec4 > 320 then goto say_too_big;
 411 if vdec4 = 0 then goto say_too_big;
 412 tio.tdcww(fdec1+1).typ = bit(fixed(work_num,2),2); /* set dcw types */
 413 tio.tdcwr(fdec1+1).typ = bit(fixed(work_num,2),2);
 414 
 415 
 416 complete_dcw_add:
 417 tio.tdcww(fdec1+1).char = "000"b;
 418 tio.tdcwr(fdec1+1).char = "000"b;
 419 tio.tdcww(fdec1+1).add = rel(addrel(addr(tio.twarea(1)),fdec2)); /*ad in wrt*/
 420 tio.tdcwr(fdec1+1).add = rel(addrel(addr(tio.trarea(1)),fdec2)); /*ad in rd */
 421 tio.tdcww(fdec1+1).wc = bit(fixed(vdec4,12),12); /* set word counts */
 422 tio.tdcwr(fdec1+1).wc = bit(fixed(vdec4,12),12);
 423 tdl.tcwdl = fdec1+1; /* dcw no. +1 to flag */
 424 tdl.tdtcal_reladd = fdec2;
 425 tdl.tdtcal_wc = vdec4;
 426 tdl.tfdcwp = addrel(addr(tio.tdcwr(1)),fdec1); /* assume read */
 427 if tdl.topcd.op_type = 3 then goto nxfld;  /* was a read */
 428 tdl.tfdcwp = addrel(addr(tio.tdcww(1)),fdec1); /* point to write dcw */
 429 goto nxfld;
 430 
 431 tdlr(33):
 432 /*          Doooooooooooo--         */
 433 if tdl.tfdcwp->dcw_peek.char = "111"b then goto was_idcw;
 434 tdl.tdtyp = 3;
 435 goto dtypst;
 436 
 437 
 438 was_idcw:
 439 tio.tdcww(tdl.tcwdl).add = substr(bit(fixed(octnum,36),36),1,18);
 440 tio.tdcww(tdl.tcwdl).char = substr(bit(fixed(octnum,36),36),19,3);
 441 tio.tdcww(tdl.tcwdl).w_c = substr(bit(fixed(octnum,36),36),22,1);
 442 tio.tdcww(tdl.tcwdl).typ = substr(bit(fixed(octnum,36),36),23,2);
 443 tio.tdcww(tdl.tcwdl).wc = substr(bit(fixed(octnum,36),36),25,12);
 444 goto nxfld;
 445 
 446 
 447 tdlr(34):
 448 /*     DA     */
 449 goto set_obsolete_msg;
 450 
 451 
 452 tdlr(35):
 453 /*     DEV     */
 454 if tdl.man ^=0 then goto ill_eep;
 455 goto nxfld;
 456 
 457 
 458 tdlr(36):
 459 /*     DLN--dd     */
 460 tdl.tdtyp = 5;
 461 octnum = vdec4;
 462 goto dtypst;
 463 
 464 
 465 tdlr(37):
 466 /*     DMOD     */
 467 /*
 468 
 469 dmod - decrement working number of disc modules
 470        this instruction is not supported under multics
 471 
 472 
 473 */
 474 set_obsolete_msg:
 475 inv_data = "obsolete instruction, not implemented";
 476 goto say_invalid_instruction;
 477 
 478 
 479 tdlr(38):
 480 /*     DRAN-d     */
 481 tdl.tdtyp = 1;
 482 octnum = vdec4;
 483 goto dtypst;
 484 
 485 
 486 tdlr(39):
 487 /*     DREAD     */
 488 goto set_obsolete_msg;
 489 
 490 
 491 tdlr(40):
 492 /*     DROT     */
 493 tdl.tdtyp = 6;
 494 goto dtypst;
 495 
 496 
 497 tdlr(41):
 498 /*     DUP     */
 499 goto set_obsolete_msg;
 500 
 501 
 502 tdlr(42):
 503 /*     E     */
 504 /*
 505 
 506 set expected major and substatus from standards
 507 
 508 */
 509 tdl.testat.ignore_ss = tdl.testas.ignore_ss;
 510 tdl.testat.major_status = tdl.testas.major_status;
 511 tdl.testat.sub_status = tdl.testas.sub_status;
 512 goto nxfld;
 513 
 514 
 515 tdlr(43):
 516 /*     EEPdd     */
 517 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
 518 tdl.eep_in_progress = 0;
 519 tdl.eep_saved_tmiflg = 0;
 520 tdl.eep_line_no = fdec1;
 521 goto nxfld;
 522 
 523 
 524 tdlr(44):
 525 /*     END     */
 526 if tdl.force = 1 then goto say_end_page;
 527 if tdl.rcycle = 0 then goto say_end_page;
 528 tdl.nxt = -1;
 529 tdl.initreq = 1;
 530 tdl.call_page = substr(tst.name,1,5)||"a";  /* select first page */
 531 call call_from_page;  /* get the first page */
 532 goto select_next_test_or_seg_or_start_or_end;
 533 
 534 
 535 tdlr(45):
 536 /*     F--dd     */
 537 /*
 538 
 539 f - loop to field yy of current line
 540 
 541 */
 542 skip_field_no = vdec4;
 543 tdl.tlscan = (tdl.line_number*56)+1;
 544 goto fldct;
 545 
 546 
 547 tdlr(46):
 548 /*     FEND     */
 549 goto set_obsolete_msg;
 550 
 551 
 552 tdlr(47):
 553 /*     GLNK     */
 554 /*
 555 
 556 glnk - get link for disc 204
 557        this instruction is not supported under multics
 558 
 559 
 560 */
 561 goto set_obsolete_msg;
 562 
 563 
 564 tdlr(48):
 565 /*     ICoo     */
 566 /*
 567      00 = unit record transfer
 568      02 = peripheral action(no dcws)
 569      04 = special card punch  --note---illegal on iom
 570      06 = multirecord(unit record)  note--uses multiple dcw lists
 571      10 = single character record
 572      24 = dual command (multi command)
 573      20 through 37 except 24 --special error commands for disc mpc
 574      40 to 57--special controller commands
 575 */
 576 /*  DSS180,DSS190 error control commands:
 577 
 578     01a0bc   a = inhibit automatic end of cylinder
 579              b = inhibit automatic alternate track logic
 580              c = inhibit automatic retry
 581     011100   inhibit RPS
 582     011101   edac override
 583 
 584 MTC500 error control commands:
 585 
 586   octal                     set capstan
 587     20    automatic retry off
 588     21    automatic retry off          low threshold
 589     22   automatic retry off  slow
 590     23   automatic retry off  slow     low threshold
 591     25   automatic retry off  fast     low threshold
 592     26   automatic retry off
 593     27   automatic retry off           low threshold
 594     30
 595     31                                 low threshold
 596     32                        slow
 597     33                        slow     low threshold
 598     34                        fast
 599     35                        fast     low threshold
 600     36
 601     37                                 low threshold
 602 
 603 special controller commands: for dss181,dss190,mtc500
 604 channel instruction 10xxxx
 605 device address must be zero
 606 device instruction field as below:  (in octal)
 607 
 608      32 = write controller main memory binary
 609      12 = write controller main menory ascii
 610      34 = conditional write lock byte
 611      14 = write lock byte
 612      22 = read controller main memory binary
 613      02 = read controller main menory ascii
 614      04 = read lock byte
 615      16 = initiate write data xfer
 616      06 = initiate read data transfer
 617      00 = suspend controller
 618      20 = release controller
 619 */
 620 if octnum = 1 then goto ioc_non_data;  /* peripheral action(no dcws) */
 621 if octnum < 4 then goto set_ioc_cmd;
 622 /*  if <4 unit record transfer, special card punch or multirecord */
 623 if octnum = 10 then goto set_ioc_cmd;  /* dual command */
 624 if octnum ^=4 then goto ioc_unknown;
 625 /* single character record */
 626 if tdl.topcd.op_code = "00"b|tdl.topcd.op_code = "11"b then goto ioc_sc_err;
 627 set_ioc_cmd:
 628 tdl.tpmb.iom_cmd =
 629   substr(bit(fixed(octnum,length(tdl.tpmb.iom_cmd)),length(tdl.tpmb.iom_cmd)),
 630             1,length(tdl.tpmb.iom_cmd));
 631 goto nxfld;
 632 
 633 ioc_non_data:
 634 inv_data = "cannot specify an ioc non-data command";
 635 goto say_invalid_instruction;
 636 
 637 ioc_unknown:
 638 inv_data = "unknown ioc command or bootload";
 639 goto say_invalid_instruction;
 640 
 641 ioc_sc_err:
 642 inv_data = "trying to use a sing. char. ioc cmd with a read or nondata opcode";
 643 goto say_invalid_instruction;
 644 
 645 
 646 tdlr(49):
 647 /*     IDCW     */
 648 /*note-----not in list in com.alm     */
 649 goto set_obsolete_msg;
 650 
 651 
 652 tdlr(50):
 653 /*     ISoo     */
 654 goto set_obsolete_msg;
 655 
 656 
 657 tdlr(51):
 658 /*     ITALdd     */
 659 if tdl.man ^=0 then goto ill_eep;
 660 tdl.eep_tally = 1;
 661 if tst.linetab(fdec1+1) ^=1 then goto ill_eep_line;
 662 substr(tdl.eep_line,1,48) =
 663      substr(string(addrel(addr(tst.lines),fdec1*14+1)->char_move),3,48);
 664 substr(tdl.eep_line,49,16) = "                ";
 665 if tst.linetab(fdec1+2) ^=1 then goto nxfld;
 666 substr(tdl.eep_line,49,16) =
 667      substr(string(addrel(addr(tst.lines),(fdec1+1)*14)->char_move),1,16);
 668 goto nxfld;
 669 
 670 
 671 ill_eep:
 672 inv_data = "eep instructions illegal in manual mode";
 673 goto say_invalid_instruction;
 674 
 675 
 676 ill_eep_line:
 677 inv_data = "eep data line not ascii data";
 678 goto say_invalid_instruction;
 679 
 680 
 681 tdlr(52):
 682 /*     L--dddd    */
 683 
 684 
 685 lran:   /* LRAN entry */
 686 if vdec4 > 321 then goto say_too_big;
 687 if vdec4 = 0 then goto say_4096;
 688 call set_dcw_len;
 689 goto nxfld;
 690 
 691 
 692 say_too_big:
 693 inv_data = "last word of dcw would be outside of write area";
 694 goto say_invalid_instruction;
 695 
 696 
 697 say_4096:
 698 inv_data = "trying to use a dcw with word count of 4096 (0)";
 699 goto say_invalid_instruction;
 700 
 701 
 702 set_dcw_len:proc;
 703 tdl.tdtcal_reladd = 0;
 704 tdl.tdtcal_wc = vdec4;
 705 tio.tdcw.wc = bit(fixed(vdec4,12),12);
 706 tio.tdcw.add = rel(addr(tio.twarea));  /* presume write first */
 707 if tdl.topcd.op_type ^=3 then goto was_not_read; /* check presumption */
 708 tio.tdcw.add = rel(addr(tio.trarea)); /* revert presumption */
 709 
 710 
 711 was_not_read:
 712 tdl.tcwdl = 0;  /* flag not control words  */
 713 tdl.tfdcwp = addr(tio.tdcw);
 714 end set_dcw_len;
 715 
 716 
 717 tdlr(53):
 718 /*     LCW-d     */
 719 tdl.tcwdl = vdec4+1; /* select dcw # */
 720 tdl.tfdcwp = addrel(addr(tio.tdcww(1)),vdec4); /* assume write */
 721 if tio.tdcww.char(vdec4+1) = "111"b then goto nxfld;  /* lcw set for idcw */
 722 if tio.tdcww.typ(vdec4+1) = "10"b then goto lcw_err;
 723 tdl.tdtcal_reladd = fixed(tio.tdcwr(vdec4+1).add)
 724      - fixed(rel(addr(tio.trarea(1))));
 725 tdl.tdtcal_wc = fixed(tio.tdcww(vdec4+1).wc);
 726 if tdl.topcd.op_type ^= 3 then goto nxfld;  /* was a write */
 727 tdl.tfdcwp = addrel(addr(tio.tdcwr(1)),vdec4); /* point to read dcw */
 728 goto nxfld;
 729 
 730 lcw_err:
 731 inv_data = "lcw points to tdcw";
 732 goto say_invalid_instruction;
 733 
 734 
 735 
 736 tdlr(54):
 737 /*     LOC--oo     */
 738 tdl.tdata = "000000000000000000000000000000"b||bit(fixed(octnum,6),6);
 739 tdl.tdtyp = 7;
 740 goto nxfld;
 741 
 742 
 743 tdlr(55):
 744 /*     LPdd.--dddd     */
 745 if tst.linetab(fdec1+1) ^= 0 then goto loop_to_invalid_line;
 746 if tdl.loopct(tdl.line_number+1) >= vdec4 then goto loop_exh;
 747 tdl.loopct(tdl.line_number+1) = tdl.loopct(tdl.line_number+1) + 1;
 748 tdl.line_number = fdec1;
 749 goto nxlin;
 750 
 751 
 752 loop_exh:
 753 tdl.loopct(tdl.line_number+1) = 0;
 754 goto nxfld;
 755 
 756 
 757 loop_to_invalid_line:
 758 inv_data = "looping to non_tdl_line";
 759 goto say_invalid_instruction;
 760 
 761 
 762 tdlr(56):
 763 /*     LPdd.AE     */
 764 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
 765 if tdl.taeflg = 0 then goto nxfld;
 766 tdl.line_number = fdec1;
 767 goto nxlin;
 768 
 769 
 770 tdlr(57):
 771 /*     LPdd.B     */
 772 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
 773 if tdl.tpadda = tdl.tpaddp then goto nxfld;
 774 tdl.line_number = fdec1;
 775 goto nxlin;
 776 
 777 
 778 tdlr(58):
 779 /*     LPdd.E     */
 780 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
 781 if tdl.terflg = 0 then goto nxfld;
 782 tdl.line_number = fdec1;
 783 goto nxlin;
 784 
 785 
 786 tdlr(59):
 787 /*     LPdd.ET     */
 788 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
 789 if tdl.status.major_status||substr(tdl.status.sub_status,1,1)
 790   ^= "00111"b then goto nxfld;
 791 tdl.line_number = fdec1;
 792 goto nxlin;
 793 
 794 
 795 tdlr(60):
 796 /*     LPdd.F-dd     */
 797 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
 798 tdl.line_number = fdec1;
 799 skip_field_no = vdec4;
 800 tdl.tlscan = (tdl.line_number*56)+1;
 801 goto fldct;
 802 
 803 
 804 tdlr(61):
 805 /*     LPdd.Fdd.--dddd     */
 806 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
 807 if tdl.loopct(tdl.line_number+1) >= vdec4 then goto loop_field_exh;
 808 tdl.loopct(tdl.line_number+1) = tdl.loopct(tdl.line_number+1) + 1;
 809 tdl.line_number = fdec1;
 810 skip_field_no = fdec2;
 811 tdl.tlscan =(tdl.line_number*56)+1;
 812 goto fldct;
 813 
 814 
 815 loop_field_exh:
 816 tdl.loopct(tdl.line_number+1) = 0;
 817 goto nxfld;
 818 
 819 
 820 tdlr(62):
 821 /*     LPdd.NB     */
 822 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
 823 if tdl.tpadda ^= tdl.tpaddp then goto nxfld;
 824 tdl.line_number = fdec1;
 825 goto nxlin;
 826 
 827 
 828 tdlr(63):
 829 /*     LPdd.NE     */
 830 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
 831 if tdl.terflg ^=0 then goto nxfld;
 832 tdl.line_number = fdec1;
 833 goto nxlin;
 834 
 835 
 836 tdlr(64):
 837 /*     LPdd.SVd     */
 838 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
 839 tdl.tscnt(vdec4+1) = tdl.line_number;
 840 tdl.tsfld(vdec4+1) = tdl.next_field_number;
 841 tdl.line_number = fdec1;
 842 goto nxlin;
 843 
 844 
 845 tdlr(65):
 846 /*     LRAN     */
 847 call compute_random;
 848 vdec4 = mod(fixed(dvran,31),tst.max);
 849 if vdec4 = 0 then vdec4 = 1; /* exlcude 0 */
 850 goto lran;
 851 
 852 
 853 tdlr(66):
 854 /*     Moo     */
 855 /*
 856 
 857 set major status expected and ignore substatus bit
 858 
 859 */
 860 tdl.testat.ignore_ss = substr(bit(fixed(octnum,36)),2,1);
 861 tdl.testat.major_status = substr(bit(fixed(octnum,36)),3,4);
 862 goto nxfld;
 863 
 864 
 865 tdlr(67):
 866 /*     NC     */
 867 /*
 868 
 869 set flag for no data check
 870 
 871 */
 872 tdl.tncflg = 1;
 873 goto nxfld;
 874 
 875 
 876 tdlr(68):
 877 /*     NM     */
 878 /*
 879 
 880 set flag for no mailbox (dcw residue) check
 881 
 882 */
 883 tdl.tnmflg = 1;
 884 goto nxfld;
 885 
 886 
 887 tdlr(69):
 888 /*     NR     */
 889 tdl.tnrflg = 1;
 890 goto nxfld;
 891 
 892 
 893 tdlr(70):
 894 /*     NS or NSdd.--dddd     */
 895 /*
 896 
 897 set flag for no halt on error
 898 
 899 */
 900 tdl.tnsflg = 1;
 901 if tdl.talpha ^="ns." then goto nxfld;
 902 tdl.tnsflg = -1;
 903 call check_type_lines;
 904 tdl.nslin = fdec1;
 905 tdl.nsnum = vdec4;
 906 goto nxfld;
 907 
 908 
 909 tdlr(71):
 910 /*     NT     */
 911 tdl.tntflg = 1;
 912 goto nxfld;
 913 
 914 
 915 tdlr(72):
 916 /*     NX     */
 917 /* note:  nxnn is illegal in the multics polts implimentation  */
 918 goto select_next_test_or_seg_or_start_or_end;
 919 
 920 
 921 tdlr(73):
 922 /*     O     */
 923 tdl.do_opt = 1;
 924 tdl.optrtn = nxfld;
 925 goto process_options;
 926 
 927 
 928 tdlr(74):
 929 /*     P--dd     */
 930 /*
 931 
 932 p instruction - performs no function (obsolete but harmless)
 933 
 934 */
 935 goto nxfld;
 936 
 937 
 938 tdlr(75):
 939 /*     PDoooooooooooo--     */
 940 tdl.tpadwd = bit(fixed(octnum,36),36);
 941 goto nxfld;
 942 
 943 
 944 tdlr(76):
 945 /*     PHDLN--dd     */
 946 tdl.tdtyp = 8;
 947 octnum = vdec4;
 948 goto dtypst;
 949 
 950 
 951 tdlr(77):
 952 /*     POS     */
 953 if
 954 substr(tst.name,1,4)="td11"|substr(tst.name,1,4)="td12"|substr(tst.name,1,4)="td13"|substr(tst.name,1,4)="td14"
 955       |substr(tst.name,1,4)="td15"|substr(tst.name,1,4) = "td16"
 956       then goto pos_ok;
 957 inv_data = "positioning valid only for mag tape";
 958 goto say_invalid_instruction;
 959 
 960 
 961 pos_ok:
 962 tdl.tpsflg = 1;
 963 goto nxfld;
 964 
 965 
 966 tdlr(78):
 967 /*     Rdd     */
 968 /*
 969 
 970 
 971 set record count
 972 
 973 */
 974 if fdec1 <64 then go to rec1;
 975 inv_data = "record count must be 0-63";
 976 goto say_invalid_instruction;
 977 
 978 
 979 rec1:
 980 tdl.tpmb.reccnt = substr(bit(fixed(fdec1,36)),31,6);
 981 goto nxfld;
 982 
 983 
 984 tdlr(79):
 985 /*     RET-d     */
 986 /*
 987 
 988 return to saved tdl field location
 989 
 990 */
 991 if tdl.tsfld(vdec4+1) ^= -1 then goto have_save;
 992 
 993 
 994 no_save:
 995 inv_data = "trying to execute a ret without a previous sv";
 996 goto say_invalid_instruction;
 997 
 998 
 999 have_save:
1000 skip_field_no = tdl.tsfld(vdec4+1);
1001 tdl.line_number = tdl.tscnt(vdec4+1);
1002 tdl.tlscan =(tdl.line_number*56)+1;
1003 goto fldct;
1004 
1005 
1006 tdlr(80):
1007 /*     RETd+--dd     */
1008 /*
1009 
1010 return to saved tdl field location plus n fields
1011 
1012 */
1013 if tdl.tsfld(fdec1+1) = -1 then goto no_save;
1014 skip_field_no = tsfld(fdec1+1) + vdec4;
1015 tdl.line_number = tscnt(fdec1+1);
1016 tdl.tlscan = (tdl.line_number*56)+1;
1017 goto fldct;
1018 
1019 
1020 tdlr(81):
1021 /*     RETEP     */
1022 if tdl.man ^=0 then goto ill_eep;
1023 tdl.eep_tally = 0;  /* use to flag out of eep */
1024 if tdl.eep_in_progress = 0 then goto err_not_in_eep;
1025 tdl.talpha = tdl.eep_talpha;
1026 tdl.tnmbr = tdl.eep_tnmbr;
1027 tdl.tnmwrd = tdl.eep_tnmwrd;
1028 tdl.next_field_number = tdl.eep_next_field_number;
1029 tdl.per_op_number = tdl.eep_per_op_number;
1030 tdl.line_number = tdl.eep_line_number;
1031 tdl.tlscan = tdl.eep_tlscan;
1032 tdl.inst_index = tdl.eep_inst_index;
1033 tdl.tdlret = tdl.eep_tdlret;
1034 tdl.eep_in_progress = 0;
1035 goto check_for_options_after_error_check;
1036 
1037 
1038 err_not_in_eep:
1039 inv_data = "retep illegal if not in eep";
1040 goto say_invalid_instruction;
1041 
1042 
1043 tdlr(82):
1044 /*     RFL--dd     */
1045 if vdec4 >35 then goto flag_error;
1046 tdl.tflag(vdec4+1) = 0;
1047 goto nxfld;
1048 
1049 
1050 tdlr(83):
1051 /*     RR--dd     */
1052 goto set_obsolete_msg;
1053 
1054 
1055 tdlr(84):
1056 /*     RST     */
1057 goto set_obsolete_msg;
1058 
1059 
1060 tdlr(85):
1061 /*     RSTTD     */
1062 goto nxfld;
1063 
1064 
1065 tdlr(86):
1066  /*     RW--dddd     */
1067 if vdec4 >320 then goto rw_err;
1068 tdl.trwrd = bit(fixed(vdec4,length(tdl.trwrd)),length(tdl.trwrd));
1069 goto nxfld;
1070 
1071 rw_err:
1072 inv_data = "residual word count cannot exceed 320";
1073 goto say_invalid_instruction;
1074 
1075 
1076 
1077 tdlr(87):
1078 /*     Soo--     */
1079 /*
1080 
1081 set expected substatus
1082 
1083 */
1084 tdl.testat.sub_status = substr(bit(fixed(octnum,36)),1,6);
1085 goto nxfld;
1086 
1087 
1088 tdlr(88):
1089 /*     SAoo,SIoo,SNoo,SWoo     */
1090 tdl.tmnem = inst$tdli(dovar1);
1091 check = octnum;
1092 if check <64 then goto per_op_common;
1093 check = check - 64;
1094 goto per_op_common;
1095 
1096 
1097 tdlr(89):
1098 /*     SDSKdd     */
1099 goto set_obsolete_msg;
1100 
1101 
1102 tdlr(90):
1103 /*     SFL--dd     */
1104 /*
1105 
1106 set program flag
1107 
1108 */
1109 if vdec4 > 35 then goto flag_error;
1110 tdl.tflag(vdec4+1) = 1;
1111 goto nxfld;
1112 
1113 
1114 tdlr(91):
1115  /*     SIF--dd     */
1116 goto set_obsolete_msg;
1117 
1118 
1119 tdlr(92):
1120 /*     SMODo     */
1121 goto set_obsolete_msg;
1122 
1123 
1124 tdlr(93):
1125 /*     STNdd     */
1126 goto set_obsolete_msg;
1127 
1128 
1129 tdlr(94):
1130 /*     STRdd     */
1131 goto set_obsolete_msg;
1132 
1133 
1134 tdlr(95):
1135 /*     SV-d     */
1136 /*
1137 
1138 save location of next tdl field
1139 
1140 */
1141 tdl.tscnt(vdec4+1) = tdl.line_number;
1142 tdl.tsfld(vdec4+1) = tdl.next_field_number;
1143 goto nxfld;
1144 
1145 
1146 tdlr(96):
1147 /*     T--dd     */
1148 if tdl.trycnt >=0 then goto use_option_trycount;
1149 
1150 tdl.trflg = vdec4;
1151 goto tran_com;
1152 
1153 use_option_trycount:
1154 tdl.trflg = tdl.trycnt;
1155 
1156 tran_com:
1157 tdl.tscnt(8) = tdl.tscnt(11); /* per. op. loc to save 7 */
1158 tdl.tsfld(8) = tdl.tsfld(11);
1159 tdl.tdlret = nxfld;
1160 goto do; /* do do after instruction */
1161 
1162 
1163 tdlr(97):
1164 /*     TAL     */
1165 goto set_obsolete_msg;
1166 
1167 
1168 tdlr(98):
1169 /*     TDM     */
1170 goto set_obsolete_msg;
1171 
1172 
1173 tdlr(99):
1174 /*     TISooo--   use 0 or 1 only for o     */
1175 if bit(fixed(octnum,36),36)
1176         &"110110110111111111111111111111111111"b then goto bad_tis;
1177 tdl.testat.expected_interrupts.term = substr(bit(fixed(octnum,36),36),3,1);
1178 tdl.testat.expected_interrupts.init = substr(bit(fixed(octnum,36),36),6,1);
1179 tdl.testat.expected_interrupts.spec = substr(bit(fixed(octnum,36),36),9,1);
1180 goto nxfld;
1181 
1182 bad_tis:
1183 inv_data = "only 3 numbers, each 0 or 1 permitted in ""tis""";
1184 goto say_invalid_instruction;
1185 
1186 
1187 tdlr(100):
1188 /*     TRRdd     */
1189 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
1190 tdl.tsubr = fdec1; /* line # for transient read recovery */
1191 goto nxfld;
1192 
1193 
1194 tdlr(101):
1195 /*     TWRdd     */
1196 if tst.linetab(fdec1+1) ^=0 then goto loop_to_invalid_line;
1197 tdl.tsubw =fdec1; /* line # for transient write recovery */
1198 goto nxfld;
1199 
1200 
1201 tdlr(102):
1202 /*     TYdd.--dddd     */
1203 tdl.ttyret = nxfld;
1204 call check_type_lines;
1205 inv_data = substr(work_ptr->char_move,1,vdec4*6);
1206 goto type_lines;
1207 
1208 
1209 tdlr(103):
1210 /*     TYRDdd.--dddd     */
1211 goto set_obsolete_msg;
1212 
1213 
1214 tdlr(104):
1215 /*     TYSdd     */
1216 if tdl.man ^=0 then goto ill_eep;
1217 if tdl.eep_tally <2 then goto type4096_line;
1218 inv_data = "";
1219 if tdl.eep_in_progress ^=0 then goto append_eep;
1220 call ioa_$rsnnl("^/^/**^a(^ac) device extended status in hex^/^a"||inv_data,
1221 message,
1222 mesg_len,
1223 substr(page_no_char,tdl.pageno,1),
1224 tdl.iccdd,
1225 substr(tdl.eep_line,1,tdl.eep_tally-1));
1226 tdl.ttyret = nxfld;
1227 goto type_lines_nlf;
1228 
1229 
1230 append_eep:
1231 if tdl.halt = 0|tdl.tnsflg ^=0 then goto no_halt;
1232 tdl.optrtn = tdl.tdlret;
1233 tdl.rtnopt = pdata.process_dispatch;
1234 tdl.optrd = 1;
1235 inv_data = "
1236 enter options:";
1237 
1238 
1239 no_halt:
1240 message = tdl.eep_msg||"
1241 device extended status in hex
1242 "||substr(tdl.eep_line,1,tdl.eep_tally-1)||inv_data;
1243 tdl.ttyret = nxfld;
1244 goto type_lines_nlf;
1245 
1246 
1247 tdlr(105):
1248 /*     TYWRdd.--dddd     */
1249 goto set_obsolete_msg;
1250 
1251 
1252 tdlr(106):
1253 /*     UHDLN--dd     */
1254 tdl.tdtyp = 9;
1255 octnum = vdec4;
1256 goto dtypst;
1257 
1258 
1259 tdlr(107):
1260 /*     W     */
1261 goto set_obsolete_msg;
1262 
1263 
1264 tdlr(108):
1265 /*     XDIO     */
1266 if tdl.man ^=0 then goto ill_eep;
1267 tdl.tpxdio = 1;
1268 tdl.tmnem = "xdio    ";
1269 goto move_standards_to_call;
1270 
1271 
1272 tdlr(109):
1273 /*     YES     */
1274 inv_data = "enter y or n";
1275 tdl.optrd = 1;
1276 tdl.rtnopt = check_question;
1277 
1278 type_lines:
1279 call ioa_$rsnnl("^/^/**^a(^ac)^/^a",
1280 message,
1281 mesg_len,
1282 substr(page_no_char,tdl.pageno,1),
1283 tdl.iccdd,
1284 inv_data);
1285 
1286 
1287 type_lines_nlf:
1288 inv_data = "";
1289 goto request_and_wait_for_tty_write;
1290 
1291 check_question:
1292 if substr(tdl.option,1,1) = "y" then goto skipf;
1293 goto nxfld;
1294 
1295 
1296 
1297 tdlr(110):
1298 /*     "YESdd.--dddd    */
1299 call check_type_lines;
1300 
1301 inv_data = substr(work_ptr->char_move,1,vdec4*6);
1302 tdl.optrd = 1;
1303 tdl.rtnopt = check_question;
1304 goto type_lines;
1305 
1306 not_ascii_data_line:
1307 inv_data = "trying to type from non_ascii data line";
1308 goto say_invalid_instruction;
1309 
1310 
1311 check_type_lines:proc;
1312 if vdec4 = 0 then goto type4096_line;
1313 if vdec4 > 18 then goto type_too_many;  /* 72 characters max */
1314 work_ptr = addrel(addr(tst.lines),fdec1*14);
1315 /* address of message */
1316 
1317 do dovar1 = 1 to vdec4 by 14;
1318 if tst.linetab(fdec1+(dovar1-1)/14+1) ^= 1 then goto not_ascii_data_line;
1319 end;
1320 end check_type_lines;
1321 
1322 
1323 type4096_line:
1324 inv_data = "trying to type 4096 words (0)";
1325 goto say_invalid_instruction;
1326 
1327 
1328 
1329 type_too_many:
1330 inv_data = "last word of message would be outside of message area";
1331 goto say_invalid_instruction;
1332 
1333 
1334