      HED * LOADER-SYSTEM LINKAGE TABLE * 
* qq
***   LOADER-SYSTEM LINKAGE TABLE 
* 
* *q
*     CONTENTS FILLED IN FROM TSB SYSTEM TAPE ON PAPER TAPE 
*     LOADS, FROM DISC ON DISC LOADS. 
* 
      ORG 4000B 
      JMP LDR      INITIATE LOADING SEQUENCE
LSLTB EQU * 
LIBRA BSS 1        SYSTEM LIBRARY PROGRAM ORIGIN
COM6  BSS 1        ADDRESS OF SYSTEM LIBRARY DISC 
*                                   ADDRESSES.
INCRE BSS 1        LENGTH OF TTY TABLE
TTYDA BSS 1        ADDRESS OF USER DISC ADDRESS 
?MASK BSS 1        ADDRESS OF USER MASK 
?BHED BSS 1        => START OF LOGICAL BUFFER 
?BSTR BSS 1        => END OF LOGICAL BUFFER 
?BGIN BSS 1        => START OF PHYSICAL BUFFER
?BEND BSS 1        => END OF PHYSICAL BUFFER
?ID   BSS 1        ADDRESS OF ID-NAME 
SWPIA BSS 1        ADDRESS OF USER-DEPENDENT ITEMS
SWPLN BSS 1        LENGTH OF SWAP AREA
SWPAA BSS 1        CORE ADDRESS OF SWAP AREA
DATE  BSS 1        ADDRESS OF HOUR OF YEAR
TIME  BSS 1        ADDRESS OF TENTHS OF SECONDS 
YEAR  BSS 1        ADDRESS OF YEAR
TSBLA BSS 1         SYSTEM START-UP DISC ADDRESS
MGSLE BSS 1          MAG TAPE SLEEP 
PMAIN BSS 1         START OF UTILITY
PWRFL BSS 1        POWER FAIL INTERRUPT CODE
      HED   UTILITY CONTROL 
MAIN EQU *
      LDA .+24
      LDB TITLE     "2000E UTILITY PROGRAM" CR-LF,LF
      JSB ASR35,I 
INCOM LDA .+3 
      LDB STAR      PRINT * 
      JSB ASR35,I I+
      CLA           INPUT COMMAND 
      JSB ASR35,I 
      JSB CLEAR,I       CLEAR ALL DISC DRIVES 
* 
*     SCAN BUFFER FOR COMMAND 
* 
      JSB GETCA,I    GET FIRST CHARACTER
      JMP CERR        NONE
      ALF,ALF      SAVE IT
      STA ADR1
      JSB GETCA,I    GET SECOND CHARACTER 
      JMP CERR         NONE 
      IOR ADR1
      STA ADR1       STORE COMMAND
      LDA CBUF      LOAD ADDRESS OF COMMANDS
      STA ADR2        SAVE IT 
      LDA .-7       SET COUNT FOR 7 COMMANDS. 
      STA CNT2
      LDA ADR1       LOAD COMMAND 
      CLB           CLEAR COMMAND NUMBER
      CPA ADR2,I    COMPARE COMMAND 
      JMP SCAN      FOUND IT. 
      INB           NOPE - TRY AGAIN
      ISZ ADR2      NEXT COMMAND
      ISZ CNT2      DONE? 
      JMP *-5       NO
* 
CERR  LDA .+8 
      LDB COMRI,I   ???                         (D) 
      JSB ASR35,I 
      JMP INCOM     INPUT COMMAND AGAIN 
* 
*     SCAN:  COMMAND HAS BEEN FOUND 
*            SEARCH FOR FIRST PARAMETER 
* *q
SCAN  STB INDEX     SAVE COMMAND NUMBER 
* 
      JSB GETCA,I 
      JMP *+4        NO PARAMETER 
      CPA COMMA 
      RSS 
      JMP *-4       NO-NEXT CHAR
* 
*     PARAMETER HAS BEEN FOUND
*     GO TO CORRECT COMMAND 
* qq
      LDA TBAD      LOAD ADDRESS OF COMMAND JUMP TABLE
      ADA INDEX     ADD INDEX OF COMMAND
      JMP 0,I I
* 
TBAD  DEF *+1,I     COMMAND JUMP TABLE
      DEF LOADA
      DEF COPY
      DEF SLOAD 
      DEF SDUMP **
      DEF FORMA 
      DEF PACK
      DEF DLOAD 
* qq
CBUF  DEF CTABL 
CTABL ASC 7,LOCOSLSDFOPADL  LOAD,COPY,SLOAD,ETC.
* 
* 
      HED           *A LOAD ROUTINE **
* 
*     LOAD DISCS FROM MAGNETIC TAPE 
*     AND INITIATE OPERATION OF TSB 
* qq
LOAD  JSB GETCA,I 
      JMP LDR       NONE - PAPER TAPE 
      JSB BBSP,I
      JSB OCTLA,I    CHECK FOR OCTAL INTEGER
      JSB SCHKA,I   CHECK SELECT CODE 
      STA MTFLG     SET MAG TAPE FLAG 
      JSB MGTPC,I   CONFIGURE MAG TAPE
* 
      JSB MGTP,I
      OCT 3         REWIND TAPE 
* 
*     LOAD DISCS FROM TAPE
* *q
      LDA .-5       LOAD ID AND LABEL 
      STA WORD,I
      LDB TBUFU&
      JSB MGTP,I
      OCT 0 
      JMP EOFA,I
      JMP TPEA,I
      LDA B100
      LDB TBUF
      JSB DISC,I
      LDA B111      READ
      LDB B100        EQUIPMENT TABLE 
      JSB MGTP,I
      OCT 0 
      JMP EOFA,I
      JMP TPEA,I
      JMP LDR14     GO BUILD ADT
* qq
B377  OCT 377 
DISCA OCT 0 
DRP   OCT 0 
TCNT  OCT 0 
MGTP  DEF MGTDR 
MGTDR EQU XMTD
MGTPC DEF MTDIN 
ADR1  OCT 0 
*                                                                            4
      HED * TSB LOADER *
* 
***   MAIN LOADING SEQUENCE 
* 
* 
*     BEGIN HERE FOR NORMAL LOADING SEQUENCES.
* 
LDR   JSB SCFGI,I   CONFIGURE THE SYSTEM CONSOLE (D)
      CLB           SET 
      STB SLEPT     INITIALIZE SLEEP FLAG       (D) 
      CLC 0,C         I/O 
      ISZ 1             TO
      JMP *-2             NULL STATE
      CLA          ZERO 
      STA SYSLF    DIRECTORY TRACK
      STA SYSLF+1  COUNTERS 
      STA SDRVA,I 
      JSB LSTAT,I      MAKE SURE DISC IS READY
      LDA .12      ASK
      LDB LBRYA 
      JSB ASR35,I  IF LIBRARY 
      CLA 
      JSB ASR35,I  EXISTS?
      JSB GETCA,I  ANSWER GIVEN?
      JMP ERR1     NO 
      CPA Y        YES, 'Y'?
      JMP LDR5     YES, ASSUME 'YES'
      CPA N        NO, 'N'? ?J
      JMP LDR1     YES, ASSUME 'NO' 
ERR1  LDA .15 
      LDB ILINA    TRY
      JSB ASR35,I  AGAIN
      JMP LDR+1                                 (D) 
LDR1  LDA .20       ASK 
      LDB SYSDA       FOR 
      JSB ASR35,I       SYSTEM
      CLA                 ID
      JSB ASR35,I           CODE
* 
*     CONVERT SYSTEM ID CODE
* 
      JSB INTGA,I     GET SYSTEM ID 
      CPB B5.7      NONE? 
      JMP ID1 
      STB SYID1 
      LDA M128      OUTPUT  
      STA WORD,I      ID AND LABEL
      LDA B100          TO DISC 
      LDB SYIDT 
      JSB DISC,I
      JMP ID2 
ID1   LDA .15 
      LDB ILINA 
      JSB ASR35,I 
      JMP LDR1
* qq
* 
***   SYSTEM GENERATION 
* 
* 
*     CREATE NASCENT EQUIPMENT TABLE
* 
ID2   LDA M16       SET DIRECTORY LENGTH
      STA DIREC    FOR TWO DUMMY ENTRIES
      LDA EQTLN    ZERO 
      STA TEMP0    OUT
      CLB          THE REST 
      LDA EQTA
LDR2  INA          OF THE 
      STB 0,I 
      ISZ TEMP0    EQUIPMENT TABLE
      JMP LDR2
      CLA          SET
      STA TEMP1    FOR
      LDA B11      DISC SELECT CODE 
      STA TEMP2 
      LDA SETDS     SET DISC ENTRY
      STA DTBL
      CCB 
      STB MTFLG    SET FLAG TO 'SYSGEN' MODE
      JMP LDR14 
* qq
***   INITIATE PAPER TAPE RELOAD
* qqq{
* 
*     PRIMARY USE IS FOR LINKING A NEW SYSTEM (FOR EXAMPLE, A 
*     SYSTEM UPDATE) WITH THE LIBRARY OF A CURRENT SYSTEM.
* 
LDR5  LDA B11      FAKE DTBL ENTRY
      STA DTBL     FOR DISC DRIVER
      LDA M256      READ
      STA WORD,I   EQUIPMENT
      LDA DEQTA    TABLE
      LDB CEQTA    FROM 
      JSB DISC,I   DISC 0 
* 
***   BEGIN EMERGENCY LOADING SEQUENCE
* 
* 
*     ENTRY IS TO HERE WHEN ATTEMPTING TO RELOAD THE SYSTEM 
*     USING THE EQUIPMENT TABLE IN CORE (I.E., SYSTEM WAS 
*     HALTED BY OTHER THAN THE 'SLEEP' ROUTINE).
* *q
LDR6  CLA          SET FLAG TO
      STA MTFLG    'PAPER TAPE RELOAD'
      STA SYSLF    ZERO COUNTERS FOR
      STA SYSLF+1  DIRECTORY TRACKS 
      LDA ADLEN    READ 
      AND M128
      STA WORD,I   ADT
      LDB ADTBA 
      ADB BIT15    FROM 
      LDA ADLOC 
      JSB DISC,I   DISC 
      LDA ADLEN    RECOVER THE
      JMP LDR18    SYSTEM TRACKS
      SKP 
* 
* 
***   BUILD ADT 
* 
* 
*     CREATE AN ADT ENTRY OF ZERO SECTORS FOR EACK AVAILABLE
*     TRACK (THE TRACK LENGTH WILL BE FILLED IN BELOW). THE 
*     ENTRY FOR TRACK 0, DISC 0 AND A TERMINATING PSEUDO- 
*     ENTRY BOUND THE ADT.
* 
LDR14 LDA ADTBA    CREATE 
      LDB DISCN 
      STB 0,I      FIRST
      INA 
      CLB 
      STB LBAD      NO BAD TRACKS 
      STB 0,I      ADT
      INA 
      STA TEMP1    ENTRY
      LDA M202     INITIALIZE 
      STA TEMP2    ADT ENTRIES
      LDA M6144     SET LENGTH OF TRACK TO TEST 
      STA WORD,I
      LDA DISCN 
      STA TEMP3 
LDR15 LDA TEMP3 
      ADA B200
      STA TEMP3    SAVE DISC ADDRESS OF CURRENT TRACK 
      JSB DNTR,I    FORMAT DISC TRACK 
      JMP LD.15 
      ISZ LBAD       BAD TRACK
      JMP LDR15     BAD TRACK IGNORE
LD.15 EQU * *V
      LDA TEMP3 
      STA TEMP1,I IE
      ISZ TEMP1    CREATE 
      CLB 
      STB TEMP1,I     ZERO-LENGTH 
      ISZ TEMP1    ADT ENTRY
      ISZ TEMP2     ALL TRACKS CONSIDERED?
      JMP LDR15    NO 
      LDA TEMP1    YES
      CCB          APPEND 
      STB 0,I 
      INA          TERMINAL 
      CLB 
      STB 0,I      PSEUDO-ENTRY 
      CMA          RECORD -#
      ADA ADTBA    OF WORDS 
      STA ADLEN    IN ADT 
      LDB LBAD      ANY BAD TRACKS? 
      SZB,RSS 
      JMP LDR18       NO
      LDA LBAD
      LDB LBDMS Sh
      JSB NMOTA,I    YES - TELL OPERATOR ABOUT THEM 
      LDA .+22
      LDB LBDMA 
      LDA ADLEN     RESTORE (A)                 (D) 
* 
***   RECOVER TRACKS
* *q
*     ALL ADT ENTRIES WITH ZERO SECTORS ARE RECOVERED 
*     AS FULL TRACKS. THIS PICKS UP ALL SYSTEM TRACKS ON
*     PAPER TAPE RELOADS AND RETURNS THEM TO THE POOL OF
*     TRACKS AVAILABLE FOR LOADING BELOW. 
*     ENTER WITH (A) = -#ENTRIES IN ADT.
* 
LDR18 ADA .4       SET ENTRY COUNTER
      ARS          (SKIPPING FIRST
      STA TEMP0    AND LAST ENTRIES)
      LDA ADTBA    LOAD ADDRESS 
      INA          OF SECOND WORD 
LDR19 ADA .2       OF ENTRY 
      LDB 0,I      IS LENGTH
      SZB,RSS      0 SECTORS? 
      JMP LDR21    YES
LDR20 ISZ TEMP0    NO, DONE?
      JMP LDR19    NO 
      JMP LDR23    YES
LDR21 CCB          LOAD 
      ADB 0        ENTRY'S
      LDA 1,I      DISC ADDRESS 
      JSB ISOTA,I  GET TRACK LENGTH 
      INB          IN SECTORS 
      STA 1,I      RESTORE TO 
      LDA 1        FULL TRACK 
      JMP LDR20 
* qq
***   CLAIM DISC TRACKS 
* qq
* 
*     CLAIM TRACKS FOR THE SYSTEM AND USER SWAPPING. THE
*     ADT ENTRIES ARE SET TO LENGTH ZERO RATHER 
*     THAN BEING REMOVED. 
* 
LDR23 JSB NPRTA,I  GET NUMBER OF PORTS
      LDA .-21
      STA TEMP0 
      LDB TRKTA 
      CLA          TRACK TABLE
      STA 1,I 
      INB 
      ISZ TEMP0    TO ZEROS 
      JMP *-3 
      LDA .-21      GET ONE LOADER TRACK
      STA TEMP0 
      LDA TRKTA    FOUR SYSTEM TRACKS,
      STA TEMP1 
LDR24 CLA          FOUR SYSTEM LIBRARY TRACKS,
      JSB GTTRA,I 
      STA TEMP1,I      AND 16 
      ISZ TEMP1 
      ISZ TEMP0    USER TRACKS
      JMP LDR24 
      LDB TRKTA,I   SET DISC ADDRESS OF LOADER
      STB LDRT0,I   SYSTEM TRACK INTO DISC LOADER 
      LDB TRKTA 
      INB           SET DISC ADDRESSES OF TSB 
      DLD 1,I         INTO DISC LOADER
      DST LDRT1,I       FOR BOOTSTRAP LOADING 
* 
***   WRITE SYSTEM LOADER TO DISC 
* 
*     THIS SECTION WRITES THE TSB SYSTEM DISC LOADER ONTO 
*     TRACK 0: SECTORS 1,2,3
* qq
      LDA N1024       TRANSFER
      STA WORD,I   SYSTEM LOADER
      CLA,INA       TO DISC 0 
      ADA B100
      LDB TSBBA 
      JSB DISC,I
* 
      LDA MTFLG    RELOAD FROM
      SZA,RSS      PAPER TAPE?
      JMP LDR43    YES
* 
***   GET REST OF SYSTEM TRACKS 
* qq
* qq
*   CLAIN 4 TRACKS FOR THE IDT AND 1 TRACK FOR THE ADT
* 
      LDA M4
      STA TEMP0 NN
      LDB IDTTA     SET ADDRESS OF DISC ADDRESSES 
      STB TEMP1 
      LDA IDTRL 
      STA IDTLA 
LDR28 EQU * YYYB
      CCA 
      JSB GTTRA,I   GET A TRACK 
      STA TEMP1,I   SAVE IT 
      ISZ TEMP1 
      LDA MTFLG     MAG TAPE? 
      SSA,RSS S
      JMP LDR26       YES!
      CLA 
      STA IDTLA,I 
      ISZ IDTLA 
LDR26 EQU * *
      ISZ TEMP0 
    JMP LDR28 
      CCA          CLAIM TRACK FOR ADT
      JSB GTTRA,I 
      STA ADLOC 
      LDA M2       SET TO COUNT TWO 
      STA TEMP0    DIRECTORY TRACKS 
      LDB DIRE6    PUT DIRECTORY ADDRESS
LDR31 STB TEMP1    IN TEMP1 
      CCA          REMOVE TRACK FROM
      JSB GTTRA,I  ADT
      STA TEMP1,I  PUT TRACK # IN DIRECTORY 
      LDB TEMP1    COMPUTE NEXT 
      ADB .7       DIRECTORY ENTRY
      ISZ TEMP0    ALL TRACKS CLAIMED?
      JMP LDR31    NO 
      LDA M128
      STA WORD,I   WRITE
      LDA DIRE6,I  NULL 
      STA TEMP4    DIRECTORY
      LDB DIRBA    TO 
      JSB DISC,I   DISC 
      LDA MTFLG     MAG TAPE
      INA,SZA,RSS     LOAD? 
      JMP LDR43     NO
*     IN LOADER 
* qq
*     READ IN ID TRACKS 
* 
      LDA IDTTA 
      STA IDTRA AS
      LDA IDTRL 
      STA IDTLA 
      LDA .-4 
      STA TCNT88
LDR27 LDA IDTLA,I   LOAD
      STA WORD,I      TRACK 
      LDB TBUF          FROM
      JSB MGTP,I          MAG 
      OCT 0                 TAPE
      JMP EOFA,I,H
      JMP TPEA,I
      LDA IDTRA,I   OUTPUT
      LDB TBUF        TO
      JSB DISC,I        DISC
      ISZ IDTLA 
      ISZ IDTRA 
      ISZ TCNT
      JMP LDR27 
* 
*     LOAD LIBRARY
* 
* 
      LDA M2030j
      STA TEMP0     INPUT TRACK 
      LDB TRTAB       TABLE 
      STB TEMP1 
      JSB MGTP,I
      OCT 0 QQ
      JMP EOFA,I
      JMP TPEA,I
      LDA B100
LDR32 EQU * 
      LDB TEMP1,I   LOAD TRACK LENGTH 
      SZB,RSS       ZERO? 
      JMP LDR37     YES - EMPTY TRACK 
      STA TEMP2 
      CLA 
      CMB,INB 
      STB COUNT     SAVE SECTORS REQUIRED 
      ASL 7         SAVE WORD LENGTH
      STB WORD,I
      LDB ADLEN     SET ADT 
      BRS             CONTER
      STB TEMP3 
      LDB ADTBA 
      INB 
LDR33 LDA 1,I I@
      ADA COUNT     GET LENGTH OF ADT ENTRY 
      SSA,RSS       ENOUGH ROOM?
      JMP LDR35     YES 
      ADB .+2       NO - TRY SOME MORE
      ISZ TEMP3     DONE? 
      JMP LDR33     NO
* qq
ERR5  LDA .20      NO 
      LDB OODSA    TERMINATE
      JSB ASR35,I  LOADING
      JMP ERINA,I 
LDR34 LDA 1,I       SAVE DISC ADDRESS 
      STA TEMP3     REMOVE
      ADB .+2         ADT 
      LDA 1             ENTRY 
      JSB MOVUA,I 
      JMP LDR36 
LDR35 STA 1,I       SAVE REMAINDER
      ADB .-1 
      SZA,RSS       ANY LEFT? 
      JMP LDR34     NO
      LDA 1,I       YES - SAVE DISC ADDRESS 
      STA TEMP3 
      ADA TEMP1,I   COMPUTE NEW DISC ADDRESS
      STA 1,I 
LDR36 LDA TEMP2     COMPUTE NEW DISC ADRESS 
      CMA,INA         MINUS OLD DISC ADDRESS
      ADA TEMP3 
      STA TEMP1,I   SAVE IN TRACK 
      LDA WORD,I      TABLE 
      ADA D3072    TOO LONG?
      SSA,RSS 
      JMP LDRE1     NO
      STA COUNT     YES - SAVE DIFFERENCE 
      LDA M3072 
      STA WORD,I    READ FROM TAPE
      LDB TBUF
      JSB MGTP,I
      OCT 0 
      JMP EOFA,I
      JMP TPEA,I,)
      LDA TEMP3     OUTPUT TO 
      LDB TBUF  DISC
      JSB DISC,I
      LDA COUNT 
      STA WORD,I
      LDA COUNT     READ
      STA WORD,I      REMAINDER 
      LDB TEMP3         FROM
      ADB .+24            TAPE
      STB TEMP3 
LDRE1 LDA WORD,I
      LDB TBUF
      JSB MGTP,I
      OCT 0 
      JMP EOFA,I
      JMP TPEA,I
      LDA TEMP3     WRITE 
      LDB TBUF        TO
      JSB DISC,I        DISC
      LDA TEMP2     UPDATE OLD
LDR37 EQU * 
      ADA B200        TACK ADDRESSES
      ISZ TEMP1 
      ISZ TEMP0     DONE
      JMP LDR32     NO
* 
*     LOAD DIRECTORY
* 
      LDA DIRD0 
      STA TEMP0 NN
LDR40 LDA TEMP0,I   LOAD LENGTH 
      SZA,RSS 
      JMP LDR43 3p
      STA WORD,I
      LDB TBUF
      JSB MGTP,I    READ DIRECTORY TRACK
      OCT 0 0Q
      JMP EOFA,I,H
      JMP TPEA,I
      LDA WORD,I    SAVE #
      CCB             OF
      ASR 3             ENTRIES 
      STA TEMP1 
      LDB TBUF
LDR41 EQU * 
      ADB .+6       LOAD DISC ADDRESS 
      LDA 1,I 
      RAL           GET TRACK 
      ALF,ALF         NUMBER
      AND B377
      ADA TRTAB 
      LDA 0,I       GET MODIFICATION VALUE
      ADA 1,I       COMPUTE NEW DISC ADDRESS
      STA 1,I 
      ADB .+2 
      ISZ TEMP1     MORE? 
      JMP LDR41     YES 
      LDA TEMP0     WRITE DIRECTORY 
      ADA .+6         TRACK TO
      LDA 0,I           DISC
      LDB TBUF
      JSB DISC,I
      LDA .-5 
      STA WORD,I    SET B.PB
      LDA TEMP0       DIRECTORY 
      ADA .+6 6q
      LDA 0,I 
      LDB TEMP0 
      INB 
      ADB BIT15 
      JSB DISC,I
* 
      LDA TEMP0     SECOND
      ADA .+7         TACK
      STA TEMP0     SEE IF WE'VE
      LDA DIRD0       ALREADY 
      ADA .+7           DONE
      CPA TEMP0           IT
      JMP LDR40     NO
* qq
***   WRITE ADT TO DISC 
* 
LDR43 LDB ADLEN      WRITE
      STB WORD,I   ADT
      LDA ADLOC 
      LDB ADTBA    TO 
      JSB DISC,I   DISC 
* 
      CCA          INITIALIZE 
      STA SYSLF    SYSTEM LIBRARY 
      STA SYSLF+1  FLAGS
      LDA MTFLG    LOADING FROM 
      CMA,SSA,INA,SZA    DISC?
      JMP LDR50 
* qq
***   LOAD SYSTEM FROM PAPER TAPE 
* qq
* qq
*     READS THE TSB SYSTEM TAPE, OR TAPES IF MORE THAN ONE
*     EXECUTING A HLT 77B ON RECOGNIZING AN END-OF-TAPE 
*     CONDITION). THE LAST RECORD IS IDENTIFIED BY AN ORIGIN
*     OF 0. CHECKSUM'S ARE COMPUTED FOR EACH RECORD: A FAILURE
*     MAY BE RETRIED BY BACKING UP TO THE START OF THE RECORD.
*     THE CORE TO BE OCCUPIED BY EACH RECORD IS CHECKED AGAINST 
*     A TABLE OF ADMISSABLE AREAS TO HELP CATCH ORIGIN
*     MIS-READS BEFORE LOADING A RECORD. RECOVERY MAY BE
*     ATTEMPTED BY BACKING UP TO THE BEGINNING OF THE RECORD. 
* qq
LDR46 CLA,RSS      SET FOR START OF TAPE
      LDA M10      SET FOR END-OF-TAPE CHECK
      CCE          GET RECORD'S 
LDR47 JSB READA,I  WORD COUNT 
      CMB,CCE,INB,SZB     AS NEGATIVE 
      JMP LDR48 
      INA,SZA      FEED FRAME, END-OF-TAPE? 
      JMP LDR47    NO 
      LDA .13      YES
      LDB EOTMA    PRINT
      JSB ASR35,I  'END OF TAPE'
      HLT 77B      WAIT FOR NEXT TAPE 
      JMP LDR46 
LDR48 STB COUNT    SAVE WORD COUNT
      CMB          SAVE TRUE
      STB TEMP1    WORD COUNT -1
      JSB READA,I  SKIP FEED FRAME
      JSB READA,I  READ LOAD ORIGIN 
      SZB,RSS      ZERO ORIGIN? 
      JMP LDR70     YES 
      LDA 1        NO, INITIALIZE CHECKSUM COUNTER
      STB TEMP0    SAVE 
      STB TEMP3    ORIGIN 
      CPB LNKAD    SYSTEM LINKAGE ADDRESSES?
      JMP LDR49    YES
      JSB ADVLA,I   NO, VALIDATE ORIGIN 
      LDB 0        COMPUTE LAST ADDRESS 
      ADB TEMP1    TO BE LOADED 
      JSB ADVLA,I  VALIDATE IT
LDR49 CPA LIBRA    SYSTEM LIBRARY PROGRAM?
      JSB SYSLB    YES
      CLE          READ A 
      JSB READA,I  WORD 
      ADA 1        ADD TO CHECKSUM COUNTER
      STB TEMP0,I  STORE WORD 
      ISZ TEMP0    ADVANCE ADDRESS
      ISZ COUNT    RECORD ALL READ? 
      JMP LDR49+2  NO 
      CLE          YES
      JSB READA,I  READ CHECKSUM
      CPB 0        DO CHECK SUMS AGREE? 
      JMP LDR46+1  YES
      STA TEMP1    NO, SAVE 
      STB TEMP2    REGISTERS
      CCB 
      LDA TEMP3    FIRST RECORD OF
      CPA LIBRA    SYSTEM LIBRARY PROGRAM?
      STB SYSLF+1  YES, PROTECT AGAINST SPURIOUS
      LDA .17      CALL TO SYSLB
      LDB CHKSA    PRINT
      JSB ASR35,I  'CHECKSUM ERROR' 
      LDA TEMP1    LOAD REGIST    
      LDB TEMP2    FOR DISPLAY
      HLT 66B      WAIT FOR REREAD ATTEMPT
      JMP LDR46 
* 
*     NOW LOAD USER DISCS 
* 
LDR50 CLA,INA A
      CLB 
      JSB MGTP,I      SPACE OVER ONE FILE 
      OCT 4 
      JMP EOFA,I
      JMP TPEA,I
      CLA,INA 
      STA SUB1A,I   SET UP
      LDA DIRD0       FOR 
      ADA .+14          SELECTIVE LOAD
      STA DRP 
      STA DRP1
LDR52 ADA .+6       IS DISC ON SYSTEM 
      LDA 0,I 
      SZA 
      JMP LDR51 
LDR54 LDA DRP1
      CPA DIRD3     ANY MORE DRIVES?
      JMP LDR55     NO - LOAD SYSTEM
      ADA .+14      YES - GO TO NEXT ONE
      STA DRP 
      STA DRP1
      ISZ SUB1A,I 
      JMP LDR52 
* 
LDR51 LDB SUB1A,I   FORM DISC ADDRESS 
      JSB FSUBA,I 
      STA DSC1A,I 
      CLA           CLEAR 
      STA SFLAG       SELECTIVE FLAG
      JMP SL1A,I    LOAD DISC 
LDR53 CLA,INA 
      CLB 
      JSB MGTP,I      SPACCE OVER FILE
      OCT 4 4
      JMP EOFA,I
      JMP TPEA,I))
* 
*     UPDATE ADT
* 
      LDA ADLEN     READ CURRENT ADT
      STA WORD,I      FROM SYSTEM DISC
      LDA ADLOC 
      LDB TBUFI 
      JSB DISC,I
      LDB ADLEN 
      ADB .+2 
      CMB,INB 
      ADB TBUF
      ADB BIT15 
      LDA ADTTT     INPUT ADDITIONAL
      STA WORD,I      ADT ENTRIESX
      LDA DSC1A,I 
      ADA .+2 
      JSB DISC,I
      LDA ADLEN 
      ADA ADTTT     RESET ADT LENGTH
      STA ADLEN 
      STA WORD,I,
      ADA .+2 
      CMA,INA 
      ADA TBUF      APPEND
      CCB             PSEUODO ENTRY 
      STB 0,I           TO END
      INA 
      CLB 
      STB 0,I \\
      LDA ADLOC     OUTPUT
      LDB TBUF        UPDATED ADT 
      JSB DISC,I        TO DISC 
      JMP LDR54     MORE DISCS? 
* 
*     LOAD SYSTEM FROM MAG TAPE 
* 
LDR55 CLA 
      STA SYSLF+1 
      LDA B111      OUTPUT
      STA WORD,I      CORRECT 
      LDA DEQTA         EQUIPMENT 
      LDB B100            TABLE 
      JSB DISC,I
      LDA .-9       INPUT 
      LDB TBUF        FIRST 
      JSB MGTP,I        RECORD
      OCT 0 
      JMP EOFA,I
      JMP TPEA,I
      LDA TBUF,I    LOAD # OF SEGMENTS
      STA COUNT 
      LDA TBUF
      INA 
      STA TEMP0 
      ISZ  COUNT
LDR56 LDA TEMP0,I   LOAD SEGMENT LENGTH 
      ISZ TEMP0 0P
      LDB TEMP0,I   LOAD CORE ADDRESS 
      JSB MGTP,I    READ SEGMENT
      OCT 0 
      JMP EOFA,I
      JMP TPEA,I
      ISZ TEMP0 
      ISZ COUNT 
      JMP LDR56 
      LDA B111      UPDATE
      STA WORD,I      EQUIPMENT 
      LDA DEQTA         TABLE 
      LDB B100
      ADB CEQTA 
      JSB DISC,I
* 
*     LOAD SLOP 
* 
LDR58 LDA M256
      LDB LIBRA     READ SYSTEM 
      JSB MGTP,I      LIBRARY 
      OCT 0             PROGRAM 
      JMP LDR57 
      JMP TPEA,I
      JSB SYSLB     WRITE TO DISC 
      JMP LDR58 
LDR57 BLF,BLF       EOF?F
      SSB,RSS 
      JMP EOFA,I    NO
      JSB MGTP,I    REWIND
      OCT 5 
      JMP LDR70+1 
LDR70 JSB SYSLB     TRANSFER LAST PAPER TAPE PROGRAM
