*****************
*M*      BOOTSUBR SYSTEM INITIALIZATION WITH PATCHING/RECONFIGURATION
*****************
         PAGE
*P*
*P*      NAME:    BOOTSUBR
*P*      PURPOSE: THIS MODULE CONTROLS THE CP-V BOOT-TIME
*P*               PROCEDURES (I.E., FOR TAPE BOOT & FOR
*P*               DISC BOOT).
*P*      DESCRIPTION:  THE BOOTSUBR MODULE IS A PART OF THE
*P*               CP-V MONITOR ROOT WHEN BOOTED. BOOTSUBRS ENTRY
*P*               IS MONINIT. BOOTSUBR CAN BE ENTERED IN ONE OF
*P*               SEVERAL WAYS: COLD TAPE BOOT, BOOT TAPE UNDER
*P*               FILES, DISC BOOT, RECOVERY, OR OPERATOR RECOVERY.
*P*               BOOTSUBR DETERMINES TARGET MACHINE TYPE, OC
*P*               ADDRESS, CORE SIZE, BOOT TYPE CODES (IF TAPE BOOT),
*P*               REAL-TIME INFO (IF REAL-TIME SYSTEM), DATE, TIME,
*P*               & THEN ENTER THE TAPE BOOT PORTION OF BOOTSUBR
*P*               IF TAPE BOOT. IF NOT TAPE BOOT, THEN XDELTA IS
*P*               OBTAINED ALONG WITH THE MONITORS EXTENSION & THE
*P*               CORE VALUES ARE DETERMINED. XDELTA IS NOT
*P*               RETAINED UNLESS SO DESIRED. IF THE SYSTEM IS FOR
*P*               NON-REAL-TIME, BOOTSUBR EXITS. HOWEVER, IF IT IS
*P*               REAL-TIME, THEN REAL-TIME CORE IS ALLOCATED.
*P*               WHEN THE BOOT IS FROM TAPE, THEN THE ROUTINE
*P*               TBOOT: IS ENTERED. RECONFIG IS ENTERED TO
*P*               INITIALIZE THE DEVICE ADDRESS TABLES & TO
*P*               DETERMINE IF THE TARGET MACHINE IS THE SAME
*P*               AS THE SYSTEM BEING BOOTED. TBOOT: THEN
*P*               REQUESTS DEVICE ADDRESS CHANGES FOR THE
*P*               C,LL,DC (CARD READER, LINE PRINTER, SWAPPER(S)
*P*               RESPECTIVELY) IF CHANGES ARE NECESSARY. THE
*P*               SWAPPER(S) IS(ARE) THEN CHECKED TO DETERMINE
*P*               IF THE TARGET MACHINES SWAPPER(S) IS(ARE) THE
*P*               SAME AS THAT FOR WHICH THE SYSTEM WAS SYSGENED.
*P*               TBOOT: THEN INITIALIZES THE JIT & WRITES IT TO
*P*               THE SWAPPER. THE SYSTEMS VERSION & TYPE ARE THEN
*P*               INITIALIZED FROM THE MONITOR INFO RECORD FROM
*P*               TAPE. XDELTA IS THEN READ FROM TAPE. THE
*P*               SENSE SWITCH INFO IS DISPLAYED (IF DESIRED).
*P*               TBOOT: THEN ENTERS XDELTA FOR THE
*P*               READING & PROCESSING OF MONITOR ROOT & OVERLAY
*P*               & SPECIAL MONITOR PROCESSOR PATCH CARDS. XDELTA
*P*               MAY ALSO ENCOUNTER RECONFIGURATION CONTROL
*P*               COMMANDS, AT WHICH TIME XDELTA RETURNS
*P*               CONTROL TO BOOTSUBR WHICH INTURN ENTERS
*P*               RECONFIG FOR IT TO PROCESS THESE COMMANDS.
*P*               TBOOT: CONTINUES TO INTERFACE WITH XDELTA
*P*               UNTIL ALL OF THE MONITOR OVERLAYS & SPECIAL
*P*               PROCESSORS HAVE BEEN READ FROM TAPE & PATCHED
*P*               IF REQUIRED. TBOOT: THEN WRITES THE MONITOR
*P*               ROOT ON THE SWAPPER ALONG WITH A DISC BOOT.
*P*               BOOTSUBR THEN INITIALIZES THE REAL-TIME CORE
*P*               (IF A REAL-TIME SYSTEM) & THEN EXITS.
*P*
         DEF      BOOTSUBR:         FOR PATCHING
BOOTSUBR: RES
         PAGE
BITS     SET      1
         SYSTEM   UTS
OC       EQU      2
CR       EQU      4
LP       EQU      6
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
R8       EQU      8
R9       EQU      9
R10      EQU      10
R11      EQU      11
R12      EQU      12
R13      EQU      13
R14      EQU      14
R15      EQU      15
SYSTRT   EQU      X'26'
BOOTFLG  EQU      MONORG
BOOTFLG: EQU      MONORG
DAJ      EQU      6
PACHSTRT EQU      1
HEAD     EQU      JITLOC
BUFFER   EQU      JITLOC+512
RBUFSIZE EQU      3                 NUMBER OF PAGES IN RECOVERY BUFFER.
         PAGE
*,*                           CONTROL SECTION CONTAINING THAT
*,*                           PORTION OF BOOTSUBR WHICH IS NEEDED
*,*                           FOR TAPE OR DISC BOOT.
         DEF      TBOOT:            DEFINES THAT PORTION OF
*,*                           BOOTSUBR WHICH IS USED ONLY FOR
*,*                           TAPE BOOT.
         DEF      BOOTHLT           BOOTSTRAP HALTED ENTRY POINT
         DEF      MONINIT           TAPE/DISC BOOT ENTRY 2 BOOTSUBR
         DEF      ROOTSA            MONITOR ROOTS D.A.
         DEF      BOOTENT           DISC BOOT ENTRY WHEN NOT
*,*                                 OPERATOR RECOVERY
         DEF      SYSTRT            SYSTEM RESET STARTING ADDRESS
         DEF      BOOTFLG:          FOR XDELTA PATCHING SYMBOL.
         DEF      BOOTFLG           CONTAINS BOOT TIME FLAGS
*,*                           BYTE-0 CONTAINS FLAGS IDENTIFYING
*,*                           THE TYPE OF TAPE BOOT:
*,*                                 80 = I (TTY I/O)
*,*                                 40 = P (LP OUTPUT)
*,*                                 20 = C (CARD PATCHES)
*,*                                 10 = T (TAPE PATCHES)
*,*                                 08 = F (TAPE FILES)
*,*                                 04 = D (XDELTA RETAINED)
*,*                                 02 = S (:SYS FILES)
         DEF      DAJ               JITS DISC ADDRESS (D.A.)
         DEF      ERROREC           ENTRY TO BOOT TIME I/O ROUTINES
         DEF      OCNDDFLG          FLAG TO RECONFIG TELLING IT
*,*                                 THAT THE OC DEVICE ADDRESS
*,*                                 WAS CHANGED AT BOOT TIME DUE
*,*                                 TO OC'S DEV.ADDR.IS NOT
*,*                                 THE SAME AS THAT FOR WHICH THE
*,*                                 SYSTEM WAS SYSGENED.
*,*                                 = 0, NO OC DEV.ADDR.CHANGE
*,*                                 > 0, OC DEV.ADDR.CHANGED & THE
*,*                                      VALUE IS THE OC DCT INDEX
         DEF      CL2PA             ROUTINE ENTRY TO CONVERT A
*,*                                 SYSGENED DEV.ADDR.CHANNEL
*,*                                 LETTER TO BINARY VALUE
*,*                                 ACCORDING TO MACHINE TYPE
         DEF      X560CUCL          TABLE CONTAINING XEROX 560
*,*                                 CONVERSION VALUES FOR A
*,*                                 DEV.ADDR.CHANNEL LETTER
         DEF      :ENDFND           FLAG TO RECONFIG
*,*                                 = 0, NO ':END' COMMAND WAS FOUND
*,*                                 > 0, ':END' COMMAND WAS FOUND
         DEF      RECNFG            ENTRY INTO BOOTSUBR FROM XDELTA
*,*                                 WHEN XDELTA READS A ':'
*,*                                 COMMAND
         DEF      RECNFGOC          ENTRY INTO BOOTSUBR FROM
*,*                                 RECONFIG FOR PURPOSES OF
*,*                                 DISPLAYING MESSAGES ON OC DEV.
         DEF      RECNFGLL          ENTRY INTO BOOTSUBR FROM
*,*                                 RECONFIG FOR PURPOSES OF
*,*                                 DISPLAYING MESSAGES ON
*,*                                 LL DEVICE
         DEF      CANTRUN           ENTRY INTO BOOTSUBR FROM
*,*                                 RECONFIG WHEN IT IS
*,*                                 DETERMINED THAT THE
*,*                                 TARGET MACHINE DOES NOT
*,*                                 CORRESPOND WITH THE
*,*                                 MACHINE FOR WHICH THE
*,*                                 SYSTEM WAS SYSGENED
         DEF      RBUFSIZE          NUMBER OF PAGES IN RECOVERY BUFFER.
         PAGE
         REF      MONORG            USED TO DEFINE BOOTFLG AT THE CELL
*,*                                 BELOW THE MONITOR.
         REF      DCT1              INPUT OUTPUT HALF WORD
*,*                           DEVICE ADDRESS TABLE
         REF      DCT1P             OUTPUT HALF WORD
*,*                           PRIMARY DEVICE ADDRESS TABLE
         REF      DCT4              INPUT BYTE
*,*                           DEVICE TYPE MNEMONIC CODE INDEX
         REF      DCT8              INPUT WORD
*,*                           LOW SPEED PRINTER HANDLER ADDRESS
         REF      DCT16             INPUT OUTPUT DOUBLE WORD
*,*                           'YYNDD' FOR EACH DEVICE
         REF      DCT22             INPUT BYTE
*,*                           DEVICE SUB-TYPE TABLE INDEX (SEEKS)
         REF      DCTSIZ            INPUT
*,*                           SIZE OF DCT TABLES
         REF      AVRTBL            END F STUFF RECVERY NEEDS
         REF      HGP               CHECK/SET NSPT FOR MINI
         REF      DISCLIMS          CHECK WRITE PROTECT SWITCHES
         SREF     UB:C#             SET CYL#S FOR GHOSTS
         REF      YC                DEFAULT FOR BOOTFLG
         REF      :DP               PACK SWAPPING FLAG
         REF      C%CPU             OUTPUT BYTE
*,*                           TARGET MACHINE TYPE IN BYTE-0
*,*                           80=SIGMA 6/7, 40=SIGMA 9, 20=560
         REF      OCNDD             INPUT OUTPUT WORD
*,*                           BOOT TIME OC DEV.ADDR.
         REF      CNDD              INPUT OUTPUT WORD
*,*                           BOOT TIME CR DEV.ADDR.
         REF      LLNDD             INPUT OUTPUT WORD
*,*                           BOOT TIME LP DEV.ADDR.
         REF      M:SWAPD           INPUT OUTPUT WORD
*,*                           CONTAINS SWAPPER(S) DEV.ADDR.(S)
         REF      MB:SDI            INPUT BYTE
*,*                           INDEX INTO DCTS FOR SWAPPER(S) ADDR.(S)
         REF      SYSVERS           OUTPUT WORD
*,*                           CONTAINS SYSTEM TYPE & VERSION
         REF      DEVMOD#           INPUT HALF WORD
*,*                           SYSTEMS DEVICE MODEL #'S
         REF      JITLOC            INPUT
*,*                           BASIC JIT WITHIN MONITOR
         REF      J:JIT             OUTPUT
*,*                           USED IN BUILDING ACTUAL JIT
         REF      JX:CMAP           OUTPUT BYTE OR HALF WORD
*,*                           JITS PHYSICAL PAGE # TABLE
         REF      JH:DA             INPUT HALF WORD
*,*                           SWAPPER SEEK ADDRESSES
         REF      J:CL              INPUT
*,*                           START OF SWAPPER CMND.LIST (NO AJIT)
         REF      JCCL              INPUT
*,*                           MAX.JIT CMND.LIST LENGTH
         REF      JXBUFVP           INPUT
*,*                           VIRT.PAGE # OF START OF JIT MAP IMAGE
         REF      JOVVP             INPUT
*,*                           VIRT.PAGE # START OF MAP LOADED 4 USER
         REF      JJITVP            INPUT
*,*                           VIRT.PAGE # OF JIT
         REF      OB:BOPTX          INPUT BYTE
*,*                           INDEX INTO DCT OR LDEV WHEN BATCH
         REF      FPMC              INPUT
*,*                           FREE PAGE MAP CONSTANT IN JIT
         REF      P:SA              OUTPUT WORD
*,*                           OVERLAY OR PROCESSOR START ADDRESS
         REF      P:TCB             OUTPUT WORD
*,*                           OVERLAY OR PROCESSOR TCB ADDRESS
         REF      PB:HVA            INPUT OUTPUT BYTE
*,*                           VIRT.PAGE # OF 1ST UNUSED PAGE
         REF      PB:PVA            INPUT OUTPUT BYTE
*,*                           VIRT.PAGE # OF 1ST PROC.PAGE
         REF      PB:DCBSZ          INPUT OUTPUT BYTE
*,*                           # OF PAGES OF DCBS
         REF      PB:DSZ            INPUT OUTPUT BYTE
*,*                           # OF PAGES OF DATA
         REF      PB:PSZ            INPUT OUTPUT BYTE
*,*                           # OF PAGES OF PURE PROCEDURE
         REF      PH:DDA            OUTPUT HALF WORD
*,*                           D.A.OF 1ST PAGE OF DATA & DCBS
         REF      PH:PDA            OUTPUT HALF WORD
*,*                           D.A.OF 1ST PAGE OF PROCEDURE
         REF      MAXOVLY           INPUT
*,*                           # MONITOR OVERLAYS +1
         REF      S:MAPCW           OUTPUT WORD BYTE
*,*                           SWAPPERS MAP CONTROL WORD
         REF      S:ACCW            OUTPUT WORD BYTE
*,*                           SWAPPERS ACCESS CONTROL WORD
         REF      RCVRAD            OUTPUT WORD
*,*                           D.A.FOR RECOVERY BUFFER ON SWAPPER,
*,*                           ALSO 1ST SECTOR AVAILABLE FOR PROCESSORS
         REF      RCVSIZE           OUTPUT WORD
*,*                           SIZE IN SECTORS OF SHARED PROC.AREA
         REF      RCVSTART          OUTPUT WORD
*,*                           RECOVERY START ADDRESS
         REF      RCVDISC           OUTPUT WORD
*,*                           RECOVERYS DISC ADDRESS
         REF      :BIG              INPUT
*,*                           BIG MAP MODE
         REF      PSA%END           INPUT
*,*                           # SECTORS OF PSA
         REF      NSPT              INPUT WORD
*,*                           D.A.CONVERSION, # SECT./TRACK
         REF      NSPC              INPUT WORD
*,*                           D.A.CONVERSION, # SECT./CYLINDER
         REF      NTPC              # TRACKS PER CYL..SET ON MINI
         REF      NCYL              INPUT WORD
*,*                           > 0, CYLINDER ALLOCATED DEVICE
         REF      CYL%SHFT          INPUT WORD
*,*                           SHIFT VALUE FOR CYLINDER # IN D.A.
         REF      TRK%SHFT          INPUT WORD
*,*                           SHIFT VALUE FOR TRACK # IN D.A.
         REF      SEC%SHFT          INPUT WORD
*,*                           SHIFT VALUE FOR SECTOR # IN D.A.
         REF      LSWAP             INPUT
*,*                           # SWAPPERS -1
         REF      C:TINC            INPUT OUTPUT WORD
*,*                           SYSTEMS TIMER INCREMENT
         REF      C:MSM             TICS SINCE MIDNIGHT FOR ERRLOG (OUTPUT)
         REF      SEEK4000          OUTPUT WORD
*,*                           SEEK ADDR.OF LOC.4000 IN MONITOR TO
*,*                           DUMP MONITOR AT LOC.4000 WHEN CRASH.
*,*                           DUMP ON SWAPPER & S.U.A.FILES DUMP.
         REF      DATE              INPUT OUTPUT WORD
*,*                           CONTAINS DATE & TIME
         REF      TOPROOT           INPUT
*,*                           END OF MONITOR ROOT CHECKSUMMING
         REF      MONCHK            OUTPUT WORD
*,*                           MONITOR ROOTS CHECKSUM
         REF      PPSTART           INPUT
*,*                           START OF MONITOR ROOT CHECKSUMMING
         REF      DSCCVT            ROUTINE
*,*                           CONVERT REL.D.A.TO ACTUAL D.A.
         REF      XA                CONSTANT X'0000000A'
         SREF     ICB               TEST FOR REALTIME
         SREF     COC               TEST FOR ONLINE
         SREF     TTP               TEST FOR TP
         SREF     NSCPU             TEST FOR MULTIPROCESSING
         SREF     FECP#             TEST FOR FECP
         SREF     S:FROGF           FECP FLAGS
         REF      DLTBIAS           INPUT OUTPUT WORD
*,*                           CONTAINS BRANCH TO XDELTA'S BIAS
         REF      UMOV#             INPUT OUTPUT WORD
*,*                           CONTAINS LI,5 OVERLAY # FOR UMOV
         REF      SPOOL             OUTPUT WORD
*,*                           CONTAINS ADDR.OF SYMBIONT BUFFER
*,*                           IF ONE IS OBTAINABLE IN MONITOR ROOT
         REF      S:DP              INPUT WORD
*,*                           = 0, RAD SWAPPING
*,*                           > 0, DISC PACK SWAPPING
         REF      LOW               INPUT OUTPUT WORD
*,*                           PAGE # OF LOWEST PAGE USER CAN HAVE
         REF      HIGH              INPUT OUTPUT WORD
*,*                           PAGE # OF HIGHEST PAGE IN CORE
         REF      CORE              INPUT
*,*                           CORE SIZE SYSGENED FOR
         REF      CORED             OUTPUT WORD
*,*                           ACTUAL CORE SIZE IN WORDS
         REF      M:FPPH            INPUT OUTPUT WORD
*,*                           MONITORS FREE PAGE POOL HEAD
         REF      M:FPPT            OUTPUT WORD
*,*                           MONITORS FREE PAGE POOL TAIL
         REF      M:FPPC            OUTPUT WORD
*,*                           MONITORS FREE PAGE POOL COUNT
         REF      MX:PPUT           INPUT OUTPUT BYTE OR HALF WORD
*,*                           MODIFY TABLE OF CORE PAGE #'S FOR
*,*                           THOSE PAGES USED ONLY BY MONITOR,
*,*                           E.G., XDELTA, UMOV, & REAL-TIME.
*,*                           THESE PAGES ARE LINKED TOGETHER.
         REF      MP:UPPH           OUTPUT WORD
*,*                           USED UNMAPPED MONITOR OVERLAY
*,*                           FREE PAGE POOL HEAD
         REF      MP:UPPT           OUTPUT WORD
*,*                           USED UNMAPPED MONITOR OVERLAY
*,*                           FREE PAGE POOL TAIL
         REF      MP:UPPC           OUTPUT WORD
*,*                           USED UNMAPPED MONITOR OVERLAY
*,*                           FREE PAGE POOL COUNT
         REF      SL:CORE           INPUT OUTPUT WORD
*,*                           MAX.SWAPPER SIZE
         REF      S:ACORE           OUTPUT WORD
*,*                           # PAGES AVAILABLE TO SYSTEM
         REF      S:PCORE           OUTPUT WORD
*,*                           # CORE PAGES AVAILABLE TO USER
         REF      RTICBHDR          INPUT WORD
*,*                           < 0, NON-REAL-TIME SYSTEM
*,*                           =>0, REAL-TIME SYSTEM
         REF      BOOTIC            OUTPUT WORD
*,*                           DISC BOOTS CHANNEL PROGRAM
*,*                           TO READ MONITOR ROOT INTO CORE
         REF      LEE20             OUTPUT WORD
*,*                           HOOK TO XDELTA
         REF      PRTOUTL           ROUTINE
*,*                           LOW SPEED PRINTER ROUTINES ADDRESS
         REF      XFFFF00           CONSTANT X'00FFFF00'
         SREF     S:UCYL            INPUT WORD
*,*                           PACK SWAPPER # CYLINDERS PER USER
         SREF     S:CYLSZ           INPUT WORD
*,*                           PACK SWAPPER CYLINDER SIZE
         SREF     RBSS              IF >0, REMOTE BATCH SYSTEM
         SREF     RESDF             INPUT OUTPUT WORD
*,*                           # PAGES IN RESIDENT FOREGROUND CURRENT
         SREF     CRESDF            OUTPUT WORD
*,*                           DEFAULT # PAGES IN RESIDENT FOREGROUND
         SREF     RESDFP            INPUT OUTPUT WORD
*,*                           RESIDENT FOREGROUNDS 1ST PAGE
         SREF     PPTABDSK2         OUTPUT WORD
*,*                           D.A.FOR RECOVERY TO PUT PPTABLE
         SREF     DYNRESDF          INPUT WORD
*,*                           DYNAMIC REAL-TIME CURRENT # PAGES
         SREF     MDYNRESDF         INPUT WORD
*,*                           MAX.DYNAMIC REAL-TIME CURRENT PAGES
         SREF     PB:C#             OUTPUT BYTE
*,*                           CYLINDER # OF PROCEDURE
*,*                           FOR DISC PACK SWAPPER ONLY
         SREF     PB:DC#            OUTPUT BYTE
*,*                           CYLINDER # OF DATA FOR DISC PACK
*,*                           SWAPPER ONLY
         SREF     PPTABLE           INPUT OUTPUT WORD
*,*                           DEFINES FOREGROUND MEMORY SEGMENTS
         SREF     PPTABLSZ          OUTPUT WORD
*,*                           SIZE OF PPTABLE IN BYTES
         SREF     PP:UPPH           OUTPUT WORD
*,*                           REAL-TIME FREE PAGE HEAD
         SREF     PP:UPPT           OUTPUT WORD
*,*                           REAL-TIME FREE PAGE TAIL
         SREF     PP:UPPC           OUTPUT WORD
*,*                           REAL-TIME FREE PAGE COUNT
         REF      MPPSEEK           OUTPUT WORD
*,*                           RECOVERYS OVERLAY DISC ADDRESS
         REF      TIME              INPUT WORD
*,*                           'HHMM' TIME OF DAY
*  EXTERNAL REFERENCES    FOR ENTRY POINTS INTO RECNFIG
         REF      RECNFG:0          ROUTINE
*,*                           ENTER RECONFIG TO INITIALIZE DCTS
         REF      RECNFG:1          ROUTINE
*,*                           ENTER RECONFIG TO PROCESS ':' COMMAND
         REF      RECNFG:2          ROUTINE
*,*                           ENTER RECONFIG TO COMPLETE
*,*                           RECONFIGURATION WHEN NO ':END'
*,*                           COMMAND WAS FOUND
*        REFS FOR HARDWARE ADDRESS DETERMINATION
*
         REF      MP:HPN            GET CPU HARDWARE ADDRESS
         REF      S:ADR             OUTPUT WORD
*,*                                 CPU HARDWARE ADDRESS TABLE
         PAGE
*F*
*F*      NAME:    MONINIT
*F*      PURPOSE: INITIALIZE THE CP-V SYSTEM WITH OPERATOR
*F*               INFO, & OTHER INFO DETERMINED BY TARGET
*F*               MACHINE TYPE. ALSO CONTROLS THE BOOT-TIME
*F*               PROCEDURES, E.G., PATCHING CP-V MONITOR,
*F*               & RECONFIGURATION.
*F*      DESCRIPTION:
*F*               MONINIT CAN BE ENTERED IN ONE OF
*F*               SEVERAL WAYS: COLD TAPE BOOT, BOOT TAPE UNDER
*F*               FILES, DISC BOOT, RECOVERY, OR OPERATOR RECOVERY.
*F*               MONINIT  DETERMINES TARGET MACHINE TYPE, OC
*F*               ADDRESS, CORE SIZE, BOOT TYPE CODES (IF TAPE BOOT),
*F*               REAL-TIME INFO (IF REAL-TIME SYSTEM), DATE, TIME,
*F*               & THEN ENTER THE TAPE BOOT PORTION OF MONINIT
*F*               IF TAPE BOOT. IF NOT TAPE BOOT, THEN XDELTA IS
*F*               OBTAINED ALONG WITH THE MONITORS EXTENSION & THE
*F*               CORE VALUES ARE DETERMINED. XDELTA IS NOT
*F*               RETAINED UNLESS SO DESIRED. IF THE SYSTEM IS FOR
*F*               NON-REAL-TIME, MONINIT  EXITS. HOWEVER, IF IT IS
*F*               REAL-TIME, THEN REAL-TIME CORE IS ALLOCATED.
*F*               WHEN THE BOOT IS FROM TAPE, THEN THE ROUTINE
*F*               TBOOT: IS ENTERED. RECONFIG IS ENTERED TO
*F*               INITIALIZE THE DEVICE ADDRESS TABLES & TO
*F*               DETERMINE IF THE TARGET MACHINE IS THE SAME
*F*               AS THE SYSTEM BEING BOOTED. TBOOT: THEN
*F*               REQUESTS DEVICE ADDRESS CHANGES FOR THE
*F*               C,LL,DC (CARD READER, LINE PRINTER, SWAPPER(S)
*F*               RESPECTIVELY) IF CHANGES ARE NECESSARY. THE
*F*               SWAPPER(S) IS(ARE) THEN CHECKED TO DETERMINE
*F*               IF THE TARGET MACHINES SWAPPER(S) IS(ARE) THE
*F*               SAME AS THAT FOR WHICH THE SYSTEM WAS SYSGENED.
*F*               TBOOT: THEN INITIALIZES THE JIT & WRITES IT TO
*F*               THE SWAPPER. THE SYSTEMS VERSION & TYPE ARE THEN
*F*               INITIALIZED FROM THE MONITOR INFO RECORD FROM
*F*               TAPE. XDELTA IS THEN READ FROM TAPE. THE
*F*               SENSE SWITCH INFO IS DISPLAYED (IF DESIRED).
*F*               TBOOT: THEN ENTERS XDELTA FOR THE
*F*               READING & PROCESSING OF MONITOR ROOT & OVERLAY
*F*               & SPECIAL MONITOR PROCESSOR PATCH CARDS. XDELTA
*F*               MAY ALSO ENCOUNTER RECONFIGURATION CONTROL
*F*               COMMANDS, AT WHICH TIME XDELTA RETURNS
*F*               CONTROL TO TBOOT:   WHICH INTURN ENTERS
*F*               RECONFIG FOR IT TO PROCESS THESE COMMANDS.
*F*               TBOOT: CONTINUES TO INTERFACE WITH XDELTA
*F*               UNTIL ALL OF THE MONITOR OVERLAYS & SPECIAL
*F*               PROCESSORS HAVE BEEN READ FROM TAPE & PATCHED
*F*               IF REQUIRED. TBOOT: THEN WRITES THE MONITOR
*F*               ROOT ON THE SWAPPER ALONG WITH A DISC BOOT.
*F*               TBOOT:   THEN INITIALIZES THE REAL-TIME CORE
*F*               (IF A REAL-TIME SYSTEM) & THEN EXITS.
*F*
         PAGE
*D*
*D*      NAME:    MONINIT
*D*      ENTRY:   RTMSG
*D*      ENTRY:   GMONEX
*D*      ENTRY:   SWAPREAD
*D*      DESCRIPTION:  RTMSG - DISPLAY REAL-TIME MESSAGE.
*D*               GMONEX - AFTER TBOOT: DONE, ENTER HERE
*D*               SWAPREAD - READ DELTA & PPTABLE FROM SWAPPER.
*D*
*D*               MONINIT CAN BE ENTERED IN ONE OF
*D*               SEVERAL WAYS: COLD TAPE BOOT, BOOT TAPE UNDER
*D*               FILES, DISC BOOT, RECOVERY, OR OPERATOR RECOVERY.
*D*               MONINIT  DETERMINES TARGET MACHINE TYPE, OC
*D*               ADDRESS, CORE SIZE, BOOT TYPE CODES (IF TAPE BOOT),
*D*               REAL-TIME INFO (IF REAL-TIME SYSTEM), DATE, TIME,
*D*               & THEN ENTER THE TAPE BOOT PORTION OF MONINIT
*D*               IF TAPE BOOT. IF NOT TAPE BOOT, THEN XDELTA IS
*D*               OBTAINED ALONG WITH THE MONITORS EXTENSION & THE
*D*               CORE VALUES ARE DETERMINED. XDELTA IS NOT
*D*               RETAINED UNLESS SO DESIRED. IF THE SYSTEM IS FOR
*D*               NON-REAL-TIME, MONINIT  EXITS. HOWEVER, IF IT IS
*D*               REAL-TIME, THEN REAL-TIME CORE IS ALLOCATED.
*D*               WHEN THE BOOT IS FROM TAPE, THEN THE ROUTINE
*D*               TBOOT: IS ENTERED.
*D*
*D*   MONINIT --
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   LOC.2A = TYPE OF ENTRY INTO MONINIT
*D*                  = 00000000 CRASH RECOVERY
*D*                  = 221000XX COLD TAPE BOOT
*D*                  = 6C000000 RAD/DISK BOOT
*D*                  = 00010000 OPERATOR RECOVERY
*D*
*D*      INTERFACE:  CL2PA,MESSG,CVTEBC,MESSGNW,
*D*               CVTHEX,EOM,TBOOT:,PUTRT,NSIG7TRP
*D*      REGISTERS:  ALL USED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
*D*   SWAPREAD --
*D*      CALL:    R4 = LINK
*D*
*D*      INPUT:   R0 = DA(COMMAND LIST)
*D*
*D*      REGISTERS:  R2-R3 USED, R4 SAVED
*D*
         SPACE    3
MONINIT  EQU      %
         STW,11   MONIRTN
         LI,1     60000
         BDR,1    %                 APP.60 MIL.SEC.DELAY FOR 560
         LI,1     X'80'             ASSUME SIGMA 7
         LW,3     NSIG7XPSD
         XW,3     X'4D'             SET UP TRAP
         AD,11    4                 WILL TRAP IF ON SIG9 OR X560
         STW,3    X'4D'             RESTORE TRAP
         STB,1    C%CPU             SET UP BIT FOR BIF PROC
         LI,1     OC                OC OP LABEL INDEX
         LB,1     OB:BOPTX,1        DCTX OF OC
********
*DO*
*D*      NAME:    MONINIT
*        DESCRIPTION:
*  IF TTY ADDR. NOT = DCT1 VALUE, WAIT FOR OPERATOR TO PUT NEW TTY
*    ADDR. INTO REGISTER 0 & THEN PROCEED.  NEW ADDR. WILL BE PUT
*    INTO APPROPRIATE DCT TABLES.
*FIN*
********
         LH,R0    DCT1,R1           GET SYSGENED OC ADDR.
         INT,R15  X'2A'
         AI,R15   -4
         BLZ      CHKOCAD     NO--- TAPE BOOT
         LI,R2    2           YES--
         LB,R8    R0,R2             GET 'N' FROM DEV.ADDR.
         BAL,R15  CL2PA       ****  CONVERT 'N' TO HEX
         BCS,1    %           %%%%%%BAD SYSGENED VALUE FOR TTY
         STB,R8   R0,R2             REPLACE 'N' WITH HEX VALUE
CHKOCAD  EQU      %
         STW,R0   OCNDD             SET OC ADDR.
         LCI      0                 RESET CC'S
         HIO,0    *R0         IIOO  SEE IF TTY(OC) ADDR.OK
         BCR,14   OCADDROK    YES-- OC ADDR.OK
WAITOC   EQU      %           NO---
         WD,0     X'41'             TURN ON ALARM
         LW,R15   C:TINC
         WAIT     0                 WAIT FOR OPERATOR TO ENTER OC ADDR.
         CW,R15   C:TINC
         BNE      WAITOC
         WD,0     X'40'             TURN OFF ALARM
         STW,R1   OCNDDFLG          SET FLAG SO RECNFIG WILL SET DCT16
         BIF,X560 XRX560            IS THIS XEROX 560
         CI,R0    X'7FF'      NO--- SIGMA
         B        %+2
*----------------
XRX560   EQU      %
         CI,R0    X560CUCLL**8+255
         BG       WAITOC      NO--- VALID CLUSTER/UNIT
         B        CHKOCAD     YES--
*----------------
OCADDROK EQU      %
         LW,1     YC                SET DEFAULT FOR DISC BOOTS
         STW,1    BOOTFLG           (I,P)
         LW,11    CORXPSD           LETS FIND
         XW,11    X'40'             OUT HOW MUCH
         LW,2     CORE:SZ           CORE WE REALLY HAVE
CORC     AI,2     -X'1000'
         MTW,0    0,2
         STW,2    CORED             SAVE ACTUAL SIZE
         MTW,1    CORED
         STW,11   X'40'
         SLS,2    -9
         STW,2    M:FPPT
         STW,2    HIGH
         LI,R8    0
         BAL,R11  MP:HPN            GET HARDWARE ADDRESS
*                                   RETURNED IN R8
         STW,R8   S:ADR             STORE IN MASTER'S ENTRY
         INT,11   X'2A'             IS THIS ONE
         BCR,15   REQDELT           NO RT OR DATE/TIME MSG IF RECOVERY
         LW,0     MPBR              SET UP BRANCH FOR SYSTRT
         STW,0    SYSTRT
         AI,11    -4                MAKE NEGATIVE FOR NEXT CHECK
         BLZ      RT                YES, SKIP CONTROL QUERY
         LI,0     DA(1STMES)
         BAL,10   MESSG
         LI,5     X'10'             DEFAULT FOR NO RESPONSE (T)
         LI,2     -12               MAX INPUT
         AI,3     0                 IF NO INPUT, USE DEFAULT
         BEZ      CODFLT
         LI,5     0                 CLEAR ACCUMULATOR
CODLOOP  LB,4     BUF+3,2           GET NEXT INPUT CHAR
         BEZ      CODFLT            NO MORE
         LB,3     CODES             SEARCH TABLE
         CB,4     CODES,3
         BNE      %+2
         OR,5     BT31TO0+1,3       GOT ONE
         BDR,3    %-3
         BIR,2    CODLOOP           TO NXT CHAR INPUT
CODFLT   STB,5    BOOTFLG           STICK IT IN
         STW,4    BUF               ZAP BUF IN CASE NO 'I'
         CI,5     8                 IS THIS BOOT-UNDER-FILES
         BANZ     FILESMES          NO, OUTPUT WARNING
         LI,1     -1
         STW,1    X'2A'             YES, SET FLAG
RT       LW,0     RTICBHDR          IS  THIS A REAL-TIME SYSTEM?
         BLZ      NORT              NO
* # OF PAGES TO MESSAGE
         LW,1     RESDF             # OF PAGES
         CI,1     999               IS SYSGEN PARAM OK
         BLE      %+3               YES
         LI,1     999               NO-FIX IT UP
         STW,1    RESDF
         LI,2     11                INDEX INTO MESSAGE
RT2      LI,0     0
         DW,0     XA
         AI,0     X'F0'
         STB,0    RESTRD,2
         AI,2     -1
         CI,2     8                 MAXIMUM OF 3 CHARACTERS
         BNE      RT2
* FIRST RESDF PAGE TO MESSAGE
         LW,1     RESDFP            1ST RESDF PAGE
         SLS,1    12                LEFT JUSTIFIED
         LI,2     13                INDEX INTO MESSAGE
         LI,3     5                 # OF CHARACTERS
         BAL,4    CVTEBC            CONVERT AND STORE IN MESSAGE
         LC       BOOTFLG           IF NO OC-NO MESSG
         BCR,8    RTMSG+2
* GET INPUT FROM OPERATOR
RTMSG    LI,0     DA(RESDFCP)
         BAL,10   MESSGNW           OUTPUT MESSAGE
         LW,7     RESDF             # OF PAGES
         LW,8     RESDFP            1ST PAGE
         LI,4     0                 INDEX INTO BUF
* CONVERT # OF PAGES TO HEX
         BAL,1    CVTHEX            VALIDATE CHARS AND BUMP INDEX
RTMSG2   CI,6     0                 ANY INPUT
         BE       RTMSG4            NO
         LW,7     5                 SET NEW # OF PAGES
         CI,7     999               VALID # OF PAGES
         BG       RTMSG             NO
RTMSG4   BAL,1    CVTHEX            GET PAGE ADDR IF ANY
         CI,6     0                 ANY INPUT
         BE       %+2               NO
         LW,8     2                 GET NEW PAGE ADDRESS
         CI,8     X'10000'          > OR = 64K
         BL       RTMSG             NO-BAD ADDRESS
         LW,10    8                 SAVE WORD ADDRESS
         SLS,8    -9                GET # OF 1ST PAGE
         LW,9     7                 # OF PAGES TO R9
         AW,7     8                 # OF PAGES + 1ST PAGE
         AI,7     -1                 -1 = LAST PAGE
         CW,7     HIGH              DO THE PAGES EXIST
         BG       RTMSG             NO
         STW,10   RESDFP            RESET VALUES
         STW,9    RESDF
         LW,9     9
         BEZ      NORT              IF 0 NO PPTABLE ENTRY
         STW,9    CRESDF
         SLS,9    16                # OF PAGES TO BITS 0-15
         SLD,8    16                BUILD PPTABLE ENTRY
         STW,8    PPTABLE
*        B        NORT
         PAGE
*
NORT     EQU      %
DATETIME EQU      %
         LI,0     DA(GDATE)
         BAL,10   MESSG             GET DATE
         LI,8     '/'
         STB,8    BUF,3             MM/DD/YY/
         LI,7     5
         LI,3     -8
         LI,1     -1
GETDIG   LB,0     BUF+2,3
         CW,0     8
         BE       GOTIT
         CI,0     '0'
         BL       EOM
         STB,0    1
         SCS,1    8
         BIR,3    GETDIG
         CB,8     BUF+2,3
         BE       GOTIT
NXTFLD   BIR,3    GETDIG-1
         B        EOM               NOT ENOUGH FIELDS
GOTIT    CI,1     -1
         BE       EOM
         CI,1     -16
         BL       %+2
         AI,1     -X'F00'           ONE DIGIT FIELD
         CH,1     MAXD,7
         BG       EOM
         CH,1     MIND,7
         BL       EOM
         LB,2     STORE,7
         STH,1    DATE,2
         LB,7     NEXTI,7
         BNEZ     NXTFLD
         CI,8     '/'
         BNE      REQDELT           RETURN AFTER TIME
         LW,2     DATE
         LI,6     6
         CW,2     BADATES,6         CHECK LEGALITY
         BE       EOM
         BDR,6    %-2
         CW,2     BADATES           FEB 29
         BNE      GETIME
         LI,2     X'103'
         AND,2    1
         BEZ      GETIME            20I + 4J LEAP YEAR
         CI,2     X'102'
         BNE      EOM               NOT 20I+4J+12 LEAP YEAR
GETIME   ;
         LI,0     DA(GTIME)
         BAL,10   MESSG
         LI,8     ':'
         STB,8    BUF,3             HH:MM:
         LI,7     2
         B        GETDIG-2
         PAGE
REQDELT  RES
         LI,0     0
         STW,0    C:TINC            ZAP CLOCK SO TIME IS CORRECT
         LI,3     0                 CALCULATE C:MSM AND SET IT
         LI,2     -4
         LB,0     TIME+1,2
         AI,0     -'0'
         AW,3     0
         MH,3     MSMKS+2,2
         BIR,2    %-4
         STW,3    C:MSM
         LI,0     FECP#             IF FECPS, ASK ABOUT FROG
         BEZ      NOFECP
         LC       BOOTFLG           IF NO OC USE DEFAULT
         BCR,8    %+3
         LI,0     DA(RFECP)
         BAL,10   MESSGNW
         LI,3     1
         STS,3    S:FROGF           SET NO RESPONSE DEFAULT
         LB,2     BUF
         CI,2     'Y'               UNLESS Y
         BNE      %+2
         STS,2    S:FROGF
NOFECP   RES
         BDR,11   TBOOT:            NO DELTA MSG ON TAPE BOOT
         LI,0     DA(RDLT)
         BAL,10   MESSGNW
         LB,1     BUF
         CI,1     'Y'
         BNE      %+3
         LI,1     X'C4'             SET D FLAG
         STB,1    BOOTFLG
GMONEX   LI,0     DA(DLTCLST)       NOW READ IN DELTA AND THE MONITOR EXTENSION
         LI,4     FIXPPUT
         PAGE
SWAPREAD :SIO,0   *M:SWAPD
         WAIT
         :TIO,2   *M:SWAPD
         WAIT
         BCS,12   :A
         CW,3     ERRMSK
         BANZ     SWAPREAD          TRY AGAIN IF ERRORS
         B        0,4
         PAGE
FIXPPUT  LI,1     TOPROOT+255       GET THE FREE SYMBIONT
         CI,1     256               BUFFER
         BAZ      %+3               IF THERE IS ONE
         AND,1    XFFFF00
         STW,1    SPOOL
         AI,1     256
         SLS,1    -9
         STW,1    M:FPPH
         STW,1    LOW
         LW,2     HIGH
         LI,0     0
         STORE,0  MX:PPUT,2
         SW,2     LOW
         AI,2     1
         STW,2    SL:CORE
         LI,3     JJITVP-1          TAKE OUT MON JIT
         INT,5    UMOV#             AND UMOV PAGES
         LB,5     PB:HVA,5
         BNEZ     %+2
         LI,5     JJITVP+1          NO UMOV CASE
         STORE,5  MX:PPUT,3
         AI,5     -JJITVP
         SW,2     5
         STW,5    MP:UPPC           SET COUNT
         AI,5     JJITVP-1
         STORE,0  MX:PPUT,5         ZAP TAIL
         STW,5    MP:UPPT
         LI,3     JJITVP
         STW,3    MP:UPPH
         LW,1     Y04               REMOVE DELTA'S PAGES IF KEPT
         AND,1    BOOTFLG
         BEZ      NODELTA
         INT,3    DLTBIAS
         SLS,3    -9
         STORE,3  MX:PPUT,5         HOOK TO OLD TAIL
         AI,3     -1
         INT,1    DLTSZ
         AI,1     X'7FF'
         SLS,1    -11
         AWM,1    MP:UPPC           **
         LOAD,4   MX:PPUT,3         REMOVE DELTAS PAGES
         AW,4     1
         AI,4     -1
         STW,4    MP:UPPT           **
         LOAD,11  MX:PPUT,4         PICK UP OLD FWD LINK
         BNEZ     %+2               IS IT IN XDELTA
         STW,3    M:FPPT            YES- CUT CHAIN BEFORE XDELTA
         STORE,11 MX:PPUT,3         BECOMES NEW FWD LNK
         STORE,0  MX:PPUT,4
         SW,2     1                 REMOVE DELTA'S PAGES FROM COUNT
         MTW,-1   LEE20+2
NODELTA  RES
         MTW,1    LEE20+2
         LI,11    X'B8'             MAX USER SWAP SIZE
         LW,3     S:DP
         BEZ      NOF
*        MAKE MAX USER SIZE EQUAL TO S:CYLSZ IF S:UCYL=1.
*        IF S:UCYL=2, MAX USER SIZE = ((S:CYLSZ-2)/4)*4+2
*
         LI,11    2                 2 GRANS FOR JIT+AJIT
         LW,0     S:UCYL
         LW,3     S:CYLSZ
         AI,3     -2
PP0      SLS,3    -2
         SLS,3    2
         AW,11    3
         LW,3     S:CYLSZ
         BDR,0    PP0
         CI,11    X'B8'
         BLE      %+2
         LI,11    X'B8'
NOF      EQU      %
         CW,11    SL:CORE           MAX FOR AJIT
         BGE      %+2
         STW,11   SL:CORE
         STW,2    M:FPPC
         STW,2    S:ACORE
         AI,2     -7                AJIT + 6 PGS FOR OVERLAY
         STW,2    S:PCORE           SAVE PPUT SIZE
*        B        PUTRT
         PAGE
*D*
*D*      NAME:    PUTRT
*D*      DESCRIPTION:  IF NOT A REAL-TIME SYSTEM,
*D*               RETURN TO CALLER, INITIAL.
*D*               FOR REAL-TIME SYSTEM, OBTAIN PPTABLE FROM
*D*               SWAPPER WHEN RECOVERY AND IN ANY CASE
*D*               USE INFO FROM PPTABLE TO BUILD VARIOUS
*D*               CORE PAGE CHAIN HEAD & TAIL POINTERS.
*D*               WHEN COMPLETED, PUTRT RETURNS TO CALLER,
*D*               INITIAL.
*D*
*D*      INTERFACE:  SWAPREAD
*D*      REGISTERS:  ALL USED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
PUTRT    LW,0     RTICBHDR          IS THIS REALITME SYSTEM
         BLZ      *MONIRTN          NO
         LC       X'2A'             IS THIS RECOVERY
         BCS,15   PUTRT2-1          NO
*
* READ PPTABLE
*
PUTRT1   LI,0     DA(RDPPTAB)
         BAL,4    SWAPREAD
         LI,5     PPTABLSZ
PUTRT2   LW,1     PPTABLE-1,5       GET ENTRY
         BEZ      PUTRT7            UNUSED
         LI,0     0
         SLD,0    16                R0=1ST PAGE
         SLS,1    -16               R1=# OF PAGES
         LW,8     1                 # PAGES
         AW,1     0
         AI,1     -1                LAST PAGE
*
* GET THE PAGES OUT OF M:FPP CHAIN
*
         LW,3     M:FPPH
PUTRT3   CI,3     0                 IS THIS THE END OF MX:PPUT
         BE       PUTRT8            YES-ERROR
         LOAD,6   MX:PPUT,3         FOR FORWARD LINK
         CLR,0    3                 IS THIS A RESDF PAGE
         BCR,6    PUTRT4            YES
         LW,4     3                 SAVE BACKWARD LINK
         LW,3     6                 GET NEXT IN CHAIN
         BNEZ     PUTRT3
         B        PUTRT8            BAD ENTRY
*
PUTRT4   CW,3     M:FPPH            IS RESDF PAGE PPUT HEAD
         BNE      PUTRT5            NO
         STW,6    M:FPPH            AND SET NEW PPUT HEAD
         B        PUTRT6
*
PUTRT5   STORE,6  MX:PPUT,4         LINKED TO BACKWARD LINK
         LW,6     6
         BNEZ     PUTRT6            NOT RELEASING TAIL
         STW,4    M:FPPT            BACKWARD LINK IS NOW TAIL
*
PUTRT6   MTW,-1   M:FPPC
* PUT THE PAGES IN PP:UPP CHAIN
*
         LI,2     0
         STORE,2  MX:PPUT,3         NEW PP:UPP TAIL
         LW,2     PP:UPPT           DO I ALREADY HAVE A TAIL
         BNEZ     %+3               YES-NOT 1ST IN CHAIN
         STW,3    PP:UPPH           INITIALIZE HEAD
         B        %+2               NOTHING TO LINK
         STORE,3  MX:PPUT,2         LINK TO PREVIOUS TAIL
         STW,3    PP:UPPT           SET NEW TAIL
         MTW,1    PP:UPPC           COUNT THEM UP
         LW,3     6                 GET NEXT IN PPUT CHAIN
         BDR,8    PUTRT3            GET ALL PAGES IN THIS SET
PUTRT7   BDR,5    PUTRT2            LOOK AT ALL ENTRIES IN TABLE
         LCW,5    RESDF             ADJUST VALUES FOR THE PAGES
         AWM,5    S:ACORE            WE TOOK AWAY
         AWM,5    S:PCORE
         LCW,5    DYNRESDF
         AWM,5    S:ACORE
         LCW,5    MDYNRESDF
         AWM,5    S:PCORE
         B        *MONIRTN          ALL DONE
*
PUTRT8   LI,0     0                 ZAP BAD ENTRY
         STW,0    PPTABLE-1,5
         B        PUTRT7
*
         PAGE
*D*
*D*      NAME:    CVTEBC
*D*      DESCRIPTION:  CONVERT HEXADECIMAL CHARACTER
*D*               STRING TO EBCDIC.
*D*
*D*      CALL:    R4 = LINK
*D*
*D*      INPUT:   R1 = HEXADECIMAL CHARACTERS
*D*               R2 = INDEX INTO OUTPUT MESSAGE FOR EBCDIC CHAR.
*D*               R3 = # CHARACTERS TO CONVERT
*D*
*D*      OUTPUT:  EBCDIC CHARACTERS IN OUTPUT MESSAGE
*D*
*D*      REGISTERS:  R0-R3 USED, R4 SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
*
CVTEBC   EQU      %                 CONVERT HEX CHARACTERS TO EBCDIC
         LI,0     0                 AND STORE THEM IN RESET RESDF MSG
         SLD,0    4                 R1 HAS CHARACTERS LEFT JUSTIFIED
         AI,0     X'F0'
         CI,0     X'F9'
         BLE      %+2
         AI,0     -X'39'
         STB,0    RESTRD,2          R2=INDEX INTO MESSAGE
         AI,2     1
         BDR,3    CVTEBC            R3=# OF CHARACTERS TO CONVERT
         B        0,4
         PAGE
*D*
*D*      NAME:    CVTHEX
*D*      DESCRIPTION:  CONVERT EBCDIC CHARACTER
*D*               STRING TO HEXADECIMAL.
*D*
*D*      CALL:    R1 = LINK
*D*
*D*      INPUT:   BUF CONTAINS EBCDIC CHARACTER STRING
*D*               R4 = INDEX INTO BUF OF NEXT EBCDIC
*D*                    CHARACTER
*D*
*D*      OUTPUT:  R2 = CONVERTED HEXADECIMAL VALUE IF
*D*                    SOURCE WAS HEXADECIMAL
*D*               R5 = CONVERTED HEXADECIMAL VALUE IF
*D*                    SOURCE WAS DECIMAL
*D*               R6 = # CHARACTERS CONVERTED
*D*
*D*      INTERFACE:  RTMSG.
*D*      REGISTERS:  R2-R6 USED, R1 SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
*
CVTHEX   EQU      %                 GET EBCDIC ANSWER FROM BUF AND
         LI,2     0                 CONVERT THEM TO HEX
         LI,5     0                 FOR DECIMAL INPUT
         LI,6     0                 INITIALIZE COUNT OF # CHARACTERS
CVTHEX2  LB,3     BUF,4             R4=POINTER INTO BUF
         BEZ      0,1               EOM
         AI,4     1                 BUMP INDEX
         CI,3     C','              ONLY POSSIBLE DELIMITER
         BE       0,1
         CI,1     RTMSG2            IS THIS THE DECIMAL # OF PGS
         BE       %+3               YES; A-F IS ILLEGAL
         CLM,3    ALFA              MAKE SURE IT IS 0-F
         BCR,9    %+3
         CLM,3    NUMR
         BCS,9    RTMSG
         AI,3     -X'F0'            CONVERT TO HEX
         CI,1     RTMSG2            IS THIS THE DECIMAL # OF PGS
         BE       CVTHEX4           YES
         CI,3     0
         BGE      %+2               0-9
         AI,3     X'39'             A-F
         SLS,3    28
         SLD,2    4                 BUILD ANSWER IN R2
CVTHEX3  AI,6     1                 BUMP COUNT
         B        CVTHEX2
*
CVTHEX4  MI,5     10                SHIFT PREVIOUS ANSWER
         AW,5     3                 SUM UP ANSWER
         B        CVTHEX3           CONTINUE
         PAGE
*D*      NAME:    MESSG
*D*      ENTRY:   EOM
*D*      ENTRY:   MESSGNW
*D*      DESCRIPTION:  OUTPUT A MESSAGE TO OC REQUESTING A
*D*               RESPONSE WITH WAIT OR NO-WAIT.
*D*               NO-WAIT IMPLIES THAT THE ANSWER MUST BE
*D*               IN THE PROCESS OF BEING INPUT WITHIN 10
*D*               SECONDS OR THE REQUEST ASSUMES A NULL ANSWER.
*D*               WAIT IMPLIES THAT THE ANSWER IS REQUIRED.
*D*      EOM -    OUTPUT QUESTION MARKS, THEN INITIATE
*D*               REQUEST WITH WAIT.
*D*      MESSG -  INITIATE MESSAGE REQUEST WITH WAIT.
*D*      MESSGNW- INITIATE MESSAGE REQUEST WITH NO-WAIT.
*D*      CALL: BAL,10 -
*D*      INPUT:   R0 = DA(I/O COMMAND LIST FOR REQUEST)
*D*      OUTPUT:  BUF CONTAINS RESPONSE, TERMINATED BY A ZERO BYTE, OR
*D*                A WORD OF ZERO IF NO RESPONSE
*D*               R4=0
*D*               R3=# CHARS INPUT (EXCEPT TERMINATOR)
*D*      INTERFACE:  OCMSG.
*D*      REGISTERS:  R0,R2-R4,R10 USED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
EFLD     CI,15    ' '-'A'+10
         BLE      *8
EOM      LI,0     DA(QUEST)
MESSG    RES
         MTB,1    10                SET WAIT FLAG
MESSGNW  RES
         BAL,2    OCMSG
         LI,4     0
         STW,4    BUF
         LI,0     DA(IN)
         :SIO,0   *OCNDD
         MTB,-0   10                IS THIS WAIT
         BNEZ     MESSG1            YES.
         LW,2     C:TINC
         AI,2     -500*10           WAIT TEN SECS
         LW,3     BUF               OR UNTIL INPUT STARTS
         BNEZ     MESSG1
         CW,2     C:TINC
         BNE      %-3
         :HIO,0   *OCNDD            GIVE UP
         B        *10               RETURN WITH ZERO BYTE COUNT
MESSG1   RES
         :TIO,2   *OCNDD
         BCS,12   :A
         INT,3    3                 GET BYTE COUNT
         LCW,3    3
         BEZ      EOM               TOO MANY
         AI,3     9
         LB,2     BUF,3
         CI,2     8
         BE       EOM
         CI,2     5
         BE       %+3
         CI,2     X'15'
         BNE      EOM
         STB,4    BUF,3             ZERO TERMINATOR
         B        *10
         PAGE
*D*
*D*      NAME:    OCMSG
*D*      DESCRIPTION:  DISPLAY MESSAGE ON OC DEVICE.
*D*
*D*      CALL:    R2 = LINK
*D*
*D*      INPUT:   R0 = DA(I/O COMMAND LIST FOR I/O TO OC)
*D*
*D*      REGISTERS:  ALL SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
OCMSG    :SIO,0   *OCNDD
         :TIO,0   *OCNDD
         BCS,12   :A
         B        0,2
         PAGE
*D*
*D*      NAME:    NSIG7TRP
*D*      DESCRIPTION:  IF SIGMA 6/7 TRAPS WHEN DETERMINING
*D*               MACHINE TYPE, THEN NSIG7TRP DETERMINES
*D*               IF MACHINE IS SIGMA 9 OR XEROX 560.
*D*
*D*      REGISTERS:  R1-R2 USED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
NSIG7XPSD XPSD,10  NSIG7PSD
NSIG7TRP LI,R1    X'40'             ASSUME SIGMA 9
         LI,R2    0                 CLEAR OUT R2
         LCFI     0                 CLEAR FLOATING CONTROLS
         LPSD,1   X560PSD           TRY TO SET FR BIT
X560CHK  STCF     R2                STORE IT
         CI,R2    0                 TEST IT
         BEZ      ITSA9             B/ MUST BE SIGMA 9, FR NOT SET
         LI,R1    X'20'             MUST BE XEROX 560
ITSA9    MTW,1    NSIG7PSD          BUMP UP IA
         LPSD,1   NSIG7PSD          RETURN
         PAGE
*F*
*F*      NAME:    BOOTHLT
*F*      PURPOSE: OUTPUT MESSAGE TO OC & HALT INITIALIZATION.
*F*
*D*
*D*      NAME:    BOOTHLT
*D*      DESCRIPTION:  OUTPUT MESSAGE TO OC & HALT
*D*               INITIALIZATION. RESTART IS O.K.
*D*
BOOTHLT  LI,0     DA(HLTMES)
         HIO,0    *OCNDD            STOP PENDING I/O
         BAL,2    OCMSG
         EXU      %
         PAGE
CORXPSD  XPSD,10  COREPSD
         BOUND    8
COREPSD  :PSD     RES,(IA,CORC)
CORE:SZ  DATA     CORE+X'FFF'
M        CNAME
         PROC
         LOCAL    M1,M2,M3
         BOUND    8
LF       GEN,8,24,32 5,BA(%+2),S:NUMC(AF)+NUM(AF)
         LIST     0
M1       DO       NUM(AF)
         DATA,1   X'15'             PRECEDE EACH LINE W/ CR
M2       SET      S:UT(AF(M1))
M3       DO       NUM(M2)
         DATA,1   M2(M3)
         FIN
         FIN
         BOUND    4
         LIST     1
         PEND
         PAGE
MIND     TEXT     '  0000700101'    DUMMY,MIN,HR,YR,D,MO
MAXD     TEXT     '  5923993112'    DUMMY,MIN,HR,YR,D,MO
STORE    DATA,8   X'0005040301000000'
NEXTI    DATA,8   X'0000010003040000'
BADATES  TEXT     '0229023002310431063109311131'
MSMKS    GEN,16,16,16,16 10,6,10,30000
         BOUND    8
RESDFCP  GEN,8,24,32 5,BA(RESDFM),25
ALFA     DATA     C'A',C'F'
NUMR     DATA     C'0',C'9'
IN       GEN,8,24,32 X'86',BA(BUF),10
QUEST    GEN,8,24,32 5,BA(QM),4
GDATE    GEN,8,24,32 5,BA(GDATEM),16
GTIME    GEN,8,24,32 5,BA(GTIMEM),13
RDLT     GEN,8,24,32 5,BA(RDLTM),24
DLTCLST  GEN,8,24 3,BA(DLTDSC)      SEEK TO DELTA ON SWAPPER
         DATA     X'2E000004'
         DATA     X'2000000'        READ IT
DLTSZ    DATA     X'2E000000'
         GEN,8,24 3,BA(UMOVSA)      SEEK TO ROOT EXTENSION
         DATA     X'2E000004'
BAUMOV   DATA     X'2023800'        READ IT
UMOVSZ   DATA     2048              DUMMY SIZE IN CASE NO UMOV
DLTDSC   DATA     0
UMOVSA   DATA     0
         BOUND    8
RDPPTAB  GEN,8,24 3,BA(PPTABDSK)
         GEN,8,24 X'2E',4
         GEN,8,24 2,BA(RESDF)
PPTABSZ  DATA     0
PPTABDSK DATA     0
RFECP    M        'DO YOU WANT FROG TALK(Y/N)'
RDLTM    GEN,8,24 X'15','DO '
         TEXT     'YOU WANT DELTA (Y/N)'
GTIMEM   GEN,8,24 X'15','TIM'
         TEXT     'E(HH:MM)='
GDATEM   GEN,8,24 X'15','DAT'
         TEXT     'E(MM/DD/YY)='
QM       DATA,1   ' ','?','?',X'15'
RESDFM   DATA,1   X'15','R','E','S'
RESTRD   TEXT     'ET RESDF YYY,XXXXX ? '
HLTMES   M        'INITIALIZATION HALTED - RESTART OK'
ERRMSK   DATA     X'700000'
*
OCNDDFLG DATA     0                 =0, NO OC ADDR.CHANGE
*                                   >0, OC ADDR.CHANGED,VALUE=DCT INDEX
MPBR     B        SYSTRT            FOR MP AND OTHER SYSTEMS
NSIG7PSD :PSD     (IA,NSIG7TRP),RES
X560PSD  :PSD     (IA,X560CHK),(CC,0),FR
*
MONIRTN  RES      1
         PAGE
TBOOT:   CSECT    0                 NEW CSECT FOR TAPE BOOT CODE
*D*
*D*      NAME:    TBOOT:
*D*      ENTRY:   CT0
*D*      ENTRY:   CT1
*D*      ENTRY:   GETDC3
*D*      ENTRY:   SEGPATCH
*D*      DESCRIPTION:  TBOOT: IS ENTERED FROM MONINIT WHEN
*D*               THE BOOT TYPE IS FROM TAPE. UPON ENTRY
*D*               INTO TBOOT:, RECNFG:0 IS ENTERED TO
*D*               INITIALIZE THE DEVICE ADDRESS TABLES & TO
*D*               DETERMINE IF THE TARGET MACHINE IS THE SAME
*D*               AS THE SYSTEM BEING BOOTED. TBOOT: THEN
*D*               REQUESTS DEVICE ADDRESS CHANGES FOR THE
*D*               C,LL,DC (CARD READER, LINE PRINTER, SWAPPER(S)
*D*               RESPECTIVELY) IF CHANGES ARE NECESSARY. THE
*D*               SWAPPER(S) IS(ARE) THEN CHECKED TO DETERMINE
*D*               IF THE TARGET MACHINES SWAPPER(S) IS(ARE) THE
*D*               SAME AS THAT FOR WHICH THE SYSTEM WAS SYSGENED.
*D*               TBOOT: THEN INITIALIZES THE JIT.
*D*               THE SYSTEMS VERSION & TYPE ARE THEN
*D*               INITIALIZED FROM THE MONITOR INFO RECORD FROM
*D*               TAPE. XDELTA IS THEN READ FROM TAPE. THE
*D*               SENSE SWITCH INFO IS DISPLAYED (IF DESIRED).
*D*               TBOOT: THEN ENTERS XDELTA FOR THE
*D*               READING & PROCESSING OF MONITOR ROOT & OVERLAY
*D*               & SPECIAL MONITOR PROCESSOR PATCH CARDS. XDELTA
*D*               MAY ALSO ENCOUNTER RECONFIGURATION CONTROL
*D*               COMMANDS, AT WHICH TIME XDELTA RETURNS
*D*               CONTROL TO TBOOT:   WHICH INTURN ENTERS
*D*               RECNFG:1 FOR IT TO PROCESS THESE COMMANDS.
*D*               TBOOT: CONTINUES TO INTERFACE WITH XDELTA
*D*               UNTIL ALL OF THE MONITOR OVERLAYS & SPECIAL
*D*               PROCESSORS HAVE BEEN READ FROM TAPE & PATCHED
*D*               IF REQUIRED.
*D*
*D*      CT0 -    RETRY SWAPPER TESTS
*D*      CT1 -    RETRY SWAPPER TEST FOR FLAWS
*D*      GETDC3 - ACCEPT SWAPPER AS IS
*D*      SEGPATCH - INCREMENT TO NEXT SEGMENT # FOR
*D*               PATCHING PURPOSES. THEN ENTER XDELTA
*D*               FOR IT TO READ PATCHES & PERFORM PATCHING.
*D*               CALL:       R11 = LINK
*D*
*D*      INTERFACE:  RECNFG:0,MESSG,EOM,
*D*               VALINP,VALINP1,BADDPX,WRTPRT,BADDP1,BADDP,
*D*               FLAW,BADISC,DSCCVT,RTAPE,ERROREC,OCMSG,
*D*               SWAPINIT,PACHSTRT.
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
         BAL,R15  RECNFG:0    ****  INITIALIZE DCT TABLES
         LI,0     0
         STW,0    BUF               INITIALIZE BUFFER
         LI,0     DA(DFALT)
         LC       BOOTFLG           IF NO OC, USE YES
         BCR,8    %+2
         BAL,10   MESSG             ASSIGNS OK(YES/NO)
         LW,6     BUF
         BEZ      %+5               NO INPUT, USE YES
         CW,6     NO
         BE       %+3
         SW,6     YES
         BNEZ     EOM
         LI,2     CR                CR TYPE CODE
         BAL,5    VALINP            CNDD
         STW,9    CNDD
         LI,2     LP                LP TYPE CODE
         BAL,5    VALINP            LPNDD
         STW,9    LLNDD
         LW,7     DCT8,1            IF DEVICE IS LOW SPEED, SET FLAG
         CI,7     PRTOUTL
         BNE      %+2
         MTB,-1   LLNDD
         LI,7     0
GETDC1   EQU      %
         LB,1     MB:SDI,7          SWAPPER DCT INDEX
         BAL,5    VALINP1           GO-CONVERT DCTX INTO ADDRESS
CT0      RES
         STW,9    M:SWAPD,7
         LB,4     DCT22,1           CALCULATE LAST CYLINDER # FOR PACK
         LW,2     S:DP              TEST FOR PACK SWAPPING
         BEZ      GETDC2            NOT DOING IT
CT1      EQU      %
         LI,10    0                 READ HEADERS A CYLINDER ATA ATIME
         STW,10   SEEK              STARTING AT 0,0,0
         STH,10   DISCLOC
         LW,3     S:CYLSZ
         SLS,3    4                 8 BYTES PER SECTOR (CYLSZ IN GRANS)
         STS,3    CMD+5             SET HEADER READ BYTE COUNT
         :HIO,0   *M:SWAPD          RESET
CT2      LI,0     DA(CMD)
         :SIO,0   *M:SWAPD          READ A BUNCH OF HEADERS
         BCS,12   BADDPX
CT3      WAIT     0
         :TIO,0   *M:SWAPD          CHECK COMPLETON
         BCS,12   CT3
         :TDV,3   *M:SWAPD          CHEKC STATUS
         LC       3                 TEST STAUTS BITS
         BCS,2    BADDP             SECTOR UNAVAILABLE, CYLS TOO SMALL
         BCS,4    FLAW              FLAW MARK DETECTED
         B        GETDC2
SWPMODS  DATA     X'FFFF7212',X'72323214',X'72717275',X'72427261'
         DATA     X'32750000'
SNSADR   DATA     X'80',X'560057',X'2000101',X'2000101',X'1000000'
#SWPMODS EQU      HA(%)-HA(SNSADR)-1
ADRINCR  EQU      %-1
SWPNSPT  DATA     0,X'60B060B',X'C000000'
CHKNSPT  LI,2     HGP
         LW,3     1,2               ALL DISC DEVICES MUST BE THE SAME
         SLS,3    -16
         CB,4     DCT22,3
         BNE      BADISC
         LW,2     0,2
         BNEZ     CHKNSPT+1
         LI,2     #SWPMODS
         CH,0     SNSADR,2
         BE       %+3
         BDR,2    %-2
         B        BADISC
         LB,0     SWPNSPT,2
         STW,0    NSPT,4
         LI,2     HGP
         STW,0    2,2
         LW,2     0,2
         BNEZ     %-2
         B        DCDPOK
GETDC2   EQU      %
         LI,0     DA(CLIST)         CHECK DISC TYPE
         :HIO,0   *9
         :SIO,0   *9
         BCS,12   BADISC            DONT WAIT IF DEVICE NOT PRESENT
CT4      RES
         WAIT     0                 SKIP 4 PAGES
         :TIO,0   *9
         BCS,12   CT4               CONTINUE WAITIONG
         LW,3     S:DP
         LH,0     SENSW,3           GET TRACK/SECTOR PART
         AND,0    M15               SCRUB WRITE PROTECT BIT
         LH,3     DEVMOD#,1         GET MODEL#
         LI,2     #SWPMODS
         CH,3     SWPMODS,2         FIND IT IN THE TABLE
         BE       %+2
         BDR,2    %-2
         CH,0     SNSADR,2          DID WE GET TO THE RIGHT SECTOR
         BNE      CHKNSPT
         STW,0    SENSW
GETDC3   RES
         AI,7     1
         CI,7     LSWAP
         BLE      GETDC1
DCDPOK   EQU      %
         LW,0     NSPT,4
         STB,0    SWPNSPT
         LI,2     X'100'
         SW,2     0
         STW,2    ADRINCR           SET UP ADDRESS INCREMENTER
         PAGE
*
*
         LI,8     2
         MTW,0    S:DP
         BNEZ     DPSWP
         MTW,-2   CLIST+1           MAKE 2 BYTE SEEK
         MTW,-2   BOOTIC+1
         MTW,-2   BOOTIC+5
         MTW,-2   DLTCLST+1
         MTW,-2   DLTCLST+5
         MTW,-2 RDPPTAB+1
         LI,8     DAJ               JIT DISC ADR
DPSWP    RES
*DAJ IS WHERE JIT LIVES
*SECTORS 2-5 ARE FOR ALLOCAT'S AJIT AND JIT TO SWAP TO
J        EQU      JITLOC-J:JIT
         LB,4     MB:SDI
         STH,4    8                 DCT X AND RELATIVE SECT #
         BAL,11   DSCCVT            RELATIVE TO ACTUAL DISC ADR
         STW,8    DISCLOC
         LI,5     256-JXBUFVP
         LI,3     JXBUFVP
         LI,2     FPMC
         STORE,2  JX:CMAP+J,3
         AI,3     1                 TO END
         BDR,5    %-2
         LI,R5    :BIG
         BNEZ     1A3               DONT INITIALIZE CL ON BIG9S.
         LCI      4
         LM,12    JCLIST            BASIC CLIST
         LI,5     -JCCL             CLIST LENGTH
         SAS,5    -1
         LI,2     J:CL+J+JCCL
1A1      LI,3     4
         STD,12   *2,5               STORE SEEK
         AI,12    2                 INC BA(DAT)
1A2      AI,5     1
         BGEZ     1A3
         STD,14   *2,5              STORE FOUR WRITES
         BDR,3    1A2
          BIR,5  1A1                NEXT SEEK
1A3      EQU      %
         LI,5     JOVVP             INITIALIZE MMC CONTROL WORDS
         SLS,R5   :BIG-2            FOR SWAPPER
         AWM,5    S:MAPCW
         SLS,R5   -2-:BIG
         AWM,5    S:ACCW
         LI,5     X'100'-JOVVP
         SLS,R5   :BIG-2
         STB,5    S:MAPCW+1
         SLS,R5   -2-:BIG
         STB,5    S:ACCW+1
         LI,7     1                 ONE RECORD
         BAL,1    RTAPE             READ MON INFO REC
         LI,4     X'50'             SET VERSION E00
         LI,5     X'4170'           SYMBIONT, CPV, SIG7
         BIF,S7   KNOWN             ASSUME SIGMA 7 (BIT 25)
         AI,R5    X'4000'           MAKE IT SIGMA 9 (BIT 24)
         BIF,S9   KNOWN             SIGMA 9 IS OK
         AI,R5    X'4000'           MAKE IT X560 (BITS 24 & 25)
KNOWN    EQU      %
         STB,4    5                 SYMB
         SCS,5    -8                UTS
         LI,4     #FEATURES         ADD BITS FOR SPECIAL FEATURES
         EXU      FEATURETEST,4
         BEZ      %+2
         OR,5     FEATUREBIT,4
         BDR,4    %-3
         STW,5    SYSVERS
         LI,5     '1'
         STB,5    INFOBUF+7         MAKE PAGE EJECT FIRST
         LI,5     '
'
         INT,3    INFOBUF           #LINES
         AWM,3    MAXSEG            SET MAX SEG#
         MTW,4    DATCLST
         LI,4     24
         LI,0     DA(DATCLST)
         LC       BOOTFLG           IF NO LP, CANT CHECK DEVICE
         BCR,4    PRNT
         :HIO,0   *LLNDD
         LW,6     LLNDD
         BAL,11   ERROREC
         DATA     3
         :TDV,7   *LLNDD
         AND,7    Y02
         BE       %+2
         MTB,-1   LLNDD
         :HIO,0   *LLNDD
PRNT     LC       BOOTFLG           NO LP FLAG
         BCR,4    PRNT1             SAYS NO PRONT
         LW,6     LLNDD
         BGZ      %+3
         BAL,11   ERROREC
         DATA     3
         BAL,11   ERROREC
         DATA     3
PRNT1    EQU      %
         LW,6     DATCLST
         STB,5    0,6
         AWM,4    DATCLST
         AWM,4    DATCLSTT+1
         BDR,3    PRNT
         LI,0     DA(DATCLSTT)
         MTW,4    DATCLSTT
         LC       BOOTFLG           NO OC OF NO FLAG
         BCR,8    %+2               NO OC
         BAL,2    OCMSG
         LI,7     1
         BAL,1    RTAPE             DELTA HEAD
         INT,15   INFOBUF+1         BIAS AND START ADDRESS
         STS,15   DLTBIAS
         AWM,15   BPCH
         SLD,14   2+32              STUFF BUFFER ADDRESS IN
         LI,15    X'7FFFF'          READ COMMANDS
         STS,14   DLTSZ-1           FOR SWAPPER
         STS,14   TREAD             AND TAPE
         LB,7     INFOBUF+4         # OF PAGES TO READ
         BAL,1    RTAPE            CODE
         STS,1    DLTSZ
         LI,14    BA(BUFFER)        NOW SWITCH TO REAL BUFFER ADDRESS
         STS,14   TREAD
         LC       BOOTFLG           CHACK OC FLAG
         BCR,8    NOX2
         LI,0     DA(SSW)           SENSE SWTICH REMINDER
         BAL,2    OCMSG
NOX2     EQU      %
         LI,11    SWAPINIT          FIRST RETURN FROM PATCHING
MAXSEG   LI,2     -18               BECOMES LI,3 MAXSEG
SEGPATCH EQU      %
         MTW,1    SEGNO
         LW,1     SEGNO
BPCH     B        PACHSTRT
FEATURETEST EQU   %-1
         LI,0     ICB               REALTIME
         LI,0     RBSS              REMOTE BATCH
         LI,0     COC               ONLINE
         LI,0     TTP               TP
         LI,0     NSCPU             MULTIPROCESSING
#FEATURES EQU     %-FEATURETEST-1
FEATUREBIT EQU    %-1
         DATA     4                 REAL TIME
         DATA     2                 REMOTE BATCH
         DATA     X'8000'           ONLINE
         DATA     X'4000'           TP
         DATA     X'2000'           MULTIPROCESSING
         PAGE
*D*
*D*      NAME:    SWAPINIT
*D*      DESCRIPTION:  SWAPINIT IS ENTERED FROM XDELTA WHEN
*D*               XDELTA ENCOUNTERS THE FIRST NON-ROOT PATCH OR
*D*               THE ASTERISK (*) CARD IN THE PATCH DECK.
*D*               IF RECONFIGURATION IS NOT COMPLETED, I.E.,
*D*               NO ':END' COMMAND HAS BEEN ENCOUNTERED, THEN
*D*               SWAPINIT ENTERS RECNFG:2 FOR THE COMPLETION OF
*D*               THE RECONFIGURATION PROCESS. SWAPINIT THEN
*D*               WRITES THE JIT TO THE SWAPPER. EACH MONITOR
*D*               PROCESSOR & OVERLAY IS THEN READ FROM THE BOOT
*D*               TAPE, PATCHED BY XDELTA IF PATCHES ARE
*D*               REQUESTED, & THEN OUTPUT TO THE SWAPPER.
*D*
*D*      INTERFACE:  RECNFG:2,WDISC,GETHEAD,SIZCHK,RWDSK,
*D*               WRTROOT.
*D*      REGISTERS:  ALL USED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
BADSEEK  DATA,2   0,411,406,203
GOODSEEK DATA,2   808,404,400,200
#DPS     EQU      3
SWAPINIT EQU      %                 RETURN FROM XDELTA, 1ST NON-RES.PATCH
         MTW,1    :ENDFND     NO--- SET TO FOUND BY DEFAULT
         BAL,R15  RECNFG:2    ****  ASSUME :END BY DEFAULT
RECNFDON EQU      %
         LI,R2    JITLOC
         LW,1     S:DP              WRITE JIT TO END AT SECTOR 8
         MI,1     512*4*2
         AI,1     512*4
         BAL,10   WDISC
         LI,4     MAXOVLY+3         ALLOCAT INDEX
         MTW,0    S:DP              IF DP SWAPPER, SET UP
         BEZ      RHEAD             DEVICE CHARACTERISTICS
         LB,2     MB:SDI
         LB,1     DCT22,2
         LH,6     DCT1,2
         LI,0     DA(CMD)           READ HEADERS ON ILLEGAL CYLS UNTIL
         LI,7     #DPS              ONE FAILS (BAD SEEK)
DPCK     LH,8     BADSEEK,7
         STH,8    SEEK
         BAL,11   ERROREC
         DATA     6
         B        %+3               NORMAL RETURN, TRY NEXT END
         LC       TDV               FLAW OR OFF THE END..WHICH
         BCS,2    %+2               OFF THE END, FOUND IT.
         BDR,7    DPCK
         LH,7     GOODSEEK,7
         STW,7    NCYL,1            NOW SET PARAMETERS
         LW,5     NSPT,1
         LI,R11   19                SET PROBABLE NTPC
         CI,7     400
         BG       %+2               TRUE IF 404 OR MORE CYLS
         LI,R11   20
         STW,R11  NTPC,R1
         MW,R5    R11
         SLS,R5   -1                ROUND TO EVEN SECTORS
         SLS,R5   1
         STW,5    NSPC,1
         MW,7     5
         STW,7    DISCLIMS,1
         SLS,5    -1
         STW,5    S:CYLSZ
         LCW,5    S:CYLSZ
         AWM,5    #PAGES            SET REMAINING SPACE ON CYL0
         CW,7     PSA%END           LIMIT SWAP SPACE IF IT IS
         BGE      %+2               TOO LARGE
         STW,7    PSA%END
RHEAD    BAL,15   GETHEAD           READ AND MOVE HEAD RECORD
         LI,1     X'1FFFF'
         LW,0     HEAD+1            GET START ADDRESS
         STS,0    P:SA,4
         LH,0     HEAD+2            GET TCB ADDRESS FOR FIX
         SLS,0    1
         STS,0    P:TCB,4
         LB,0     HEAD+3            DATA SIZE
         STB,0    PB:DSZ,4
         LB,7     HEAD+6            DCB SIZE
         STB,7    PB:DCBSZ,4        SAVE IT
         AW,7     0                 ASSURE SPACE ON CYLINDER
         BEZ      %+2
         BAL,10   SIZCHK
         LW,0     HEAD+4            PRCD WORD
         SLS,0    -8
         STB,0    PB:PVA,4          BIAS
         AH,0     0                 ADD SIZE
         STB,0    PB:HVA,4
         LB,0     HEAD+4            SIZE
         STB,0    PB:PSZ,4
         LH,7     3
         BEZ      %+2
         STB,7    PB:DC#,4
         STH,3    PH:DDA,4          DATA DISC ADDRESS
         LB,7     PB:DSZ,4
         BEZ      NOTGHOST          NO DATA
PWDATA   LW,3     HEAD+3            DATA BIAS
         BAL,10   RWDSK             COPY DATA RECORD
NOTGHOST EQU      %
         LB,7     PB:DCBSZ,4
         BEZ      %+3               NO DCBS
         LW,3     HEAD+6            DCB BIAS
         BAL,10   RWDSK             READ WRITE DCBS
         LB,7     PB:PSZ,4          ASSURE SPZCE ON CYL
         BAL,10   SIZCHK
         LH,10    3
         BEZ      %+2
         STB,10   PB:C#,4
         STH,3    PH:PDA,4
         LI,10    JJITVP+1
         CB,10    PB:PVA,4          IF NOT OVERLAY
         BNE      NOTUMOV
         LW,3     DISCLOC
         STW,3    UMOVSA            SAVE UMOV'S D.A.
         SLS,7    11                AND SIZE
         STW,7    UMOVSZ
         SLS,7    -11
         AWM,4    UMOV#
NOTUMOV  RES
         LW,3     HEAD+4            PROCEDURE BIAS..
         BAL,10   RWDSK             READ WRITE PROCEDURE
         BDR,4    RHEAD
RECOV    BAL,15   GETHEAD
         LW,1     HEAD+1            START ADDRESS
         STW,1    RCVSTART
         INT,7    HEAD+4            GET BIAS
         STH,7    HEAD+3            SAVE IT IN ACCESSIBLE PLACE
         SLS,7    3
         STS,7    RCVSIZE-1         SET RECOVERREAD/MONITORRESTORE CDW
         LB,7     HEAD+4            # RECORDS
         BAL,10   SIZCHK
         STH,3    PH:PDA            SET END OV LAST OVERLAY FOR DRSP
         LH,3     3                 AND ITS C#
         BEZ      %+2               IF THERE IS ONE
         STB,3    PB:C#
         LW,3     DISCLOC
         STW,3    RCVDISC           SET DISC ADDRESS
         LW,3     HEAD+4            RECOVERY PROCEDURE BIAS...
RECVR    BAL,10   RWDSK             READ WRITE RECOVER
         STS,1    RCVSIZE
         LI,2     X'1FFFF'
         AND,2    DLTBIAS
         INT,7    DLTSZ
         SLS,7    -11
         BAL,10   SIZCHK
         LW,3     DISCLOC           SET DISC ADDRESS
         STW,3    DLTDSC
         INT,1    DLTSZ
         BAL,10   WDISC
         LI,2     TOPROOT-PPSTART
         LW,7     PPSTART
         AW,7     PPSTART,2
         BDR,2    %-1
         STW,7    MONCHK
         LI,2     RESDF
         BEZ      WRTROOT           NONE
         LI,7     PPTABLSZ+5
         SLS,7    2                 BYTE SIZE
         STW,7    PPTABSZ
         LI,7     1                 GET 1 GRANUAL
         BAL,10   SIZCHK
         LW,3     DISCLOC
         STW,3    PPTABDSK          SAVE DISC ADDRESS
         BAL,11   SEEKCVT
         STW,8    PPTABDSK2         FOR RECOVERY IO
         LI,1     2048
         BAL,10   WDISC             WRITE OUT NULL TABLE
*        B        WRTROOT
         PAGE
*D*
*D*      NAME:    WRTROOT
*D*      DESCRIPTION:  WRITE THE MONITOR ROOT TO THE SWAPPER
*D*               ALONG WITH A DISC BOOT-STRAP.
*D*
*D*      INTERFACE:  SIZCHK,WDISC,SEEKCVT,DSCCVT,GMONEX.
*D*      REGISTERS:  ALL USED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
WRTROOT  EQU      %
         LW,3     DISCLOC
         LI,1     X'2000'           TURN OFF THE CLOCK
         WD,1     X'1100'           TEMPORARILY
         LI,1     0                 INITIALIZE SIZE
         LI,2     0                 AND ADDRESS
         LI,4     DABOOT            DISCADDRESS ADDRESS
         LI,5     DABOOT            COMMANDLIST ADDRESS
WRTR1    LI,7     32                WRITE EACH CHUNK (0-RECOV,RECOV-END)
         CB,7     HEAD+3            IN ONE OR TWO PIECES
         BGE      %+3
         BAL,10   SIZCHK
         BAL,10   WDISCROOT
         LB,7     HEAD+3
         BAL,10   SIZCHK
         BAL,10   WDISCROOT
         LI,7     DA(MONIRTN)+255
         SW,7     HEAD+4
         SLS,7    -8
         STB,7    HEAD+3
         LW,12    MPPSEEK           FLAG FOR WEVE BEEN HERE
         BEZ      WRTR1
         LW,4     S:DP
         BEZ      WPCK
         LW,7     S:CYLSZ           ALLOCATE CYLINDERS FOR GHOSTS
         MTH,0    DISCLOC,4         IF AT END OF CYLINDER
         BNEZ     %+4               AND ON NS PACK, DONT SKIP ONE
         CI,7     6*19
         BNE      %+2
         MTH,-1   DISCLOC
GC#0     LI,5     -1
         BAL,10   SIZCHK1           GET A FLAWFREE CYLINDER
         AI,5     1
         CH,5     3                 DONT SKIP ANY FOR S:UCYL>1
         BE       %+4
         LH,5     3
         STB,5    UB:C#,4
         LW,9     S:UCYL
         BDR,9    SIZCHK1           FORCE CYLINDER INCREMENTATION
         LB,4     NXTGHOST,4        GET NEXT GHOST USER#
         BNEZ     GC#0
         MTH,1    DISCLOC           PUT RCVRAD ON NEXT CYL
         B        WP99
NXTGHOST DATA     X'00040000',X'03000000'
WPCK     LI,7     0                 NOW MAKE SURE NO WRITE PROTECT
         LB,1     MB:SDI,7          SWITCHES ARE SET
         LH,6     DCT1,1
         BLZ      WP99              DEVICE NOT THERE
         LB,4     DCT22,1
         LW,9     DISCLIMS,4        SIZE OF DEVICE
         DW,9     NSPT,4            #TRACKS
         SLS,9    -4                MAX 16 SWITCHES
         EXU      TRK%SHFT,4
         LI,4     15                DONT CHECK THE FIRST ONE
         STW,4    SENSW             ZAP ADDR
WP00     AWM,9    SENSW
         LI,0     DA(WPCMD)
         BAL,11   ERROREC
         DATA     5
         BDR,4    WP00
WP99     AI,7     1
         CI,7     LSWAP
         BLE      WPCK+1
         BAL,11   SEEKCVT           CALCULATE RCVRAD
         STW,8    RCVRAD
         LW,3     DABOOT            PREPARE TO WRITE FIRST PARET
         STW,3    DISCLOC
         AI,8     RBUFSIZE*2        RESERVE SECTORS FOR BUFFERS
         BAL,R11  DSCCVT
         STW,R8   SEEK4000          SEEK OF X'4000'
         LI,R2    X'5A'             WRITE OUT MONITOR FROM HERE
         LI,1     X'1FFFF'          GET SIZE OF FIRST PART
         AND,1    DABOOT+7
         BAL,10   WDISC             WRITE 1ST 16 K
         LI,3     X'2000'           TURN CLOCK BACK ON NOW
         WD,3     X'1200'           THAT THE MONITOR IS WRIT
*  WRITE DISC BOOT
         LI,1     2048              BOOT IS ONE GRANULE
         LI,2     DBOOT
         LI,4     0
         STW,4    DISCLOC
         BAL,10   WDISC
         B        GMONEX
         PAGE
*D*      NAME:    WDISCROOT
*D*      DESCRIPTION: WRITE PARTS OF MONITOR ROOT, BUILDING THE COMMAND
*D*               LIST(S) THAT WILL BE USED TO READ IT BACK IN AGAIN.
*D*      CALL:    BAL,10   (EXITS THROUGH WDISC)
*D*               (7)=#PAGES TO WRITE
*D*               (1)=#BYTES IN PREVIOUS PIECE
*D*               (2)=WORD ADDRESS OF PREVIOUS PIECE
WDISCROOT RES
         LW,3     DISCLOC
         STW,3    0,4               PUT DISCADDRESS IN DABOOT LIST
         AI,4     1
         BDR,12   %+2               SAVE MPPSEEK IF THIS IS THE TIME FOR IT
         STW,3    MPPSEEK
         SLS,2    2                 MAKE BYTE ADDRES
         AW,2     1                 BUMP PIECE ADDRESS
         LW,3     Y2                SET COMMAND CHAIN FOR PREVIOUS COMMAND
         STS,3    3,5
         STS,2    HEAD+3            TAKE 16K IN CASE DOUBLE WRITE
         AI,5     4                 BUMP TO NEXT COMMAND PIECE
         CI,5     DABOOT+8          IS IT TIME TO SWITCH TO BOOTIC
         BNE      %+2
         LI,5     BOOTIC            YES
         LI,3     X'3F800'          STUFF ADDRESS
         STS,2    2,5
         LW,1     7
         SLS,1    11
         STS,1    3,5               AND SIZE
         SLS,2    -2                WORD ADDR FOR WDISC
         B        WDISC
         PAGE
*D*
*D*      NAME:    GETHEAD
*D*      DESCRIPTION:  READ HEAD RECORD FOR MONITOR
*D*               PROCESSOR FROM BOOT TAPE.
*D*
*D*      CALL:    R15 = LINK
*D*
*D*      INTERFACE:  RTAPE.
*D*      REGISTERS:  R1-R2,R7,R13 USED, R15 SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
GETHEAD  LI,7     -511              READ ONE RECORD
         BAL,1    RTAPE
         LW,13    BUFFER+512,7      7 COMES BACK ONE LESS
         STW,13   HEAD+512,7        MOVE THE WHLOE PAGE
         BIR,7    %-2
         LW,7     HEAD+7            SET SIZE IN XDELTA
         SLS,7    -2                IN WORDS
         LI,2     4                 IN WORD 4
         STW,7    *DLTBIAS,2
         B        *15
         PAGE
*D*
*D*      NAME:    RTAPE
*D*      DESCRIPTION:  READ 'N' RECORDS FROM THE BOOT TAPE.
*D*
*D*      CALL:    R1 = LINK
*D*
*D*      INPUT:   R7 = # RECORDS TO READ
*D*
*D*      OUTPUT:  R1 = TOTAL SIZE OF RECORD(S) READ IN BYTES
*D*
*D*      INTERFACE:  ERROREC,TPREC.
*D*      REGISTERS:  R0-R1,R6-R7,R11-R13 USED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
RTAPE    LW,12    TREAD             SAVE BUFF ADDR
         LI,13    2048              ADDR INCREMENT
RTAPE1   LI,0     DA(TREAD)
         LW,6     37
         LI,11    -11
         STW,11   TRYCOUNT
         BAL,11   ERROREC
         DATA     -1
         LH,11    RBC               IF INCORRECT LENGTH,
         BNEZ     TPREC             MAY BE PATCH OR ERROR
         AWM,13   TREAD
         BDR,7    RTAPE1
         XW,12    TREAD
         SW,12    TREAD
         XW,12    1
         B        *12
         PAGE
*D*
*D*      NAME:    SIZCHK
*D*      DESCRIPTION:  IF DISC PACK SWAPPER SYSTEM, MAKE
*D*               SURE THAT ENTIRE RECORD TO BE WRITTEN TO
*D*               SWAPPER WILL FIT ON CURRENT CYLINDER.
*D*               IF NOT, INCREMENT TO NEXT CYLINDER.
*D*               IF RAD SWAPPER, DON'T DO ANYTHING.
*D*
*D*      CALL:    R10 = LINK
*D*
*D*      INPUT:   R7 = # RECORDS TO WRITE ON SWAPPER
*D*
*D*      REGISTERS:  R3 USED, R10 SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
SIZCHK   MTW,0    S:DP              ASSURE (7) PAGES LEFT ON CYL
         BEZ      *10               IF DP SWAPPER
         LB,0     SWPNSPT           IF NS PACK, CROSS AT WILL
         CI,0     12
         BE       *10
         AWM,7    #PAGES
         BGZ      SIZCHK1           WONT FIT, GO TO NEXT CYL
FLAWCHK  LW,3     7                 CHECK DESIRED SPACE FOR FLAWS
         SLS,3    4
         LI,6     1
         STH,3    CMD+5,6
         LW,3     DISCLOC
         STW,3    SEEK
         LI,0     DA(CMD)           READ HEADERS FOR THE SPACE
         LW,6     M:SWAPD
         BAL,11   ERROREC
         DATA     6
         B        *10               ALL IS OK
FWCHK2   MTW,1    #PAGES            SKIP THE BAD PART
         BGZ      SIZCHK1           RAN OFF THE END
         AI,3     2                 START NEXT TRY AT START OF A TRACK
         CB,3     SWPNSPT
         BL       FWCHK2
         AW,3     ADRINCR
         CI,3     X'FF'             DONT TRY ODD TRACKS
         BANZ     FWCHK2
         STW,3    DISCLOC
         B        FLAWCHK
SIZCHK1  RES
         LCW,3    S:CYLSZ           NO, SKIP TO NEXT
         STW,3    #PAGES
         MTH,1    DISCLOC           INCR CYL#
         LH,3     DISCLOC           CLEAR TRACK/SECTOR
         SLS,3    16
         STW,3    DISCLOC
         B        SIZCHK            AND TRY AGAIN
         PAGE
*D*
*D*      NAME:    RWDSK
*D*      DESCRIPTION:  READ NEXT MONITOR PROCESSOR OR OVERLAY
*D*               FROM BOOT TAPE, PERFORM PATCHING IF NEEDED,
*D*               & THEN WRITE IT TO THE SWAPPER. IF INFO
*D*               IS ALLOCAT'S DATA, NO WRITE IS PERFORMED
*D*               BUT THE CURRENT DISC ADDRESS IS INCREMENTED
*D*               TO ALLOW SPACE FOR THE DATA. ALL OTHER INFO
*D*               IS WRITTEN TO THE SWAPPER WITH CHECK-WRITE.
*D*               IF THE SEGMENT IS RECOVER, IOTABLE IS MOVED FROM THE
*D*               ROOT INTO IT BEFORE PATCHING TO INCLUDE RECONFIG UPDATES.
*D*      CALL:    R10 = LINK
*D*      INPUT:   R3 = SIZE OF SEGMENT IN DOUBLE WORDS
*D*                    (HALF WORD 0)
*D*                    DOUBLE WORD ADDRESS OF SEGMENTS BIAS
*D*                    (HALF WORD 1)
*D*      OUTPUT:  R1 = TOTAL SIZE OF RECORD(S) IN BYTES
*D*               R3=SEEK ADDRESS OF END OF WRITE (RIGHT ADJUSTED).
*D*      INTERFACE:  RTAPE,WDISC,SEGPATCH,DSCCVT.
*D*      REGISTERS: 4,5,7,9,10 SAVED
RWDSK    RES
         LB,7     3                 GET SIZE IN PAGES
         BEZ      *10               NOTHING TO DO
         BAL,1    RTAPE             READ
         STW,1    SEGSIZE
         LI,2     BUFFER            SET BUFFER ADDRESS
         LH,6     3                 GET SIZE OF SEG
         INT,3    3                 AND BIAS
         SLS,3    1
         SLS,6    1                 BOTH IN WORDS
         CI,R10   RECVR+1
         BNE      NOTRECVR    NO--- RECOVER MODULE
         LW,R11   0,R2        YES-- GET ADDR.OF IOTABLE IN RECOVER
         AI,R11   BUFFER              IN BOOT PHASE
         LI,R1    DCTSIZ+2          DCT TABLE SIZE +2
         LH,R12   DCT1,R1           MOVE
         STH,R12  *R11,R1             DCT1 TO RECOVER
         BDR,1    %-2
         AI,R11   DCT16-DCT1        ALSO MOVE RMA TABLES, DISC TABLES
         LI,R1    AVRTBL-DCT16
         LW,R12   DCT16,R1
         STW,R12  *R11,R1
         BDR,R1   %-2
NOTRECVR EQU      %
         BAL,11   SEGPATCH          SET SEGNO AND PATCH
         LW,1     SEGSIZE
         LW,12    SEGNO             IF ALLOCATS DATA, DONT WRITE
         CI,12    1                 JUST INCREMENT D.A.
         BNE      WDISC
         LB,8     PB:DSZ,4          CALCULATE END OF DATA
         SLS,8    1
         AI,8     8
         LB,12    MB:SDI
         STH,12   8
         BAL,11   DSCCVT
         STW,8    SENSW             SAVE IT
         B        NOCHKWRT          AND MOVE TO DISCLOC AND 3
         PAGE
*D*      NAME:    WDISC
*D*      DECSRIPTION: WRITE A RECORD TO THE SWAPPER.
*D*      CALL:    R10 = LINK
*D*      INPUT:   R1 = # BYTES TO WRITE
*D*               R2 = BUFFER ADDRESS OF INFO TO WRITE TO SWAPPER
*D*      OUTPUT:  R3=SEEK ADDRESS OF END OF WRITE (RIGHT ADJUSTED).
*D*      REGISTERS: 0,3,11-14 VOLATILE
*D*      INTERFACE: ERROREC,WRTPRT
WDISC    LD,12    WRCOM             GET WRITE COMMAND
         AW,12    2                 SET BUF ADDR
         SLS,12   2                 BYTE ARRD
         LW,14    1
         LI,3     1
         AI,14    -1
GCLST    AI,14    1-X'10000'
         BGEZ     %+3
         AW,13    14
         AI,13    X'10000'
         STD,12   CLIST,3           STORE IN CLIST
         AI,12    X'10000'          ADJUST BUFFER ADDRESS
         AI,3     1
         BDR,14   GCLST
         LD,12    SENSE
         STD,12   CLIST,3           PUT SENSE AFTER WRITES
         LI,0     DA(CLIST)
         LW,6     M:SWAPD
         BAL,11   ERROREC
         DATA     2
         SLS,3    3
         AI,3     -8
         LI,11    5                 CHECKWRITE CODE
         STB,11   CLIST,3           PUT CHECKWRITES IN
         AI,3     -7
         BDR,3    %-2
         BAL,11   ERROREC
         DATA     4
         BCS,4    WDISC             TRY AGAIN IF BAD
NOCHKWRT LW,3     SENSW
         STW,3    DISCLOC           UPDATE DISCLOC
         MTW,0    S:DP
         BNEZ     %+2
         LH,3     3
         B        *10
         PAGE
*D*
*D*      NAME:    SPECIAL-I/O-ERROR-ROUTINES
*D*      ENTRY:   BADDP
*D*      ENTRY:   BADISC
*D*      ENTRY:   BADDPX
*D*      ENTRY:   FLAW
*D*      DESCRIPTION:  FORM AN APPROPRIATE MESSAGE & DISPLAY
*D*               IT TO OC DEVICE. THE MESSAGES DESCRIBE WHAT
*D*               IS WRONG WITH THE DESIRED SWAPPER(S) AS
*D*               FOUND ON THE TARGET MACHINE VERSUS WHAT
*D*               THE SYSTEM WAS SYSGENED FOR, IF THE TYPE
*D*               OF SYSGEN MAKES A DIFFERENCE.
*D*
*D*      BADDP -  SWAPPER IS NOT RECOGNIZED AS THE
*D*               ONE SYSGENED FOR.
*D*      BADISC - SWAPPER IS EITHER NOT AVAILABLE OR IS NOT
*D*               THE ONE SYSGENED FOR.
*D*      BADDPX - SWAPPER ADDRESS NOT RECOGNIZED.
*D*      FLAW -   SWAPPER HAS FLAWS.
*D*
*D*               FOR EACH OF THE ABOVE ERROR ROUTINES EXCEPT
*D*               FLAW, A NEW ADDRESS IS REQUESTED. IF NONE IS
*D*      GIVEN AND THE SWAPPER IS NOT THE
*D*               FIRST, THE OLD ADDRESS & ITS RESULTS IS
*D*               ACCEPTED AS IS. HOWEVER, IF A NEW ADDRESS IS
*D*               GIVEN, THE SWAPPER TESTS ARE RETRYED
*D*               USING THE NEW ADDRESS.
*D*
*D*      INPUT:   R1  = DCT INDEX
*D*
*D*      OUTPUT:  R9 = NEW ADDRESS (DEVICE)
*D*
*D*      INTERFACE:  OCMSG,DCINP,CT0,CT1,GETDC3.
*D*               TPCONV1,MSGWRT
*D*      REGISTERS:  R0,R2,R5,R8-R9,R12-R13 USED, R1,R7 SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
BADDP    EQU      %
BADISC   RES
         LH,3     DEVMOD#,1         PUT MODEL# IN MESSAGE
         SLS,3    16
         LI,4     BA(SWPM)+23
         BAL,11   TPCONV1
         LI,1     SWPM
         B        BADCMN
BADDPX   EQU      %
         LI,1     CDNOP             NOT OPERATIONAL
BADCMN   EQU      %
         XW,6     9                 SAVE 6, MOVE ADDR TI 6
         BAL,11   MSGWRT
         XW,6     9
         LB,1     MB:SDI,7          RESTORE DCTX
         BAL,5    DCINP
         CW,7     12                IF FIRST, MUST CHECK OUT
         BLE      CT0
         B        GETDC3            IF NOT, LET IT GO
FLAW     EQU      %
         LW,0     NSPT,4            IF NS PACK, ID DOESN'T MATTER
         CI,0     12
         BE       CT2
         LI,0     DA(FLOD)
         BAL,2    OCMSG
         B        %
         B        CT1
         PAGE
FILESMES LI,0     DA(FILEMSG)
         BAL,2    OCMSG
         B        RT
         PAGE
*D*
*D*      NAME:    FLD
*D*      DESCRIPTION:  OBTAIN 'DD' FIELD FROM BUF CONTAINING
*D*               THE INPUT ADDRESS OF 'NDD' & CONVERT IT
*D*               TO HEXADECIMAL.
*D*
*D*      CALL:    R8 = LINK
*D*
*D*      INPUT:   R2 = RELATIVE INDEX INTO BUF OF 'DD'
*D*                    CHARACTERS
*D*               R9 = CONVERTED VALUE FOR 'N'
*D*
*D*      OUTPUT:  R9 = CONVERTED 'NDD' IN HEXADECIMAL
*D*
*D*      INTERFACE:  EFLD.
*D*      REGISTERS:  R2,R9,R15 USED, R8 SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
FLD      EQU      %
         AI,2     1
         LB,15    BUF,2
         CI,15    'F'
         BG       %+2
         AI,15    '0'-'A'+10
         AI,15    -'0'
         BLZ      EFLD
         SLS,9    3
         BCS,4    EFLD              TOO MANY CHARS
         SLS,9    1
         AW,9     15
         B        FLD
         PAGE
*D*
*D*      NAME:    VALINP
*D*      ENTRY:   VALINP1
*D*      ENTRY:   DCINP
*D*      DESCRIPTION:  DCINP -  DETERMINE DEVICE DCT INDEX IF NEEDED
*D*               & THEN OUTPUT MESSAGE TO OC DEVICE
*D*               IDENTIFYING THE ORIGINAL DEVICE ADDRESS
*D*               FOLLOWED BY A REQUEST FOR INPUT OF THE
*D*               NEW DEVICE ADDRESS OR 'SA' IF NO CHANGE
*D*               IS DESIRED. THEN CONVERT THE 'N' FROM THE
*D*               'NDD' ACCORDING TO MACHINE TYPE (I.E.,
*D*               SIGMA VS. 560). THEN THE 'DD' IS OBTAINED
*D*               AND CONVERTED SUCH THAT THE 'NDD' BECOMES
*D*               A USEABLE DEVICE ADDRESS.
*D*
*D*      VALINP -- DETERMINES THE DCT INDEX FOR A DEVICE TYPE
*D*               & THEN ENTERS VALINP1.
*D*      VALINP1 - OBTAINS DOLD DEVICE ADDRESS PRIOR TO
*D*               ENTERING DCINP.
*D*
*D*      CALL:    R5 = LINK
*D*
*D*      VALINP --
*D*               INPUT:      R2 = DEVICE TYPE DESIRED
*D*               OUTPUT:     R1 = DCT INDEX
*D*
*D*      VALINP1 --
*D*               INPUT:      R1 = DCT INDEX
*D*                           R6 = 0 NO DEV.ADDR.CHANGE WANTED
*D*               OUTPUT:     R9 = OLD DEVICE ADDRESS
*D*
*D*      DCINP --
*D*               INPUT:      R1 = DCT INDEX
*D*               OUTPUT:     R9 = NEW DEVICE ADDRESS
*D*
*D*      INTERFACE:  MESSG,CL2PA,EOM,FLD.
*D*      REGISTERS:  R0-R3,R8-R13,R15 USED, R5 SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
*        USECT    TBOOT:
VALINP   LI,1     1
         LI,3     DCTSIZ
KRD2     CB,2     DCT4,1            DEVELOP DCTX BY TYPE CODE MATCH
         BE       VALINP1           DCTX FOUND
         AI,1     1
         BDR,3    KRD2              SEARCH ALL OF DCT4
         B        %                 ERROR-CANT BOOT
VALINP1  LH,9     DCT1,1            DEVICE ADDRESS
         CI,6     0
         BE       *5                DONT GET NEW
DCINP    LD,10    DCT16,1
         AI,10    X'1500'-X'4000'   BLANK TO NL
COCVAL   STD,10   DEVNOM
         LI,0     DA(DEVNO)
         BAL,10   MESSG             REQUEST NDD
         LH,9     DCT1,1            RESTORE OLD ADDR INCASE 'SA' AFTER EOM
         LI,12    X'FE2C1'          CHARS. 'SA'
         SH,12    BUF
         BE       *5
         LD,12    DCT16,1
         LI,9     X'FFF00'          UPDATE DCT16
         LW,8     BUF
         SLD,8    -8
         STS,8    13
         LB,R8    BUF               GET N
         BAL,R15  CL2PA             CONVERT CHAN LETTER TO PROC ADDR
         BCS,1    EOM               B/ BAD LETTER
         LW,R9    R8                NEED IT IN R9
         AI,R9    1                 TO PLAY WITH IT LATER
         LI,2     0
         BAL,8    FLD               GET DD
         AI,9     -X'100'
         BLZ      EOM
         LW,2     1                 CHANGE WHOLE  CHANNEL
         LH,8     DCT1,1
         LW,15    9
         OR,15    8                 IF DEVICE# IS 0
         AND,15   M4
         STB,15   8
VINP2    STD,12   DCT16,2
         STH,9    DCT1,2
         STH,9    DCT1P,2
         AI,2     1
         AI,9     1
         AI,8     1
         AI,13    1
         CH,8     DCT1,2
         BE       VINP2
         LH,9     DCT1,1            RESTORE THIS DEVICES INFO
         LD,12    DCT16,1
         B        *5
         PAGE
*F*
*F*      NAME:    ERROREC
*F*      PURPOSE:  PERFORM ACTUAL I/O WITH RECOVERY DURING
*F*               BOOT.
*F*
*D*
*D*      NAME:    ERROREC
*D*      ENTRY:   TPREC
*D*      DESCRIPTION:  ERROREC PERFORMS ALL OF THE I/O
*D*               WITH ERROR RECOVERY FOR THE BOOT STRAP
*D*               PROCEDURES. THIS INCLUDES: CARD READ,
*D*               LINE PRINT, TAPE READ, DISC/RAD WRITE
*D*               WITH OR WITHOUT CHECKWRITE.
*D*
*D*      TPREC -- TRY TO RECOVER TAPE READ ERROR.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   BAL +1 = DATA WORD CONTAINING CODE FOR
*D*                        TYPE OF I/O REQUESTED
*D*                           CODE = 0  TAPE READ
*D*                                = 1  CARD READ
*D*                                = 2  RAD/DISC WRITE
*D*                                = 3  PRINT LINE
*D*                                = 4  DISC CHECKWRITE
*D*                                 = 5  DISK SEEK-SENSE
*D*                                 = 6 DISK HEADER READ
*D*               R0 = DA(I/O COMMAND LIST FOR I/O)
*D*               R6 = DEVICE ADDRESS
*D*
*D*      INTERFACE:  MSGWRT,TPCONV.
*D*      REGISTERS:  ALL SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
ERROREC  EQU      %
         LCI      0
         STM,0    TSAVE
         LW,5     *11               GET CODE
         :SIO,1   *6                DO SIO
         BCS,4    NOSIO             NOGUDNIK
         LC       1                 GET STATUS
         BCR,1    MANUL             MANUAL
WAITLP   EQU      %
         WAIT     0                 WAIT FOR DISC OPERATIONS
WTELOP   :TIO,1   *6
         BCR,8    %+3
         BCR,4    WAITLP            BUSY IOP -- WAIT A WHILE
         BCS,4    NOPER             NO ADDR RECOG
         STH,1    RBC               SAVE REM BYTE COUNT
         SLS,1    2                 SHIFT SOME STATUS BITS A BIT
         BOD      WAITLP            STILL BUSY IF Y4 SHIFTED OFF
         LC       1                 NOW PICK UP SOME
         BCS,1    WAITLP            STILL BUSY IF Y04 WAS SET
         BCS,2    XITTBL,5          UNUSUAL END
         CI,5     5                 IF SEEK SENSE
         BNE      %+3               CHECK SENSE FOR WRITE PROTECT BIT
         LW,3     SENSW
         BLZ      WRTPRT
WTEXIT   RES
         CI,5     2
         BAZ      %+2               DONT RESET RETRIES IF
         BLE      %+3               TAPE BLOCK OR CHECKWRITE
         LI,2     -11
         STW,2    TRYCOUNT          RESET RETRY COUNT
         LCI      0
         LM,0     TSAVE
         MTB,0    11                IF SPECIAL EXIT
         BEZ      %+2               BUMP TWICE
         AI,11    1
         AI,11    1
         B        *11               GOOD RETURN
         B        TPREC             -1=TAPE BLOCK (ONE PAGE)
XITTBL   B        TPREC             0=TAPE
         B        LOGERR            1=CARD READER
         B        RDREC             2=DIXC
         B        PTREC             3=PRINTER
         B        RDREC             4=DISC (CHECKWRITE)
         B        RDREC             SEEK-SENSE
         B        RDREC             6=HEADER READ
NOSIO    :TIO,1   *6
         BCR,8    %+3
         BCR,4    RTNXIT            BUSY SIOP, RETRY
         B        NOPER             NO ADDR RECOG, WAIT FOR FIXIT
         LB,2     1                 STATUS BYTE
         CI,2     64
         BCS,4    RTNXIT            BUSY DEVICE
         CI,2     32
         BCR,4    RTNXIT            OPERATIONAL
NOPER    LI,1     CDNOP
         BAL,11   MSGWRT            MESSAGE
OPERINV  LW,11    C:TINC            WAIT FOR OPERATOR
         WAIT     0
         CW,11    C:TINC            BUT NOT THE CLOCK
         BNE      OPERINV
         B        RTNXIT            FIXED
TPREC    :TDV,1   *6
         LH,2     1                 STATUS BYTES
         CI,2     X'8020'           OVERRUN, IOP MEMORY
         BCS,4    TPNCOR            OVERRUN,UNCOR-READ,IOP MEMORY
         INT,1    1                 IF INCORRECT LENGTH, IGNORE IF 80 BYTES
         CI,1     2048-80
         BE       RTNXIT            AND RETRY
         CI,2     X'800'            IF UNCORRECTABLE
         BANZ     TPNCOR            DONT SENSE, SETCORR
         BCR,4    LOGERR            UNRECOVERABLE, TRY AGAIN
         LI,2     32                PARITY ERROR, TRY TO CORRECT
         STB,2    TPCOM1+1          SET CMND CHAIN
TPNCOR   LI,0     DA(TPCOM1)
         :SIO,0   *6
         :TIO,0   *6
         BCS,4    :A
         LI,2     0
         STB,2    TPCOM1+1          RESET
         B        RTNXIT0           RETRY
PTREC    :TDV,1   *6
         LH,2     1                 GET STATUS BYTES
         CI,2     X'2400'
         BCS,4    LOGERR            PAPER LOW OR RUNAWAY
         CI,2     X'4056'
         BCS,4    RTNXIT0           PARITY, RETRY
         B        LOGERR            UNRETRIABLE
RDREC    :TDV,1   *6
         LC       1
         BCR,7    RTNXIT0           RETRY IF NOT FLAW,WRTPRT,BADSEEK
         BCS,1    WRTPRT            WRITE PROPECT
         CI,5     6                 IF READ HEADER, WERE LOOKING FOR
         BNE      LOGERR            THIS TYPE OF ERROR
         STB,5    TSAVE+11          SET TO INCREMENT RETURN
         STW,1    TDV               SAVE STATUS FOR CHECKINF BY CALLER
         LC       1
         BCR,2    WTEXIT            IF FLAW, NO NEED TO RESTORE
         LI,0     DA(RCAR)          CARRIAGE
         :SIO,0   *6
         B        WAITLP
LOGERR   LI,1     CDMSGER
         CI,5     4
         BNE      LOGSTS            NOT CHECKWRITE
         LI,1     CDMSGCKW
LOGSTS   :TIO,3   *6
         LW,4     *1
         BAL,11   TPCONV            PUT IN MESSAGE
         :TDV,3   *6                GET TDV STATUS
         BAL,11   TPCONV            PUT IN MESSAGE
         :TIO,2   *6
         SLD,2    -15
         BAL,11   TPCONV
         BAL,11   MSGWRT            TYPE MESSAGE
         LI,1     -12
         STW,1    TRYCOUNT          RESET RETRY COUNT
         B        OPERINV           WAIT FOR OPERATOR
RTNXIT0  MTW,1    TRYCOUNT
         BGEZ     LOGERR            NO MORE RETRIES
RTNXIT   STW,5    COMRET            SAVE CODE
         LCI      0
         LM,0     TSAVE
         AI,11    1
         XW,11    COMRET
         CI,11    4
         BE       *COMRET           CHECKWRITE, GO BACK TO WRITE
         MTW,-2   COMRET
         B        *COMRET           GO BACK TO SIO
MANUL    LI,1     CDMSGMNL
         BAL,11   MSGWRT
MANUL1   EQU      %
         :TIO,1   *6                WAIT
         LB,2     1                 UNTIL
         CI,2     16                AUTO
         BAZ      MANUL1            THEN
         B        WTELOP            GO TO WAIT LOOP
WRTPRT   LI,1     CMDWRP
         LW,3     SENSW             OUTPUT SEEK ADDRESS
         AND,3    M31               SCRUB WRITE PROTEXT BIT
         LW,4     *1
         BAL,11   TPCONV
         BAL,11   MSGWRT
         B        OPERINV
         PAGE
*D*
*D*      NAME:    TPCONV
*D*      DESCRIPTION:  CONVERT 8 HEXADECIMAL DIGITS TO
*D*               EBCDIC & PUT INTO MESSAGE.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   (3)=LEFT ADJJUSTED INFO TO CONVERT
*D*               (4)=BYTE POINTER INTO MESSAGE FOR OUTPUT
*D*
*D*      OUTPUT:  CONVERTED (3) IN MESSAGE AFTER NEXT =, TERMINATED
*D*               BY NEXT CHAR <X'80'.
*D*
*D*      REGISTERS: 2-3 USED, 4 INCREMENTED TO CHAR AFTER OUTPUT
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
TPCONV   LB,2     0,4
         AI,4     1
         CI,2     '='
         BNE      TPCONV
TPCONV1  RES
         LI,2     0
         SLD,2    4                 GET ONE
         CI,2     9
         BLE      %+2
         AI,2     'A'-'0'-10        ALPHA
         AI,2     '0'
         STB,2    0,4
         AI,4     1
         LC       0,4
         BCS,8    TPCONV1
         B        *11
         PAGE
*D*
*D*      NAME:    MSGWRT
*D*      DESCRIPTION:  OUTPUT MESSAGE TO OC DEVICE.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   R1 = COMMAND LIST ADDRESS
*D*               R6 = DEVICE ADDRESS
*D*
*D*      REGISTERS: 0-4 USED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
MSGWRT   LW,0     1
         SLS,0    -1                DA(CLIST)
         LW,4     *1
         INT,3    6                 SCRUB WIERD BITS
         LI,1     DCTSIZ
         CH,3     DCT1,1
         BE       MSGWRT1
         BDR,1    %-2
         AI,4     3
         SLS,3    12                MAKE FUNNY YYNDD
         LW,1     11                SAVE RETURN
         BAL,11   TPCONV1
         LW,2     1
         B        OCMSG
TAB2BANG DATA     X'101A1A00'
MSGWRT1  LD,2     DCT16,1
         SLS,4    -2
         AW,2     TAB2BANG
         STD,2    *4
         BAL,2    OCMSG
         B        *11
         PAGE
*F*
*F*      NAME:    CL2PA
*F*      PURPOSE: CONVERT  'N' FROM 'NDD' ACCORDING TO
*F*               MACHINE TYPE, I.E., SIGMA VS 560.
*F*
*D*
*D*      NAME:    CL2PA
*D*      DESCRIPTION:  CONVERTS A CHANNEL LETTER
*D*               (I.E., 'N' FROM 'NDD') TO A PROCESSOR
*D*               ADDRESS USING STANDARD SIGMA (WHERE:
*D*               A=0, B=1, C=2,...ETC.) OR XEROX 560
*D*               CONVERSION.
*D*
*D*      CALL:    R15 = LINK
*D*
*D*      INPUT:   R8 = 'N'
*D*
*D*      OUTPUT:  R8 = CONVERTED VALUE IN BYTE-3
*D*               CC4 = 0 IF CONVERSION O.K.
*D*                   = 1 IF 'N' IS NOT LEGAL
*D*
*D*      REGISTERS:  R3,R8 USED, R15 SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
*        USECT    TBOOT:
*
CL2PA    EQU      %
         BIF,X560 CUCLCVT           USE X560 TABLE
         AI,R8    -'A'
         BLZ      BADLETTER
         CI,R8    16
         BG       BADLETTER         ALLOW ONLY A-P
         CI,R8    8
         BLE      %+2
         AI,R8    -7
GOODLETTER  EQU  %
         LCI      0
         B        *R15              RETURN
BADLETTER  EQU  %
         LCI      1
         B        *R15
CUCLCVT  EQU  %   CONVERSION FOR X560
         LI,R3    0
CUCLOOP  CB,R8    X560CUCL,R3       LOOK FOR MATCH
         BE       GOTN              GOT IT
         AI,R3    1                 NO, CONTINUE
         CI,R3    X560CUCLL         SIZE OF TABLE
         BLE      CUCLOOP           TRY NEXT
         B        BADLETTER         NOT IN TABLE, GRIPE
GOTN     LW,R8    R3                INDEX IS THE PROC ADDRESS
         B        GOODLETTER
         PAGE
*D*      NAME:    SEEKCVT
*D*      DESCRIPTION:  CONVERT DISC ADDRESS TO RELATIVE
*D*               SECTOR NUMBER.
*D*      CALL:    R11 = LINK
*D*      INPUT:   (DISCLOC)=SEEKADDRESS ON SWAPPER0
*D*      OUTPUT:  (8)=GENERALIZED DISC ADDRESS (DCTX+REL.SECTOR#)
*D*      REGISTERS:  R4,R8 USED, R2-R3,R5-R7 SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*
SEEKCVT  EQU      %
         LB,R4    MB:SDI            R4=DCT INDEX
         LCI      6
         STM,2    TSAVE             SAVE REGS
         LB,R4    DCT22,R4          R4=SUBTYPE TABLE INDEX
         LW,3     DISCLOC
         LI,R2    0
         LI,R5    32                R5=SHIFT OFFSET FOR DISK PACK
         MTW,0    NCYL,R4           CK CYL ALLOCATED DEV.
         BNEZ     CYL%CVT           YES PACK SPECIFIED
         LI,R6    32
         B        TRK%SEEK%CVT
CYL%CVT  EQU      %
         LI,R6    X'7F'
         AND,R6   CYL%SHFT,R4       GET CYL SHIFT FACTOR IN R6
         SW,R5    R6                R5=CYL SIZE
         SLD,R2   0,R5              R2=CYL # RIGHT JUSTIFIED
TRK%SEEK%CVT EQU  %
         LW,R7    R2                MOVE CYL # TO R7
         MW,R7    NSPC,R4           CYL # * NSPC
         LI,R2    0
         LI,R5    X'7F'
         AND,R5   TRK%SHFT,R4       GET TRK SHFT FACTOR
         SW,R6    R5
         SCD,R2   32,R6             R3=TRACK ADDR.
         LI,R6    X'7F'
         AND,R6   SEC%SHFT,R4       GET SECTOR SHIFT FACTOR
         SW,R5    R6
         SCS,R2   0,R5              MOVE SECTOR TO R2
         AW,R7    R2                CYL*NSPC+SEC
         MW,R3    NSPT,R4           TRK*NSPT
         AW,R7    R3                R7=RELATIVE SECTOR #
         LW,R8    R7                MOVE REL.SEC.# TO R8
         LCI      6
         LM,2     TSAVE             RESTORE REGS
         STH,4    8                 PUT DCTX IN FINAL RESULT
         B        *11               RETURN
         PAGE
SEGNO    DATA     -1
SEGSIZE  RES      1
YES      DATA,1   'Y','E','S',0
NO       DATA,2   'NO',0
CODES    TEXTC    'SDFTCPI'
1STMES   M        'ENTER ANY OF:',;
                  'I=TTY I/O',;
                  'P=LP OUTPUT',;
                  'F=TAPE FILES',;
                  'S=:SYS FILES',;
                  'T=TAPE PATCHES',;
                  'C=CARD PATCHES',;
                  'D=XDELTA - '
FILEMSG  M        'NEW FILE SYSTEM'
         BOUND    4
DFALTM   DATA,1   X'15','C','/','L'
         TEXT     'L/DC ASSIGN OK (YES/NO)'
SSWM     TEXT     '
SET SENSE SWITCHES AND TYPE N/L'
         TEXT     '
SSW1 => CHECKWRITE DISC WRITES'
         TEXT     '
SSW2 => NO AUTOMATIC LOGON/LOGOFF'
         TEXT     '
SSW3 => OPERATOR RECOVERY ON DISC BOOT'
         TEXT     '
SSW4 => SYSTEM SECURITY CHECKING'
SSWMSZ   EQU      BA(%)-BA(SSWM)
SWPM     M        '!!YYNDD NOT A 0000'
         BOUND    4
FLAWM    TEXT     ' PSA TRACK FLAW'
         BOUND    8
DEVNOM   TEXT     'XXXYYNDD'
         TEXT     ' => '
BUF      RES      3
RBC      RES      1
TDV      RES      1
CDMSGMNL M        '!!YYNDD MANUAL MODE'
CDMSGER  M        '!!YYNDD ERROR,TIO=00000000,TDV=0000,CMD=0000'
CDMSGCKW M        '!!YYNDD CKWRT ERROR,TIO=00000000,TDV=0000,CMD=0000'
CMDWRP   M        '!!YYNDD WRITE PROTECTED,SEEK=1234'
CDNOP    M        '!!YYNDD INOPERATIVE'
#PAGES   DATA     4                 START WITH FIRAT 8 SECTORS GONE
DISCLOC  DATA     X'4A0004'
SENSW    TEXT     'NOPE'
         RES      3                 USED BY SENSE
TRYCOUNT DATA     -11
COMRET   RES      1
TSAVE    RES      16
         BOUND    8
JCLIST   GEN,8,24,8,24  3,BA(JH:DA),X'2E',2
         GEN,8,24 2,0
         GEN,1,1,1,5,4,20 :DP,0,1-:DP,12,8,2048
DFALT    GEN,8,24,32  5,BA(DFALTM),28
FLOD     GEN,8,24,32  5,BA(FLAWM),15
DEVNO    GEN,8,24     5,BA(DEVNOM)+2
         PZE          *10           DATA CHAIN
         DATA         BA(DEVNOM)+3,2
SSW      GEN,8,24,32  5,BA(SSWM),SSWMSZ+1**29
         GEN,8,24,32  X'86',BA(BUF),1
DATCLST  GEN,8,24,32 5,4*INFOBUF,24
DATCLSTT GEN,8,24,32 5,4*INFOBUF,0   SIZE STORED IN
TREAD    GEN,8,24,32 2,4*INFOBUF,2048
INFOBUF  EQU      X'F000'
TPCOM1   GEN,8,24,32  75,BA(TPCOM1),1
         GEN,8,24,32  4,BA(SENSW),1**29+1
         GEN,8,24,32  3,BA(SENSW),1
CMND     COM,8,22,10,24 AF(1),AF(2),X'2E'-AFA(1)*32,AF(3)
WRCOM    CMND     0,1**20,0         ADDR,SIZE SET-SHIFTED BY WDISC
RCAR     CMND     X'33'
         CMND     *10,SENSW+1,8     READHEADER ONE SECTOR
WPCMD    CMND     3,SENSW,4
SENSE    GEN,8,24,32  4,BA(SENSW),X'1E000004'
CLIST    CMND     3,DISCLOC,4
         GEN,8,24 2,0
         GEN,8,24 X'2F',X'2000'
         GEN,8,24 8,DA(SENSE)
         RES      7
*
         BOUND    8
CMD      EQU      %
  GEN,8,24,8,24   3,BA(SEEK),X'2E',4
  GEN,8,24,32     4,BA(SENSW),16+X'2E'**24
  GEN,8,24,8,24   10,INFOBUF*4,X'1D',0 READHEADER SKIP SIZE STUFFED LATER
SEEK     RES      1
         PAGE
*
*   VECTOR OF CHANNEL LETTERS INDEXED BY X560 IOP ADDRESS
*
X560CUCL DATA,1   'A','%','#','@',':',0,0,0,;
                  'B','C','D','E','F','G',0,0,;
                  'H','I','J','K','L','M',0,0,;
                  'N','O','P','Q','R','S',0,0,;
                  'T','U','V','W','X','Y',0,0,;
                  'Z','0','1','2','3','4',0,0,;
                  '5','6','7','8','9','ž'
X560CUCLL  EQU  BA(%)-BA(X560CUCL)-1
         BOUND    4
*        USECT    TBOOT:
         PAGE
*****************
*  RECONFIGURATION MESSAGES, DATA, VECTORS, & IOCDWS
********
         SPACE    3
********
*  RECONFIGURATION FLAGS
:ENDFND  DATA     0                 =0, NO :END COMMAND
*                                   >0, :END FOUND
MSG:OUT  DATA     0                 =0, BAD CARD MESSAGE NOT OUTPUT
*                                   >0, BAD CARD MESSAGE HAS BEEN OUTPUT
********
*  I/O COMMANDS
         BOUND    8
BAD:CRD  EQU      %
         GEN,8,24 X'05',BA(:CRD)
         DATA     :CRDSZ
****
         BOUND    8
:CMND    EQU      %
         GEN,8,24 X'05',BA(CCBUF)
         DATA     80
********
*  MESSAGES
:CRD     EQU      %
         DATA,1   X'15'
         DATA,15  '** '':'' COMMAND '
         DATA,13  'NOT IN PATCH '
         DATA,13  'DECK PROPERLY'
         DATA,1   X'15'
:CRDSZ   EQU      BA(%)-BA(:CRD)
         BOUND    4
********
CCBUF    DATA,1   ' '
         DATA,3   0
         RES      20                TEMP.CARD IMAGE BUFFER
********
         BOUND    8
MVECRD   EQU      %
         GEN,8,24 0,0               ADDR.SUPPLIED
         GEN,8,24 80,BA(CCBUF)+1
********
*----------------
         PAGE
*****************
*  RECONFIGURATION INTERFACE ROUTINES
********
         SPACE    3
*****************
*F*
*F*      NAME:    RECNFG
*F*      PURPOSE: INTERFACE ROUTINE BETWEEN XDELTA &
*F*               RECONFIG PROCESSOR.
*F*
*D*
*D*      NAME:    RECNFG
*D*      DESCRIPTION:  ENTERED FROM XDELTA WHEN A ':'
*D*               COMMAND IS READ. RECNFG ENTERS RECONFIG
*D*               AT RECNFG:1 IF THE COMMAND HAS BEEN
*D*               ENCOUNTERED PRIOR TO THE FIRST MONITOR
*D*               PROCESSOR OR OVERLAY PATCH CARD OR
*D*               PRIOR TO THE ASTERISK (*) COMMAND.
*D*               IF ENCOUNTERED AFTER AN OVERLAY
*D*               OR PROCESSOR OR ASTERISK COMMAND HAS BEEN
*D*               FOUND, THEN A MESSAGE IS DISPLAYED ON THE
*D*               OC DEVICE & THE COMMAND IS IGNORED.
*D*               RECNFG THEN RETURNS TO XDELTA.
*D*
*D*      CALL:    R15 = LINK
*D*
*D*      INPUT:   R12 = CARD IMAGE BUFFER ADDRESS
*D*               R14 = ROUTINE IN XDELTA TO ENTER WHEN ADDING
*D*                     MESSAGES TO PATCH FILE AS COMMENTS.
*D*               R15 = RETURN ADDRESS INTO XDELTA
*D*
*D*      INTERFACE:  RECNFGLL,RECNFG:1,RECNFGOC.
*D*      REGISTERS:  R0,R6-R7,R10,R12-R13 USED, R15 SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
*****************
         SPACE    3
RECNFG   EQU      %           <---  ENTER
         LW,R13   M24
         SLS,R12  2                 PUT COMMANDS
         STS,R12  MVECRD              ADDR.INTO IOCDW
         SLS,R12  -2                MAKE WORD ADDR.AGAIN
         LD,R6    MVECRD
         MBS,R6   0                 XDELTA'S CARD IMAGE TO TEMP.BUFFER
         LI,R0    DA(:CMND)
         BAL,R10  RECNFGLL    ****  DISPLAY CARD IMAGE ON LL
         MTW,0    SEGNO             IF SEGNO = 0, ':' CARD IS PROCESSED
         BEZ      RECNFG:1    ****  PROCESS ':' COMMAND IN RECNFIG
*
*  RETURN FROM RECNFIG IS DIRECTLY INTO XDELTA
*
*        SEGNO > 0, ':' CARD NOT ACCEPTABLE AS RECNFIG IS
*        COMPLETED & RECNFIG PROCESSOR NO LONGER EXISTS
*
         MTW,0    MSG:OUT
         BNEZ     *R15   ---> YES-- RETURN TO XDELTA IF MESSAGE OUTPUTED
         MTW,1    MSG:OUT     NO--- SET FLAG & OUTPUT MESSAGE
         LI,R0    DA(BAD:CRD)
         BAL,R10  RECNFGOC    ****  MESSAGE TO OC
         LI,R10   '*'
         STB,R10  :CRD              CHANGE NL TO *
         MTW,-1   BAD:CRD+1         MESSAGE SIZE -1, NO NL AT END
         BAL,R10  RECNFGLL    ****  MESSAGE TO LL
         B        *R15        --->  RETURN TO XDELTA
*----------------
         PAGE
*****************
*D*
*D*      NAME:    RECNFGOC
*D*      DESCRIPTION:  OUTPUT MESSAGE TO OC DEVICE.
*D*
*D*      CALL:    R10 = LINK
*D*
*D*      INPUT:   R0 = DA(I/O COMMAND LIST)
*D*
*D*      REGISTERS:  R10 SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
*****************
         SPACE    3
RECNFGOC EQU      %           <---  ENTER
         :SIO,0   *OCNDD      IIOO
WAITOCX  EQU      %
         :TIO,0   *OCNDD      IIOO
         BCS,12   WAITOCX           WAIT TILL DONE
         B        *R10        --->  RETURN
*----------------
         PAGE
*****************
*F*
*F*      NAME:    RECNFGLL
*F*      PURPOSE: OUTPUT MESSAGE TO LL DEVICE.
*F*
*D*
*D*      NAME:    RECNFGLL
*D*      DESCRIPTION:  OUTPUT MESSAGE TO LL DEVICE IF
*D*               LISTING OUTPUT IS REQUESTED.
*D*
*D*      CALL:    R10 = LINK
*D*
*D*      INPUT:   R0 = DA(I/O COMMAND LIST)
*D*
*D*      INTERFACE:  ERROREC.
*D*      REGISTERS:  R6,R11 USED, R10 SAVED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
*****************
         SPACE    3
RECNFGLL EQU      %           <---  ENTER
         LC       BOOTFLG
         BCR,4    *R10        --->  RETURN, LISTING NOT DESIRED
         LW,R6    LLNDD
         BGZ      NOTLOSPD    NO--- LOW SPEED PRINTER
*                             YES-- DO 2 I/O'S
         BAL,R11  ERROREC     ****  DO I/O
         DATA     3
NOTLOSPD EQU      %
         BAL,R11  ERROREC     ****  DO I/O
         DATA     3
         B        *R10        --->  RETURN
*----------------
         PAGE
*F*
*F*      NAME:    CANTRUN
*F*      PURPOSE: OUTPUT A MESSAGE TO OC WHEN TARGET MACHINE
*F*               IS NOT EQUAL TO THAT FOR WHICH THE SYSTEM
*F*               WAS SYSGENED.
*F*
*D*
*D*      NAME:    CANTRUN
*D*      DESCRIPTION:  OUTPUT AN APPROPRIATE MESSAGE TO THE OC
*D*               DEVICE WHEN TARGET MACHINE IS NOT THE SAME
*D*               AS THAT FOR WHICH THE SYSTEM WAS SYSGENED.
*D*               THE BOOT PROCEDURE IS TERMINATED.
*D*
*D*      REGISTERS:  R0-R1 USED
*D*      ENVIRONMENT:  UNMAPPED, MASTER
*D*
CANTRUN  EQU  %
         LI,R1    BA(S7MSG)
         BIF,S7   GRIPE
         LI,R1    BA(S9MSG)
         BIF,S9   GRIPE
         LI,R1    BA(X560MSG)
GRIPE    STW,R1   WRNGMACH+2
         LI,R0    DA(WRNGMACH)
         BAL,2    OCMSG
         EXU      %
*
         PAGE
         BOUND    8
WRNGMACH  GEN,8,24  5,BA(CANTMSG)
         PZE      *26               DATA CHAIN,BYTE COUNT
         DATA     0                  BYTE ADDRESS OF MSG (FILLED IN)
         DATA     9                 BYTE COUNT
CANTMSG  DATA,2   X'1515','SY'
         TEXT     'STEM NOT SYSGENED FOR '
S7MSG    TEXT     'SIGMA 6  '
S9MSG    TEXT     'SIGMA 9  '
X560MSG  TEXT     'XEROX 560'
         PAGE
*F*
*F*      NAME:    BOOTENT
*F*      PURPOSE: DISC BOOT-STRAP ROUTINE ENTERED UPON AN
*F*               OPERATOR RECOVERY.
*F*
*D*
*D*      NAME:    BOOTENT
*D*      ENTRY:   BOOTS
*D*      DESCRIPTION:  RAD/DISC PACK BOOT-STRAP ROUTINE.
*D*
*D*               BOOTS - ENTERED UPON HARDWARE BOOT-STRAP.
*D*               BOOTENT - ENTERED UPON OPERATOR RECOVERY.
*D*
*
DBOOT    EQU      %
A        ASECT
         ORG      DBOOT
         LOC      A+X'2A'
BOOTS    RD,0     0
         BCR,2    BOOTENT           B/NOT OPERATOR RECOVERY
*S*      SCREECH CODE:        X'FFFF'
*S*      REPORTED BY:         DISC BOOT-STRAP ROUTINE
*S*      REMARKS:             DISC HARDWARE BOOT ATTEMPTED
*S*                           WITH SENSE SWITCH 3 SET,
*S*                           WHICH IMPLIES OPERATOR RECOVERY.
         SCREECH  -1                GO TO RECOVERY
BOOTENT  EQU      %
         LI,0     DA(DCDW)
         SIO,0    *37
         TIO,0    *37
         LI,0     15000
         BDR,0    %
         BCS,12   %-3
         B        *X'5F'
         BOUND    8
DABOOT   EQU      %-BOOTS+DBOOT
ROOTSA   DATA     0,0,0,0
DCDW     CMND     3,ROOTSA,4        SEEK
         CMND     2,X'5A',0         READ
         GEN,8,24   8,DA(BOOTIC)    TIC TO  CMMND DBLWD IN TABLES
*                                   BETTER BE IN 1ST 16K
         RES      22-(%-BOOTS)
         PAGE
*D*
*D*      NAME:    CLOCK
*D*      DESCRIPTION:  THIS ROUTINE OCCUPIES THE SAME SECTOR
*D*               ON THE SWAPPER AS THE DISC BOOT-STRAP & IS
*D*               ENTERED WHENEVER A ZAP KEYIN IS MADE. THE
*D*               ROUTINE PLAYS A TUNE WITH THE ALARM.
*D*
PITCH    EQU      500,472,446,421,397,375,354,334,315,297,281,265,;
                  250,236,223,210,198,187,177,167,157,149,140,132,;
                  125,118,111,105,99,94,88,83,79,74,70,66
BEAT     EQU      125
P        SET      0
B        SET      BEAT*12
MUSIC    CNAME
         PROC
I        DO       NUM(AF)
         DO       NUM(AF(I))=0
B        SET      B+BEAT
         ELSE
         GEN,16,16 B,P
P        SET      0
         DO1      AF(I)>0
P        SET      PITCH(AF(I))
B        SET      BEAT
         FIN
         FIN
         PEND
         LOC      0
         B        START,5
CLOCK    MTW,4    CLOKR
START    LW,2     CLOCK,5
         STW,2    X'55'
         AWM,5    REGS+ABSVAL(INTR),5
         LW,0     CLOKR
         LI,2     X'1000'
         WD,2     X'1200'
         CW,0     CLOKR
         BE       %-1,5
         LCI      5                 CLOBBER AL OF CORE (UP TO 64K)
         LM,6     5
         LM,0     5
         LM,11    5
         AI,1     MUS-16
CLEAR    AI,1     16
         LCI      0
         STM,0    0,1
         CI,1     X'10000'
         BL       CLEAR,5
         LCI      0
         LM,0     REGS,5
         B        2
REGS     EQU      %
         LOC      0
         RES      2
         LI,1     MUST-MUS
INTR     INT,14   MUS,1
         LW,0     15
         WD,0     X'42'
         BDR,0    %
CLOKR    B        %-3
         MTW,-4   CLOKR
         BDR,14   %-3
         BIR,1    INTR
         B        2
         LOC      ABSVAL(%)+ABSVAL(REGS)
MUST     EQU      %
         MUSIC    8,,5,1,,,5,,,8,,,13,,,,,,17,,15,13,,,5,,,7,,,8,,,,,0
         MUSIC    8,0,8,17,,,,,15,13,,,12,,,,,,10,,12,13,,0
         MUSIC    13,,,8,,,5,,,1,,,,,0
         MUSIC    8,,5,1,,,5,,,8,,,13,,,,,,17,,15,13,,,5,,,7,,,8,,,,,0
         MUSIC    8,0,8,17,,,,,15,13,,,12,,,,,,10,,12,13,,0,13,,
         MUSIC    8,,,5,,,1,,,,,0,17,,0,17,,,18,,,20,,0,20,,,,,0
         MUSIC    18,,17,15,,,17,,,18,,0,18,,,,,0
         MUSIC    18,0,18,17,,,,,15,13,,,12,,,,,,10,,12,13,,
         MUSIC    5,,,7,,,8,,,,,0,8,,,13,,0,13,,0,13,,12
         MUSIC    10,,0,10,,0,10,,,15,,,18,,17,15,13,0,13,,,12,,,,,
         MUSIC    8,,,13,,,,,15,17,18,,20,,,,,
         MUSIC    13,,15,17,,,,,18,15,,,13,,,,,,,,,,,
         GEN,16,16 B,P
MUS      EQU      %
         END

