               JOB  IRG MEASUREMENT - WRITE
               ctl  6611
     *
     * Sense switches:
     *  B: Vary length of first record of pair
     *
     * Halts:
     * 399 (400 in I-STAR): Opportunity to set up drive 4 and change
     *     delay time.
     *
     * Stuff in the preamble -- not in one-field-per-card format
     *
               org  333
     *
     * Set up for one-field-per-card format and start loading
     *
               sw   8,12
     reload    sw   1
               r    1
     *
     * Look for next program -- A in column 80
     *
     nxprog    r
     tptest    bce  *&5,80,a
               b    421
               cs   reload,80
               dcw  @ 1 of 2 5@    Junk: Loader has L073376, not L065368
     *
     * Title print routine
     *
               org  1200
 1200titlpr    w
 1201          sw   49
 1205          lca  77,277
 1212          w
 1213          cs   277
 1217          w
 1218          b    start
 1224          dc   #3
 1228          dcw  #4
 1235          dcw  #7
 1236          dcw  #1
 1240          dcw  #4
 1244          dcw  #4
 1249          dcw  @    C@
     *
     titlsw    equ  1252   1 to use title print routine
     tapes1    equ  1268   blank indicates the tape loader
     taperd    equ  1288   tape read routine?
     tapes2    equ  1398   GM indicates the tape loader
     *
     * Stuff that is in one-field-per-card format
     *
               ORG  377
  377          BCE  halt1,tapes1&1,1  USE WHEN PROGRAM IS LOADED FROM TAPE
  385          BIN  taperd,          ,,
               ORG  399
  399halt1     H                   STOP TO SET UP DR 4 & CHANGE DELAY TIMES
  400          CS   332            START TEST
  404          CS
  405          BCE  titlpr,titlsw,1  BR TO TITLE PRINT ROUTINE IF 1 IN S52
  413start     RWD  4              REWIND DRIVE 4
  418          SW   199            SET WM TO LIMIT DELAY INSTR
  422          B    minset         BR TO SET INSTR FOR MINIMUM DELAY
  426wsetup    MCW  k1240,wtw1&6   SET TAPE WRITE B ADDR TO S40
  433          MCW  k1001,gapct    SET GAP COUNTER TO 001
  440          CS   299            CLEAR PRINT AREA
  444write1    CW   wtw1&4         CLEAR WM FROM B ADDR OF TAPE WRITE INST.
  448wtw1      WTW  4,1240         WRITE FIRST RECORD OF A PAIR
  456          BIN  wtw2,          VARIABLE DELAY
  461dly0      CS   wtw2,200         ,,
  468dly1      CS   wtw2,279         ,,
  475dly2      MCS  199,200          ,,
  482dly3      MCS  199,200          ,,
  489wtw2      WTW  4,irg          WRITE SECOND RECORD OF A PAIR
  497bert      BER  erhndl         BRANCH IF WRITE ERROR
  502nop1      NOP  k1001-3,dly0&6  INSTR USED TO INCREASE DELAY FOR
  509nop2      NOP  0,0              GROUPS 2, 3, AND 4
  516nop3      NOP  0,0              ,,
  523bce1      BCE  wtw3,gapct-2,1 BR TO WR SPACER REC IF LAST GAP OF GROUP
  531add1      A    k1001-3,gapct  ADD 1 TO GAP COUNTER
  538bvary     BSS  vary,B         B ON TO VARY LENGTH OF FIRST REC OF PAIR
  543          BIN  write1,        BRANCH TO WRITE NEXT PAIR OF RECORDS
               ORG  550
  550erhndl    BSP  4              BACKSPACE
  555erhnd2    BSP  4              BACKSPACE
  560          SKP  4              SKIP
  565          BIN  write1,        BRANCH TO WRITE NEXT PAIR OF RECORDS
  570vary      SW   wtw1&4         SUBTR 10 FROM B ADDR OF TAPE WRITE TO
  574incr      A    km10,wtw1&6      INCREASE LENGTH OF FIRST REC OF PAIR
  581bwrite    B    write1         BRANCH TO WRITE NEXT PAIR OF RECORDS
  585erhnd3    BSP  4              BACKSPACE
  590          SKP  4              SKIP
  595wtw3      WTW  4,irg-3        WRITE SPACER RECORD
  603          BER  erhnd3         BRANCH IF WRITE ERROR
  608bnx       BIN  nxdly1,        BRANCH TO LOAD NEXT TYPE OF DELAY INSTR
               ORG  620
  620nxdly1    LCA  bber&4,dly0-1  SET UP DELAY INSTR FOR 1 TO 2 MS DLY
  627          MCW  add1,nop1        ,,
  634          MCW  bxdl2,bnx&3      ,,
  641          BIN  wsetup,        BRANCH TO WRITE WITH 1 TO 2 MS DLY
               ORG  650
  650nxdly2    LCA  cmpr&6,dly0&6  SET UP DELAY INSTR FOR 2 TO 4 MS DLY
  657          MN   bert&1,nop1&3    ,,
  664          MCW  bxdl3,bnx&3      ,,
  671          BIN  wsetup,        BRANCH TO WRITE WITH 2 TO 4 MS DLY
               ORG  680
  680nxdly3    LCA  cs200&6,dly1&6 SET UP DELAY INSTR FOR 4 TO 12 MS DLY
  687          LCA                   ,,
  688          LCA  adly3&6,nop3&6   ,,
  695          LCA                   ,,
  696          LCA                   ,,
  697          MCW  bxdl4,bnx&3      ,,
  704          BIN  wsetup,        BRANCH TO WRITE WITH 4 TO 12 MS DLY
               ORG  720
  720nxdly4    MCW  bbce&4,nop1&4  SET UP DELAY INSTR FOR 12 MS FIXED DLY
  727          MCW  bxdl5,bnx&3      ,,
  734          BIN  wsetup,        BRANCH TO WRITE WITH 12 MS FIXED DLY
               ORG  740
  740nxdly5    LCA  bu,dly3&6      SET UP DELAY INSTR FOR 5 SEC FIXED DLY
  747          LCA                   ,,
  748          LCA                   ,,
  749          LCA                   ,,
  750          SW   dly3&2           ,,
  754          MN   bvary&2,bce1&6  ALTER INSTR IN 523 TO COUNT 10 GAPS
  761          MN   bvary&2,incr&3  ALTER INSTR IN 523 TO SUBTR 100 FROM
  768          MCW  bsetb,bnx&3    B ADDR OF TAPE WRITE INSTRUCTION
  775          BIN  wsetup,        BRANCH TO WRITE WITH 5 SEC FIXED DLY
               ORG  791
  791setbsp    LCA  bwtw2&4,dly2&4  SET UP INSTR TO BKSP REWRITE
  798          LCA                   ,,
  799          LCA                   ,,
  800          LCA                   ,,
  801          LCA  bdly1&4,nop3&3   ,,
  808          LCA                   ,,
  809          LCA                   ,,
  810          MCW  bwtm,bnx&3       ,,
  817          BIN  wsetup,        BR TO BKSP-REWR SECOND RECORD OF PAIR
               ORG  830
  830wtm       WTM  4              WRITE TAPE MARK
  835          RWD  4              REWIND
  840          BIN  nxprog,        BRANCH TO LOAD READ PROGRAM
               ORG  850
  850minset    LCA  mcs&6,dly3&6   SET UP INSTRUCTIONS FOR MINIMUM DELAY
  857          LCA  mcs&6            ,,
  861          LCA                   ,,
  862          LCA                   ,,
  863          LCA                   ,,
  864          LCA  nnop&6,522       ,,
  871          LCA  nnop&6           ,,
  875          LCA                   ,,
  876          MN   nop1&5,bce1&6    ,,
  883          MN   bwrite&1,incr&3  ,,
  890          MCW  bxdl1,bnx&3      ,,
  897          BIN  wsetup,        BRANCH TO BEGIN WRITING WITH MINIMUM DLY
               ORG  1052
 1052          MCW  k5s,kxs        CONSTANTS TO MODIFY DELAY INSTRUCTIONS
 1059          A    k5s,kxs          ,,
 1066          C    k5s-4,kxs-2      ,,
                  n0                 ,,
               dc   @b@            BU  dly1
               dc   dly1
     bu        dc   @/@
 1083          dc   #4
               dcw  @b@
 1084bxdl1     dc   nxdly1         unconditional branch instructions
               dc   @b@
 1091bxdl2     dc   nxdly2           ,,
               dc   @b@
 1095bxdl3     dc   nxdly3           ,,
               dc   @b@
 1099bxdl4     dc   nxdly4           ,,
               dcw  @b@
 1103bxdl5     dc   nxdly5           ,,
               dc   @b@
 1107bsetb     dc   setbsp           ,,
               dc   @b@
 1111bwtm      dc   wtm            for groups 2 to 7
 1115          DC   @    @
 1119irg       DCW  @IRG"@         SPACER RECORD    TM IN /19
 1120bber      BER  erhnd2         CONSTANTS TO MODIFY DELAY INSTR
 1125cmpr      C    bwtw2&7,bwtw2&7  ,,
 1132          MCS  274,275          ,,
 1139cs200     CS   dly2,200         ,,
 1146          A    k1001-3,dly1&6   ,,
 1153          A    k1001,dly2&6     ,,
 1160adly3     A    k1001,dly3&6     ,,
 1167bbce      BIN  bce1,            ,,
               ORG  1180
               DCW  #19
               org  82
   85k1001     dcw  1001           CONSTANT
   88gapct     dcw  @xxx@          GAP COUNTER
   91k1240     DSA  1240           CONSTANT - B ADDR OF FIRST TAPE WR INST
   94km10      DSA  3990           CONSTANT TO SUBTRACT 10
   97          DSA  3900           CONSTANT TO SUBTRACT 100
  104k5s       dcw  5000005        CONSTANTS
  109kxs       dcw  @xxxxx@          ,,
  114k1rm      dcw  @1'   @          ,,
  115          BCE  bce1,kxs-4,1   CONSTANTS TO MODIFY DELAY INSTR
  123          BSP  4                ,,
  128bdly1     BIN  dly1,            ,,
  133          BIN  wtw2,            ,,
  138          CS   wtw2,200         ,,
  145          CS   wtw2,279         ,,
  152mcs       MCS  199,200          ,,
  159          NOP  k1001-3,dly0&6   ,,
  166nnop      NOP  0,0              ,,
  173             N00                ,,
  178          MCW  k1rm-3,kxs-3     ,,
  185          A    k1001-2,kxs-3    ,,
  192bwtw2     BIN  wtw2,            ,,
               ORG  1250
 1250gmwm      DCW  @"@            GROUP MARK IN S50
     *
     * Stuff at the end.  Not in one-field-per-card format
     * Looks like it's for automatically figuring out whether the
     * program is loaded from tape.
     *
               org  19
     begin     bce  ontape,tapes2,"  GM at tapes2?
               b    start
     ontape    lca  btape&4,tptest&3
               b    1604
     btape     b    taperd
               ex   begin
               END
