/SYSSET: SYSTEM SETUP ROUTINE
WC=30;CA=31                 /FOR DECTAPE
A=2000;B=2400;G=2470        /WORK-SPACE
EXEC=6000
FPLOC=17000
AI  A+42
BI  B
CI  -70
GI  G
I   0
J   -17000
K   -70
RELOC 0
LOC 0
SUPA 0
SUPB 2000
SUPC -2000
BA  Z1
BB  0
BC  -17
BIN .SIXBT 'BIN
S0  IOF
    DZM* I; ISZ I           /CLEAR STORE
    ISZ J; JMP .-3
    LAC (DV; JMS DT         /READ DIRECTORY
S4  LAC* AI; ISZ AI         /STORE FIRST
    SAD BIN; SKP; SKP!CLA   /BLOCKS OF ALL
    LAC* AI                 /BIN FILES
    AND (1777; DAC* BI
    ISZ BI; ISZ AI
    ISZ AI; ISZ AI
    ISZ K; JMP S4
    LAC (B; DAC BI          /LOAD BIN FILES
S6  CLC; DAC START#
    LAC* BI; SZA; JMS LOAD
    ISZ BI; ISZ CI; JMP S6
    DZM* LOC                /ZERO MARKS END OF SUBS
S7  LAC* SUPA; DAC* SUPB    /COPY UP SUPER
    ISZ SUPA; ISZ SUPB
    ISZ SUPC; JMP S7
S8  LAC* BA; DAC* BB        /SET BLOCK 0
    ISZ BA; ISZ BB
    ISZ BC; JMP S8
    LAC LOC; CLL; HLT       /DISPLAY LIM
    LAS; SMA; JMP S9        /-> BLOCK 1 UPWARDS
    LAC (SV0; SKP           /BLOCK 0 UPWARDS
S9  LAC (SV1; JMS DT        /WRITE NEW SYSTEM
    CLL; HLT
    JMP* (2000              /==> SYSTEM
Z1  JMP 17646; 0; 0; 0; 0   /FOR BLOCK 0
    JMP 106; JMP 107        /ENTRIES FROM BOOT
    LAC 2100; DAC 2000
    ISZ 107; ISZ 110
    ISZ 116; JMP 107
    JMP 2000
    -15000
/LOAD BINARY FILE
LOAD
L1  DAC DV+1                /BLOCK NUMBER
    LAC (DV; JMS DT         /READ BLOCK
    LAC (A; DAC AI
L2  LAC AI; DAC H#          /HEADER WORD
    ISZ AI; ISZ AI
    LAC* H; SPA!SNA; JMP L6
    AND (777077; DAC* H
    AND (77; SZA; JMP L6
    LAW -1000
L3  TAD* H; DAC* H          /DECREMENT WPC
    SNA; JMP L2
    LAC AI; DAC I           /CODE WORD
    LAW -3; DAC CC#         /CODE COUNT
    ISZ AI
L4  LAC* I; RTL; RTL; RTL
    DAC* I; RAL; AND (77    /6-BIT CODE
    SAD (02; JMP L10        /SEGMENT START ->
    SAD (04; JMP L20        /ABS VALUE ->
    SAD (07; JMP L30        /SYM1 ->
    SAD (23; JMP L40        /INT DEF ->
    SAD (30; JMP L50        /PARAM DEF ->
    SAD (27; JMP* LOAD      /END =>
L5  ISZ AI; ISZ CC; JMP L4  /OTHER CODES IGNORED
    LAW -2000
    JMP L3
L6  LAC* (A+377; SMA; JMP L1
L9  STL!HLT                 /PREMATURE EOF
    JMP* LOAD
L10 LAC* AI; AND (77777
    SAD* AI; JMP* LOAD      /NOT ABS PROGRAM =>
    SAD (FPLOC; JMP L11     /FILE PROCESSOR START ->
    TAD RELOC; DAC LOC      /MAYBE CONTINUATION
    JMP L13
L11 LAC RELOC; SZA; JMP L12 /NOT FIRST ->
    LAC* (EXEC+1; DAC LOC   /SIZE OF EXEC
    SNA; STL!HLT            /EXEC MUST BE THERE
L12 LAW -FPLOC; TAD LOC     /LOAD AD - NOTIONAL AD
    DAC RELOC
L13 LAC START; SPA          /START = INITIAL LOC
    LAC LOC; DAC START
    JMP L5
L20 LAC* AI; DAC* LOC       /LOAD ABS VALUE
    ISZ LOC
    JMP L5
/DEAL WITH GLOBALS
L30 LAC* AI; AND (177777    /STORE SYM-('.'*50*50)
    TAD (-127400; DAC* GI   /IN CASE GLOBAL
    JMP L5
L40 LAC* GI; SPA; JMP L5    /NOT .?? ->
    LAC RELOC
    SZA; STL!HLT
    ISZ GI
    LAC* AI; DAC* GI        /STORE DEFINITION
    ISZ GI
    JMP L5
L50 LAC* GI; SPA; JMP L5    /NOT .?? ->
    LAC (G; DAC J
    LAC* GI
L51 SAD* J; JMP L52         /MATCH ->
    ISZ J; ISZ J
    JMP L51
L52 LAC J; SAD GI; JMP L59  /NOT IN LIST ->
    ISZ J                   /BUMP TO DEFINITION
    LAC START; DAC K        /SEARCH FOR REFS
L53 LAC K; SAD LOC; JMP L5  /FINISHED ->
    LAC* K; AND (17770
    SAD* AI; SKP; JMP L54   /NO MATCH ->
    LAC* K; AND (OPR
    SNA; JMP L54            /NOT MEM REF ->
    SAD (IOT; JMP L54       /NOT MEM REF ->
    SAD (OPR; JMP L54       /NOT MEM REF ->
    LAC* K; XOR* AI         /REMOVE DUMMY VALUE
    TAD* J; DAC* K          /ADD TRUE VALUE
L54 ISZ K
    JMP L53
L59 LAC* GI; STL!HLT        /DISPLAY CULPRIT
    JMP L5
/DECTAPE (MODIFIED GP HANDLER)
DV  02002; 100; -400; A
SV0 14002; 0; -17000; 0
SV1 14002; 1; -16400; 400
DT
    DAC DA
    LAW -2; DAC TRY
B1  DTCA
    LAC DA
    DAC DB; ISZ DB          /*REQD BLOCK
    LAC* DA                 /FUN+UNIT
    AND (16007; DAC* DA     /NO FUNNIES
    AND (7; DAC U           /UNIT
    LAC (U2; DAC* (CA       /*UNIT SLOT
    LAC (NOP; DAC Q         /NOP IF REV
    LAC* DB
    SMA!RAL; ISZ Q          /CMA IF FWD
    LAC U; RTR; RTR
    XOR (21000; DAC U       /UUUDGN+SEARCH
    LAC U2; XCT Q; TAD* DB
    RAL
    LAC U
    SNL; JMP B6
B2  XOR (40000
B3  JMS ACT                 /BACK OFF
    SZL; JMP B5             /EOT
    LAC U2; XCT Q; TAD* DB
    SPA!SNA!CLA; JMP B3
B5  XOR (40000
B6  JMS ACT                 /HOME IN
    SZL; JMP B2             /EOT
    LAC U2; XCT Q; TAD* DB
    TAD (1
    SMA!SZA!CLA; JMP B6     /-> KEEP GOING
    SNL; JMP B2             /->BACK OFF
    LAW -4; XCT Q           /THIS IS IT
    ADD U2; DAC U2
    ISZ DB                  /WORD COUNT
    LAC* DB; DAC* (WC
    SMA!CLC; JMP B8
    ISZ DB                  /*BUFF START
    TAD* DB; DAC* (CA
    DTRA; AND (17400; XOR* DA
    JMS ACT
B8  DTRA; AND (21000; DTXA  /STOP UNIT
    JMP* DT
ACT
    XOR (400; DTXA
    DTRB; SNA!RCL; JMP .-2
    SNL!RTL; JMP* ACT
    ISZ TRY; SKP
    STL!HLT
    SNL; JMP B1
    LAC (20000              /GO BIT
    JMP* ACT                /EOT
U2
DA;DB;Q;U;TRY
DTCA=707541;DTXA=707544;DTRA=707552;DTRB=707572
    .END S0
