*M*      DPSIO THE SWAPPER I/O INTERFACE FOR DISK PACK DEVICES
*P*      NAME:    DPSIO
*P*      PURPOSE: TO PERFORM THE CHECKS AND MODIFICATIONS TO THE
*P*               SWAPPER I/O TABLES NECESSARY FOR DISK PACK SWAPPING
*P*               AT I/O END-ACTION TIME, ERROR CONDITIONS ARE
*P*               EXAMINED AND APPROPRIATE ACTION TAKEN TO ASSURE
*P*               THAT A SUCCESSFUL SWAP HAS OCCURRED.
*P*
*P*      DESCRIPTION: CODE IN THIS MODULE IS PARTICULAR TO DISK PACK
*P*               SWAPPING SYSTEMS. SYSGEN REPLACES THE RAD
*P*               SWAPPING MODULE (TSIO) WITH DPSIO WHEN
*P*               THE SWAP DEVICE IS A DISK  PACK.
*P*               THE SWAP DEVICE IS TRANSPARANT TO THE SWAPPER
*P*               AS THE SWAP IS ORGANIZED. DISK PACKS HAVE THE
*P*               CYLINDER# FIELD IN THE DISK ADDRESS THAT'S NOT
*P*               PRESENT ON RADS AND THIS ACCOUNTS FOR THE DIFFERENCES
*P*               WHICH ARE CAPSULIZED IN THE DPSIO MODULE.
*P*
*P*               DPSIO PERFORMS ERROR CHECKS ON THE CL CHAIN.
*P*               THE CL AND DISC ADDRESS TABLES ARE THEN
*P*               MANIPULATED BASED ON THE ACTUAL SWAPPER OPERATION
*P*               THIS INCLUDES THE ELIMINATION OF UNNECESSARY SEEKS
*P*               AND INCLUDING THE CYLINDER#'S IN ADDRESSES.
*P*               THIS INFORMATION IS PASSED TO NEWQ
*P*               TO QUEUE UP THE REQUEST.  WHEN THE INTERRUPT
*P*               OCCURS AND PROCESSING IS COMPLETE, THE I/O SYSTEM
*P*               TRANSFERS CONTROL TO THE END ACTION ROUTINE IN
*P*               DPSIO. IF AN ERROR OCCURRED, THE I/O SYSTEM HAS
*P*               ENTERED A RECORD IN THE ERROR LOG FILE,AND PASSED
*P*               INFORMATION ABOUT THE ERROR TO THE END ACTION
*P*               ROUTINE. THE END ACTION ROUTINE WILL RETRY THE
*P*               CALL N TIMES, AND IF THAT FAILS IT WILL SET A USER
*P*               FLAG INDICATING THE ERROR AND CONTINUE IF POSSIBLE
*P*               CRITICAL ERRORS MAY RESULT IN A SOFTWARE CHECK.
*P*               IF THE I/O WAS SUCCESSFUL, DPSIO RETURNS TO
*P*               THE SWAPPER STILL ON END ACTION. HOWEVER, IF THE
*P*               FUNCTION PERFORMED WAS A WRITE,THE I/O SYSTEM IS
*P*               CALLED UPON TO DO A CHECK WRITE. IF THE FUNCTION
*P*               WAS READING A USER, A SOFTWARE READ CHECK IS DONE
*P*               BEFORE RETURNING TO THE SWAPPER.
*P*
         DEF      DPSIO:            PATCHING DEF
DPSIO:   EQU      %
UFLAGS   SET      1                 DEFINE USER FLAGS IN SYS UTS
BITS     SET      1                 REF CONSTANTS IN SYS UTS
UTSPROC  SET      1
         SYSTEM   UTS
*
*
DEBUG    SET      0
CLCK     SET      1
RDCK     SET      0
WTCK     SET      1
*
         REF      SWAP%PRI          NEWQ PRIORITY CODE
         REF      LOW               LOWEST AVAILABLE USER PAGE
         REF      HIGH              HIGHEST AVAILABLE USER PAGE
         REF      M:CLBGN           CLIST BEGIN TABLE
         REF      M:HLTIC           TIC TO SENSE COMMAND
         REF      M:WCKBCL          BEGIN CLIST FOR WRITE CHK
         REF      M:WCKECL          END CLIST FOR WRITE CHK
         REF      MH:2NDSK          TABLE OF CLIST DISP FOR SEEKS
         REF      SL:CORE           VIRT SIZE LIMIT
         REF      MB:#RTRY          NUMBER OF RETRIES TO DO
         REF      MB:SFC            SWAPPER FUNCTION CODE
         REF      MB:SDI            SWAP DEVICE DCT INDEX
         REF      JCLE              CLIST LENGTH IN JIT
         REF      JCLP              PTR TO END CLIST.
         REF      JCCL              SIZE OF JIT CLIST(WRDS)
         REF      JAJ               AJIT PHYS ADDRESS(PG #)
         REF      TSC1              END CLIST PTR
         REF      TSC2              WORD REPLACED BY TIC AT END CLIST
         REF      JCLPA             CLIST PHYS ADDRESS IN JIT
         REF      JCMAP             PHYS PAGE TABLE IN JIT
         REF      JCLT
         REF      S:UCYL
         REF      S:BECL            SWAPPER BUILT BEGIN/END CLIST
*,*                                 TABLE
         REF      S:ISUN            INSWAP USER NUMBER
         REF      S:JCL             JIT SHELL COMMAND LIST
         REF      S:SCL             PROCESSOR SHELL COMMAND LIST
         REF      SB:OSUL           OUTSWAP USER LIST
         REF      UB:C#             USER CYLINDER NUMBER
         REF      UX:JIT            USER JIT PAGE NR. TABLE
         REF      U:P#              OUTSWAP PROC LIST
         REF      UB:APO            USERS PROCESSOR OVERLAY NR.
         REF      UB:OV             USERS OVERLAY NR.
         REF      PX:HPP            PROCESSOR PAGE CHAIN HEAD
         REF      PB:PSZ            PROCESSOR PROCEDURE SIZE
         REF      P:SA              PROCESSOR FLAGS
         REF      SX:HPP            TEMP PROCESSOR PAGE CHAIN HD
         REF      MX:PPUT           PAGE TABLE
         REF      UH:FLG2           SETS SWAP ERR FLAGS
         REF      X1FE00            PHYS PAGE ADDR MASK
         REF      HGP               SWAPPER HGP ADDRESS
         REF      S:ECL             END COMMAND LIST TABLE
         REF      M:SWPEND          END PSA
         REF      M:SNSDA           SENSE BUFFER
         REF      S:BCL             BEGIN COMMAND LIST TABLE
         REF      SB:OSULT          TEMP OUTSWAP USER LIST
         REF      SB:NP             NUMBER OF INSWAP PROCESSORS
         REF      SB:PNL            INSWAP PROCESSOR LIST
         REF      SH:JAJDA          SHELL JIT DISC ADDRESS TABLE
         REF      PB:C#             PROCESSOR CYLINDER NR.
         REF      PB:DC#            PROCESSOR DATA CYLINDER NR.
         REF      PH:DDA            PROCESSOR DATA TRACK SECTOR
         REF      PH:PDA            PROCESSOR PROC TRACK SECTOR
         REF      S:JSP             INITIAL INSWAP FLAG
         REF      SCL%END           SHELL COMMAND LIST END
         REF      UB:APR            USER PROCESSOR NUMBER
         REF      UB:ASP            USER SPEC PROCESSOR NUMBER
         REF      UB:DB             USER DEBUGGER NUMBER
         REF      UB:PCT            USER PAGE COUNT
         REF      UH:AJIT           USER AJIT TRACK SECTOR NR.
         REF      UH:FLG            HIS FLAG WORD
         REF      Y03               TABLE CONSTANT
         REF      TSC3              INIT DATA/DCB CLIST START
         REF      TSC4              END CLIST DURING USER INSWAP.
         REF      XA                CONSTANT
         REF      XFFFF             CONSTANT
         REF      XFFFE00           CONSTANT
         REF      JDA               DISC ADDRESS TABLE IN JIT
         REF      DCT13             TDV INFO
         REF      DCT12             IO ADDRESS
         REF      NEWQ              TO DO I/O WITH COMMAND LIST.
         REF      SB:OSN            NUMBER OF OUTSWAP USERS
         REF      DOWTCK            SWITCH WRITE CHECK ON/OFF
         REF      SCLLIM            SHELL COMMAND LIST LIMITS
         REF      S:IOEA%ADR        RETURN ADDRESS FOR END ACTION
         REF      S:#SWAP%DEV       NUMBER OF SWAP DEVICES
*,*                                 TO DO I/O TO
         REF      S:C2SEEK          DISP TO 2ND CYL SEEK IN CLIST
         REF      ERRLOG            TO LOG ERRORS
         REF      TIME              TO GET TIME FOR ERROR LOG
         REF      SB:#TBL           SORTED USER/PROC NR
         REF      SB:XTBL           SORTED INDEX TABLE
         REF      SB:WST            TEMP TABLE FOR SORT
         REF      S:SWSTAT
         REF      UB:ACP            USERS COMMAND PROCESSOR
         REF      JXBUFVP           SPARE BUFFER LIRT PG
         REF      JAJITVP           AJIT VIRT PAGE
         REF      JDCBUL            DCB UPPER LIMIT IN JIT
         REF      JDCBLL            DCB LOWER LIMIT IN JIT
         REF      S:CYLSZ           # CYLS PER USER
*
         DEF      T:SENSE           DUMMY DISC SENSE ROUTINE
         DEF      T:SEXIT           EXIT TO SCHED OR INTERRUPT
         DEF      T:SIO             ENTRY FROM SWAPPER
         DEF      T:SIOEA           INTERRUPT ROUTINE
         DO1      RDCK
         REF      JHSWPCK           READ CHECKSUM IN JIT(NOT USED)
IOEA%ADR EQU      S:IOEA%ADR
#SWAP%DEV EQU     S:#SWAP%DEV
C2SEEK   EQU      S:C2SEEK
#TBL     EQU      SB:#TBL
XTBL     EQU      SB:XTBL
WST      EQU      SB:WST
*
         PAGE
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
         PAGE
*                                   INTERRUPT COMES IN
#RETRIES EQU      10
         BOUND    8
CFLGS    DATA     X'2C800800',X'FEFFFFFF'
JCLLIM   DATA     S:JCL,S:JCL+8
SJCLLIM  DATA     S:SCL,S:JCL+8
DPCMD    DATA     X'08800001'
*
* END ACTION JUMP TABLE
*
FCNSUBR  EQU      %-2
 DATA    RETRY    WRITE ERROR-RETRY
 DATA    WTCK0    WRITE OK-DO WRITE CHECK          1
 DATA    RETRY    READ ERROR-RETRY
 DATA    END      READ OK-DONE                     2
 DATA    WRTAGN   WRT CHK ERROR-REWRITE
 DATA    WTCK1    WRT CHK OK-CONTINUE WRT CHK      3
 DATA    RETRY    READ USER ERROR-RETRY
 DATA    RDCK0    READ USER OK-READ CHECK(SOFTWARE)4
         DO       RDCK
 DATA    RETRY    READ USER ERR REREADING-RETRY
 DATA    RDCK1    REREAD OK-CONTINUE READ CHECK    5
         FIN
*
*
*
*
*
*
SEEK     EQU      3
SENSE    EQU      4
L        EQU      11
*
*
         PAGE
************************************************************************
*                                                                      *
*        START I/O ON SWAP RAD                                         *
*        R15 = LINK = ADDRESS TO RETURN TO WHEN I/O                    *
*        R6 = COMMAND LIST ADDRESS                                     *
*                                                                      *
************************************************************************
T:SIO    EQU      %                                                    *
         NOP
         B        %,7
         PULL     4
         NOP                        READ-NO CK
         NOP                        READ-CK
         LW,R4    R14               SWAP DEVICE TABLE INDEX
         PUSH     4
         STW,15   IOEA%ADR
         STW,R6   M:CLBGN,R4        SAVE  BEGINING OF  CL ADDRESS
         STB,R7   MB:SFC,R4         SAVE   SWAP I/O FUNCTION CODE
*************************************
*   COMMAND LIST CHECKS
*************************************
         DO       CLCK
         DO       DEBUG
         B        %+3
         FIN
         RD,0     0
         BCR,1    T3                SKIP IF SW 4 RESET
         PUSH     6,R14
         LW,2     6
T4       LI,3     8
** A **
         LB,3    *2,3
         BNEZ     T4C
SCR0A    SCREECH  X'A'              SCREECH .A
T4C      CI,3     2
         BG       SCR0A
         AI,5     -1
T1       LB,1     *2                CHECK FOR SEEK
** B **
T2       EQU      %
         CI,1     4
         BE       T2C
         CB,1     DPCMD             IS IT DUMMY ORDER
         BE       T2C
T25      EQU      %
         CI,1     3
         BE       T2C
*S*      SCREECH CODE: 0B
*S*      REPORTED BY: DPSIO
*S*      MESSAGE: INCORRECT ORDER CODE IN SWAP COMMAND LIST
*S*      REGISTERS: 1=INCORRECT ORDER CODE
*S*                 2=COMMAND LIST ADDRESS
*S*                 6=BEGIN COMMAND LIST ADDRESS
*S*      REMARKS: DETECTED WHEN SS4 SET.
         SCREECH  X'B'              SCREECH .B
T2C      EQU      %
         AI,2     2
T26      EQU      %
         DO       DEBUG
         B        NOHILO
         FIN
         LW,1     0,2               CHECK BUFFER
         AND,1    M24
         SLS,1    -11
** C **
         CW,1     LOW
        REF      NPMC
         BGE      T35C
        CI,1     NPMC
         BE       T35B
*S*      SCREECH CODE: 0C
*S*      REPORTED BY: DPSIO
*S*      MESSAGE: ATTEMPT TO SWAP MONITOR MEMORY
*S*      REGISTERS: 1=BUFFER ADDRESS
*S*                 2=COMMAND LIST ADDRESS
*S*                 6=BEGIN COMMAND LIST ADDRESS
*S*      REMARKS: DETECTED WHEN SS4 SET.
SCR0C    SCREECH  X'C'              SCREECH .C
T35B     CI,3     2
         BE       SCR0C
T35C     CW,1     HIGH
         BG       SCR0C
NOHILO   EQU      %
         LB,1     *2
** A **
         CW,1     3                 ALL READ OR ALL WRITE
         BE       T35G
*S*      SCREECH CODE: 0A
*S*      REPORTED BY: DPSIO
*S*      MESSAGE: OPCODE IN SWAP COMMAND CHAIN IS INVALID
*S*      REGISTERS: 1=INCORRECT ORDER CODE
*S*                 2=COMMAND LIST ADDRESS
*S*                 6=BEGIN COMMAND LIST ADDRESS
*S*      REMARKS: DETECTED WHEN SS4 SET.
         SCREECH  X'A'              SCREECH .A
T35G     EQU      %
         AI,2     1
         LB,1     *2
         AI,2     -1
         CI,1     X'1C'             CHECK FOR NO CHAINING
         BE       DON1
         AI,2     2
T20      EQU      %
         LB,1     *2
         CW,1     3                 TEST FOR GRANULE GROUPING
         BE       T26               TRUE
         CI,1     8
         BNE      T2
         LW,14    0,2
         CW,14    M:HLTIC,4
         BE       DON1              END CLIST
         CW,14    Y008              WATCH FOR FLAG
         BANZ     T2C               IT'S A TIC %+2
         LW,2     14                TRACK DOWN TIC
         AND,2    M21
         SLS,2    1
         CLM,2    SJCLLIM           CHECK IF TIC TO SHELL OR JIT CLIST
         BCS,9    T26
         B        T1                CONTINUE
DON1     EQU      %
         LB,R2    MB:SFC,R4         I/O FUNCTION CODE
         BGZ      DON1C
SCR0F    SCREECH  X'F'              SCREECH .F
*S*      SCREECH CODE: 0F
*S*      REPORTED BY: DPSIO
*S*      MESSAGE: INPUT FUNCTION CODE IS INVALID
*S*      REGISTERS: 2=FUNCTION CODE
*S*      REMARKS:  DETECTED WHEN SS4 SET.
DON1C    CI,2     5
         BG       SCR0F
         PULL     6,R14
         FIN
         PAGE
*
* BRANCH TO APPROPRIATE CONVERSION ROUTINE
*
T3       EQU      %
         LI,R0    #RETRIES
         STB,R0   MB:#RTRY,R4        SAVE  # OF   RETRIES
         LI,L     T44               RETURN ADDR
         CI,7     1
         BE       OU                OUTSWAP
         CI,7     4
         BE       IU                SWAP IN USER
         CI,6     S:JCL
         BE       IJ                INSWAP JIT ONLY
         CLM,6    SCLLIM
         BCR,9    T43               INIT OR PROCS IN
         SCREECH  X'63'             SCREECH .63
T43      EQU      %
         LB,1     SB:NP
         CW,6     S:BCL,1           FIND CLIST ADDRESS
         BE       IP                PROCS TO BRING IN.
         BDR,1    %-2
*                                   OR INIT/DCB.
T435     EQU      %
         LW,1     TSC3
         AI,1     2                 START OF INIT CL
         CW,1     6
         BE       IU                SWAP IN INIT/DCBS
*S*      SCREECH CODE: 63
*S*      REPORTED BY: DPSIO
*S*      MESSAGE: INSUFFICIENT INFORMATION AVAILABLE TO
*S*               SWAP THIS USER
*S*      REGISTERS:  SEE LISTING
*S*      REMARKS:  THIS SCREECH CAN OCCUR FOR
*S*               SEVERAL REASONS,  PROBABLY CAUSED BY
*S*               BAD INPUT DATA FROM THE SWAPPER.
         SCREECH  X'63'             SCREECH .63
*
         PAGE
*
* CALL NEWQ AND EXIT
*
T44      EQU      %
         PULL     4
         LW,0     6                 ADDRESS OF COMMAND LIST TO R0      *
         SLS,0    -1                FORM DOUBLEWORD ADR
DO%IO    EQU      %
         LW,14    4                 PUT RADX IN 14
         BAL,11   SET%REG           SET REGS FOR NEWQ
DO%IO1   EQU      %
         BAL,R11  NEWQ              QUEUE UP SWAP I/O REQUEST
         NOP                        RETURN IS +2
T:SEXIT  EQU      %
         PULL     R11               GET LINK
         B        *11               BACK TO SWAPPER OR CLEANUP
         PAGE
*
*
T:SENSE  EQU      %
         STB,14   14                SIMULATE NEWQ CALL
         LI,10    0                 GET TRACK,SECTOR 0 ALWAYS
         B        *15
         PAGE
*
*        LOAD ARGUMENTS FOR NEWQ CALL
*        FUNCTION CODE OF 11 CAUSES SEEK WITH EXTERNAL COMMAND
*        LIST FOR FOLLOW ON.
*
SET%REG  EQU      %
         LW,R2    R14               GET SWAP RAD SPECIAL TABLE INDEX
         LB,1     MB:#RTRY,2        INCLUDE RETRY INFO IN E-A WORD
         AI,1     #RETRIES**8
         STB,R2   R1                INCLUDE SWP TBL NDX IN END INFO
         LB,R12   MB:SDI,R2         GET SWAP RAD DCT INDEX
         AI,12    X'100'            SET RETRIES TO 1 TO GET SEC ERR LOG.
         LI,13    SWAP%PRI+X'B00'  PRI AND FUNCTION CODE
         STH,13   12
         LW,R13   R0                COMMAND LIST ADDRESS
         SLS,0    1
         LW,2     *0
         SLS,2    -1
         LH,15    0,2               CYL NUMBER
         MW,15    S:CYLSZ
         SLS,15   1                 RELATIVE SECTOR ADDRESS
         STH,12   15
         LI,R14   1                 ONE 5 SEC TIME OUT INCREMENT
         LI,R0    T:SIOEA           MOST PROBABLE END ACTION ADDRESS
         B        *11               RETURN
         PAGE
*
*
SET%SCL  EQU      %
         LB,3     XTBL,1            TABLE INDEX
         LW,4     S:ECL,3           ADDRESS OF LAST CMD DW
         LW,5     M:HLTIC
         STW,5    0,4
         AI,4     -1
         LI,5     X'2C'
         STB,5    *4                ALWAYS COMMAND CHAIN
         LW,4     S:BCL,3           ADDRESS OF FIRST CMD DW
         B        SET%CL
SET%JCL  EQU      %                 ENTER HERE TO SET JIT CL
         LI,4     S:JCL
SET%CL   EQU      %
         LW,3     4
         LD,4     *4                BUILD ONE SEEK CDW
         LI,7     3
         STB,7    4                 SEEK ORDER
         LW,5     =X'2E000004'
         STD,4    *3
         SLS,4    -1                HWA
         AND,4    M23
         LH,7     0                 CYLINDER #
         STH,7    0,4
         AI,4     1
         STH,0    0,4               TRACK,SECTOR
         B        *L
*
         PAGE
*
*
* BUILD TABLE #TBL OR XTBL. #TBL IS USER OR PROC #'S
* ORDERED BY MAGNITUDE; XTBL IS THE INDEX OF THESE #'S INTO
* THE ARGUMENT TABLE (SB:OSULT OR SB:PNL).
*
REORDR   EQU      %
         LB,3     *7                7=INPUT TABLE ADDR
         AI,3     4
         SLS,3    -2
         LI,5     0
         STW,5    WST-1,3
         BDR,3    %-1
         LB,3     *7
         LI,2     1
RE0      EQU      %
         LB,1     *7
RE1      EQU      %
         LB,9     WST,1
         BEZ      RE3
         BDR,1    RE1
         SCREECH  X'63'             SCREECH .63
RE2      EQU      %
         CB,8     *7,1
         BLE      RE4
         LB,9     WST,1
         BNEZ     RE4
RE3      EQU      %
         LB,8     *7,1
         LW,4     1
RE4      EQU      %
         BDR,1    RE2
         CI,7     SB:PNL            CHECK FOR PROCESSOR INSWAP
         BNE      RE5
         LW,1     S:ISUN
         LH,5     UH:FLG,1
         LW,1     U:P#,1            OUTSWAP PROCESSOR NRS.
         CI,5     JIC
         BANZ     RE5               JIT IS IN, READ EVERY PROC.
         LI,5     -4                NOT IN, SELECT PROCS.
         CB,8     2,5               WAS THIS PROC OUTSWAPPED
         BE       RE6             YES.  DON'T READ IT IN.
         BIR,5    %-2
RE5      EQU      %
         STB,8    #TBL,2
         STB,4    XTBL,2
         AI,2     1
RE6      RES      0
         STB,2    WST,4
         BDR,3    RE0
         AI,2     -1
         STB,2    XTBL
         B        *L
*
         PAGE
*
*
*  REPLACE SEEK' WITH SENSE'S FROM (2) TO (3)
*
SSN      EQU      %
         SW,3     2
         BLEZ     *L                RETURN
         SLS,3    -1
SSN0     LB,15    *2
         CI,15    SEEK              SKIP IO COMMANDS
         BE       %+3
         CB,15    DPCMD
         BNE      SSN2
         LW,8     2
         SLS,8    -1                BUILD TIC TO %+2
         AW,8     DPCMD
         STW,8    0,2
SSN2     AI,2     2
         BDR,3    SSN0
         B        *L
*
         PAGE
*
*
*COMPUTE DISK ADDRESS FOR ALLYCAT'S JIT  OR DATA
*
*        (R0)=RELATIVE SECTOR #
*
ACATDA   EQU      %
         BNEZ     *L                CYL# IS NOT 0
         AI,0     4                 SECTOR BIAS
         CW,0     HGP+2             REL SECT# : SECTORS/TRACK
         BL       *L                REL SEC# = DA
         AI,0     X'100'            NEED A TRACK 1 ADDRESS
         SW,0     HGP+2             GET PROPER SECTOR #
         B        *L
*
         PAGE
*
*
OU       EQU      %
         PUSH     L
         LB,1     SB:OSN
         STB,1    SB:OSULT
         LI,2     1
         LB,3     SB:OSUL,1         MIRROR SB:OSUL IN SB:OSULT
         STB,3    SB:OSULT,2
         AI,2     1
         BDR,1    %-3
         LI,7     SB:OSULT          BUILD INDEX AND # TABLES
         BAL,L    REORDR            ORDERED BY # MAGNITUDE
OU1      EQU      %
         LB,1     SB:OSULT
OU11     EQU      %
         LB,1     #TBL,1            UUSR #
         LOAD,2   UX:JIT,1
         SLS,2    9
         MTB,0    UB:C#,1           SKIP ALLYCAT
         BEZ      OU11D
         LW,0     JCLT,2            WORD CLOBBERED BY TIC
         LW,7     JCLE,2            CLIST LENGTH
         BEZ      OU114             QUIT IF NO CLIST
         LW,4     JCLP,2            WAS TIC AT END CLIST
         AND,4    M24               CLEAN OFF FLAG BIT (Y8)
         CW,4     7
         BNE      OU11D             IF NOT, PP IS NOT GOING OUT.
         AW,7     JCLPA,2           IF SO, RESTORE CLOBBERED WORD
         STW,0    *7                SO EXTENDED CLIST IS RIGHT.
         LI,4     0
OU11F    STW,4    U:P#,1            CLEAR OUTSWAP PROCESSOR LIST.
         LW,15    SL:CORE
         MTW,0    JAJ,2
         BNEZ     %+3
         LI,15    JCCL
         DW,15    XA
         LB,13    UB:PCT,1
         SW,15    13                COMPUTE POTENTIAL MAX SIZE
         LW,13    WRFLGS
         ANLZ,4   OU11F
         SLS,4    2                 ADDRESS OF U:P# ENTRY
         LB,3     UB:OV,1
         BAL,9    CLST
         LH,12    UH:FLG,1
         CI,12    TIC
         BAZ      OU113
         LB,3     UB:ACP,1
         BAL,9    CLST
         LB,3     UB:ACP,1
         LW,3     P:SA,3
         AND,3    Y4      SPECIAL???
         BAZ      OU11B             CCI,EASY ETC
OU111A   LB,3     UB:APR,1
         BAL,9    CLST
         LB,3     UB:APO,1
         BAL,9    CLST
OU11B    EQU      %
         LB,1     SB:OSULT
         LB,3     XTBL,1            INDEX TO SWAPPER TABLES
         STW,7    S:ECL,3           SET END CLIST
         LW,3     7                 NEW END OF EXTENDED CLIST
         SW,3     JCLPA,2           LESS BEGIN CLIST
         STW,3    JCLP,2            PTR TO WORD CLOBBERED BY TIC
         LW,4     0,7               SAVE THAT WORD
         BNEZ     %+2               OR A CHEAP SUBSTITUTE.
         LW,4     Y02
         STW,4    JCLT,2
         B        %+2
OU11D    EQU      %
         LW,3     JCLE,2
         LW,2     JCLPA,2           LOWER LIMIT
         LW,4     2                 MIGHT NEED LATER
         PUSH     4
         AW,3     2                 UPPER LIMIT
         AI,2     2
         BAL,L    SSN               INSERT SENSE'S
         LI,0     4                 FIRST DATA SECTOR
         LB,1     SB:OSULT
         LB,2     #TBL,1
         LB,2     UB:C#,2
         BAL,L    ACATDA
         STH,2    0
         LB,1     SB:#TBL,1
         BAL,L    SET%CL
         PLW,4    TSTACK
         LI,L     OU111
OU11A    EQU      %
         MTH,0    UH:AJIT,1         CHECK FOR MORE THAN ONE CYLINDER
         BEZ      *11               NO AJIT, NO SECOND CYL.
         LW,2     S:UCYL
*
         AI,2     -1
*
OU11E    AI,2     -1
         BLZ      *L
         LH,7     MH:2NDSK,2        DISP TO NEXT SEEK COMMAND
         AW,7     4
         LI,5     S:C2SEEK          BUILD SEEK COMMAND
         AW,5     2
         SLS,5    2
         AW,5     Y03
         STW,5    0,7
         LW,5     FLGS
         STW,5    1,7               FLAGS
         PSW,4    TSTACK
         LD,4     CFLGS             SET COMMAND CHAIN/PRESERVE
         STS,4    *M24,7            SKIP BIT
         PLW,4    TSTACK
         LB,5     UB:C#,1           USERS CYL NR.
         AW,5     2                 INC TO NEXT CYL
         AI,5     1
         SLS,5    16
         STW,5    S:C2SEEK,2        STORE THE SEEK ADDRESS.
         B        OU11E
OU114    STW,7    U:P#,1            NO USER/PROCS GOING OUT.
OU111    EQU      %
         LB,1     SB:OSULT
         LI,0     2                 ALLOCATE TO PROPER CYL
         LB,5     SB:#TBL,1         USER NR.
         LB,3     XTBL,1
         LW,2     S:BCL,3
         AI,2     4                 IF AJIT => NOP JITS ENTRY
         MTH,0    UH:AJIT,5
         BEZ      OU112             NO AJIT.
         LI,3     2
         BAL,L    SSN0              INITIALIZE JIT CLIST
         LI,0     0
*NOTE: ALLYCAT IS ALWAYS ALLOCATED SWAPPING SPACE BEGINNING
*       AT CYL# 0,TRACK# 0,SECTOR# 4
OU112    EQU      %
         LW,3     CFLGS
         STW,3    *M24,2
         LB,2     UB:C#,5           CYLINDER NR.
         BAL,L    ACATDA            GET DISK ADDR
         STH,2    0
         BAL,L    SET%SCL           FORM SEEK CDW IN S:SCL
         LB,3     XTBL,1
         LW,6     S:BCL,3           CL ADDR FOR THIS USER
         PULL     L
         B        *L
*
OU113    CI,12    DIC
         BAZ      %+4
         LB,3     UB:DB,1
         BAL,9    CLST
         B        OU11B             DONE
         LB,3     UB:ASP,1
         BAL,9    CLST
         B        OU111A            COULD ALSO HAVE APR
*
*
CLST     BEZ      *9
         MODTST,0 PX:HPP,3
         BEZ      *9                PROC NOT IN.
         LB,0     PB:PSZ,3
         SW,15    0                 MAKE SURE PROC WILL FIT
         BLZ      *9                IT WON'T
         STB,3    0,4               SAVE OUTSWAP PROC #.
         AI,4     1
         LOAD,3   PX:HPP,3          PG CHAIN HEAD
CLST2    EQU      %                 INSWAP ENTRY POINT
         LI,11    2
CLST1A   LW,12    3
         CB,11    *7                WATCH FOR READ/WRITE ORDERS.
         BL       CLST1C            SKIP OTHERS.
         CI,9     IU3               IS IT INSWAP USER CALL
         BNE      %+2
         AI,12    X'2000'           YES, BUILD READ ORDER
         AI,12    X'2000'           OTHERWISE BUILD WRITE.
         SLS,12   11
         STD,12   *7                BUILD CLIST ENTRY
         CI,3     0                 BUILDING NULL CLIST
         BE       %+2               YES. THEN DON'T GET GARBAGE PGS
         LOAD,3   MX:PPUT,3
         AI,7     2                 INC CLIST PTR
         BDR,0    CLST1A
         B        *9
*
CLST1C   AI,7     2                 INC CLIST ADDRESS
         B        CLST1A
*
*
WRFLGS   DATA     X'8C800800'       READ WRITE FLAGS
SKFLGS   DATA     X'8D800800'       SKIP FLAGS
FLGS     DATA     X'2E000004'
*
         PAGE
*
*
IU       EQU      %
         PUSH     L
         PUSH     6
         LW,1     S:ISUN
IU0      EQU      %
         LH,0     UH:FLG,1
         CI,0     X'2800'           TEST FOR INIT &/OR DCBS
         BAZ      IU2
         LW,2     TSC3              INSERT SENSE'S
         AI,2     6                 START IF INIT CLIST..
         LI,3     SCL%END
         BAL,L    SSN
         LB,4     UB:ACP,1          GET CYL# OF INIT/DCBS
         CI,0     TIC
         BANZ     IU1
         LB,4     UB:APR,1
         BNEZ     IU1
         LB,4     UB:ASP,1
         CI,0     DELA
         BAZ      IU1
         LB,4     UB:DB,1
IU1      EQU      %
         LH,0     PH:DDA,4          BUILD DPA
         LB,1     PB:DC#,4
         STH,1    0
         LW,4     TSC3
         AI,4     2
         BAL,L    SET%CL
         LW,1     TSC3
         AI,1     2
         CW,1     *TSTACK
         BE       IUXT              DONT NEED TO DO JIT
         LW,1     S:ISUN            NEED TO DO JIT
IU2      EQU      %
         LI,0     4                 FIRST DATA SECTOR
         LB,2     UB:C#,1
         BAL,L    ACATDA
         STH,2    0
         LOAD,2   UX:JIT,1
         SLS,2    9
         LW,4     JCLPA,2
         BAL,L    SET%CL
         LW,7     JCLE,2
         LW,2     JCLPA,2
         AW,7     2
         LW,15    TSC2              WORD REPLACED BY TIC
         XW,15    *7                RESTORE IT AND SAVE TIC
         STW,7    8
         LW,14    U:P#,1            PROCESSOR OUTSWAPPED LIST
         LI,4     -4
IU4B     LW,13     WRFLGS
         LB,6     15,4              GET NEXT OUTSWAPED P#
         BEZ      IU4A              NO PROCESSOR OUT SWAPPED
         LB,3     SB:NP             NR. OF INSWAP PROCS
         BEZ      IU4A              DON'T NEED ANY PROCS INSWAPPED
         CB,6     SB:PNL,3          IS PROC COMING IN
         BE       IU1C
         BDR,3    %-2
         LW,13    SKFLGS            IT'S IN SO SET SKIP FLAGS.
IU1C     LB,0     PB:PSZ,6          PROCESSOR SIZE
         LOAD,3   SX:HPP,3          TEMP HEAD
         BAL,9    CLST2
IU3      CW,13    SKFLGS
         BE       %+2
         STW,7    8                 SET END OF OPERABLE CLIST
         BIR,4    IU4B              NEXT PROC
IU4A     STW,8    TSC1              SAVE END CLIST ADDRESS.
         STW,15   TSC2              REPLACED WORD
         STW,7    TSC4              SAVE ECL, INCLUDING PROCESSORS.
         LW,3     8
         AI,8     -1
         LI,15    X'2C'
         STB,15   *8
         AI,2     2
         BAL,L    SSN
         LW,4     *TSTACK
         BAL,L    OU11A             2ND SEEK MAY BE NECESSARY
         LW,15    *TSC1
         XW,15    TSC2              REPLACE WORD WITH TIC.
         STW,15   *TSC1
IUXT     PULL     6
         PULL     L
         B        *L
         PAGE
*
*
IP       EQU      %
         PUSH     L
         LB,1     SB:NP             FIND END OF PROC CL
         LW,3     S:ECL,1
         LW,2     S:BCL,1
         AI,2     2                 LOWER LIMIT
         BAL,L    SSN               CHANGE SEEKS TO SENSES..
         BDR,1    %-4               FOR EACH PROCESSOR..
IP0      EQU      %
         LI,7     SB:PNL
         BAL,L    REORDR            BUILD INDEX AND # TABLES
         BEZ      IP4             BR. IF ALL PROCS ELIMINATED.
IP1      EQU      %
         LI,1     1                 SWAP IN ASCENDING ORDER
         LB,2     #TBL,1            PROC #
IP11     EQU      %
         LH,0     PH:PDA,2          FORM DPA
         LB,3     PB:C#,2           PROC CYL #
         STH,3    0
         BAL,L    SET%SCL
         LB,2     XTBL,1            CHAIN IF MORE THAN 1
         LW,3     S:ECL,2
         CB,1     XTBL
         BE       IP3               LAST ONE
         AI,1     1
         LB,4     XTBL,1
         LW,5     S:BCL,4           START OF CL FOR NEXT PROC
         SLS,5    -1
         AW,5     Y08               TIC ORDER
         STW,5    0,3
         B        IP1+1
IP3      EQU      %
         LW,2     S:ISUN
         LH,0     UH:FLG,2          MAY NEED TIC TO JIT CL
         CI,0     X'200'
         BANZ     IPXT              JIT IS IN CORE
         LI,0     S:JCL
         SLS,0    -1
         AW,0     Y08
         STW,0    0,3
         BAL,L    IJ                SETUP FOR JIT INSWAP
IPXT     EQU      %
         LI,1     1
         LB,1     XTBL,1            FIRST PROC # TO COME IN
         LW,6     S:BCL,1
         PULL     L
         B        *L
*
IP4      LW,2     S:ISUN
         LH,0     UH:FLG,2
         CI,0     X'200'
         BAZ      IJ+1
         STW,3    U:P#,2
         B        IP0               CLEAR PROC LIST AND TRY AGAIN
         PAGE
*
*
IJ       EQU      %
         PUSH     L
         LI,2     S:JCL+4
         LI,3     S:JCL+8
         BAL,L    SSN               DON'T REALLY NEED EVERY TIME
         LI,0     2                 CYL# 0,TRK# 0,SECTOR# 2
         LW,4     S:JSP
         BNEZ     IJ1+1             GET BLANK JIT
         LW,4     S:ISUN
         LH,2     UH:AJIT,4
         BEZ      %+2
         LI,0     0                 SECTOR 0 FOR AJIT
         LB,4     UB:C#,4
         BAL,L    ACATDA
IJ1      EQU      %
         STH,4    0
         BAL,L    SET%JCL
         LI,6     S:JCL
         PULL     L
         B        *L
*
         PAGE
************************************************************************
*                                                                      *
*        SWAP RAD I/O END ACTION ROUTINE                               *
*                                                                      *
************************************************************************
T:SIOEA  EQU      %                                                    *
         PUSH     11
         LB,R4    R14                SWAP  DEVICE TABLE  INDEX
RDCK%RTRY EQU     %
         LB,12    12
         CI,R12   1                  1 = NORMAL
         BE       IOK
         LD,2     S:SWSTAT          TDV STATUS SAVED BY HANDLER
         LI,12    0
IOK      EQU      %
         LW,8     2                 DCT13 STATUS
         LB,2     MB:SFC,4          FUNCTION CODE
         SLS,2    1
         AW,2     12
         LW,2     FCNSUBR,2
         B        *2
*
RETRY    EQU    %
         LB,3     MB:SFC,4
         MTB,-1 MB:#RTRY,4
         BEZ      N%ERRORS
         LW,0     15
         B        DO%IO
*
END      EQU      %
         MTW,-1   #SWAP%DEV         WAIT FOR END ACTION ON ALL DEVICES
         BNEZ     T:SEXIT           OTHERWISE RETURN IMMEDIATELY
         B        *IOEA%ADR
*
         PAGE
*
*
ENDWTCK  EQU      %
         MTB,-1   SB:OSULT
         BLEZ     ENDOU             ALL DONE WITH OUTSWAP USERS
         LI,1     1
         STB,1    MB:SFC,4
         PUSH     4
         LI,L     T44
         PUSH     L
         B        OU1
*
ENDOU    LB,1     SB:OSN            RESET SCL FLAGS FOR ALL OUTSWAP
         LW,3     S:BCL,1           USERS.
         LW,5     WRFLGS
         STW,5    3,3
         STW,5    7,3
         BDR,1    ENDOU+1
         B        *IOEA%ADR         RETURN (THERE'S ONLY ONE SWAPP DEVICE)
         PAGE
*************************************
*        SET UP WRITE CHECK         *
*************************************
*
WTCK0    EQU      %
         DO       WTCK
         MTW,0    DOWTCK
         BEZ      ENDWTCK
*  JUST COMPLETED WRT, IF WRT CK DESIRED, SET UP FOR IT
         LI,8     03                WRT CK FCN
         STB,R8   MB:SFC,R4
         LB,1     SB:OSULT
         LB,1     XTBL,1            GET SWAP INDEX NR.
         LI,10    -1                NOT SWAP DEVICE FAULT.
         LW,8     S:BCL,1
         STW,R8   M:WCKBCL,R4
         B        WTCK2
WTCK1    EQU      %
*  RESTORE FLGS IN SHELL CL
         LW,R7    M:HLTIC,R4        TIC TO HALT COMMAND
         AND,R7   XFFFF             ADDRESS ONLY
         SLS,R7   1                 WANT WA
         CW,R7    M:WCKBCL,R4       TEST IF DONE WITH WRITE CHECK
         BE       ENDWTCK
         LW,R5    M:WCKECL,R4
         LI,2     -4
         LI,8     X'2C'             RESTORE SHELL COMMAND LIST
         STB,8    *5,2
WTCK2    EQU      %
*  SET UP FOR NEXT SECTION OF WRT CK
         LI,12    08                TIC
         LI,14    SENSE
         LI,15    01                WRITE
         LI,8     05                WRT CK
         LW,R6    M:WCKBCL,R4
WTCK3    EQU      %
*  IF ORDER IS TIC, SET WTCK ORDER-IF NOT,FIND OUT IF JIT OR USER
         CB,12    *6                IS THIS TIC
         BE       WTCK35            ALL FOR NOW
         CB,15    *6
         BNE      %+2
         STB,8    *6                INSERT WRT CHK ORDER
         AI,6     2
         B        WTCK3
WTCK35   EQU      %
*  TIC - SAVE PRESENT POINTER TO CL & GET NEW
         LW,5     6                 SAVE PRESENT
         LW,6     0,6
         SLS,6    1                 WA(NEXT SECTION OF CL)
         AND,6    M22
*  WHAT IS 1ST ORDER AFTER TIC
         AI,5     2
         CW,5     6
         BE       WTCK3             SKIP TIC
         AI,5     -2
         CB,14    *6                IS IT SENSE
         BE       WTCK6
         LB,14    *6
         CI,14    01                CHECK FOR WRITE ORDER
         BE       WTCK65
         SCREECH  X'B'              SCREECH .B
WTCK6    EQU      %
         LW,14    0,5               ALL DONE TEST
         CW,14    M:HLTIC,4
         BE       WTCK7             DONE
*  USER CL ENCOUNTERED SO SET INTERRUPT FLGS IN PREV JIT CL
WTCK65   EQU      %
         LI,2     -4
         LI,14    X'1E'             SET NO DATA/CMD CHAINING
         STB,14   *5,2
WTCK7    EQU      %
         STW,R5   M:WCKECL,R4
         AI,6     -2                SET BCL AT SEEK IN USER CLIST
         XW,R6    M:WCKBCL,R4
         PUSH     4
         B        T44
         PAGE
*                                 *
*        WRT IF WRT CK FAILS      *
*                                 *
*        IF WRT CK XMISSION ERR, RE WRITE THEN WRT CK
WRTAGN   EQU      %
         LI,2     1                 WRT ORDER
         B        WRT2
WRT1     EQU      %
         PUSH     R11               SAVE CLEANUP LINK
         LI,2     5                 WRT CK ORDER
WRT2     EQU      %
         LB,14    14                RADX TO LO ORDR BYTE
         LW,R3    R15               COMMAND LIST ADR (RETURNED BY CLNUP)
         LW,R0    R15               SAVE FOR LATER
WRT3     EQU      %
         SLS,3    1
WRT4     EQU      %
         LB,1     *3
         CI,1     1                 IS IT WRITE ORDER
         BE       WRT6              YES,SET WRT CHK
         CI,1     5                 OR VICE VERSA
         BE       WRT6
         CI,1     3                 IS IT SEEK
         BE       WRT6-1            YES
         CI,1     SENSE
         BE       WRT5
         CI,1     8                 IS IT TIC
         BE       WRT4C
         SCREECH  X'63'             SCREECH .63
WRT4C    EQU      %
         LW,3     *3
         AND,3    M21
         B        WRT3
WRT5     EQU      %
         LW,4     0,3
         CW,4     M:HLTIC
         BE       WRT7              DONE
         SCREECH  X'93'
*        FOUND COMMAND TO CHANGE
         AI,3     2
WRT6     EQU      %
         STB,2    *3                SET WRT OR WRT CK ORDER
         AI,3     1
         LB,4     *3
         CI,4     X'80'             IS CHAINING SET
         BCR,4    WRT8              NO - FINISHED
         AI,3     1                 YES DO MORE
         B        WRT4
WRT7     EQU      %
WRT8     EQU      %
         LW,4     14                 GET RADX
         LD,8     S:SWSTAT          TDV STATUS W/ CLIST ADDR
         CI,2     5                 IS IT WRT CHK
         BE       RETRY             YES
         BAL,11   SET%REG           SETUP NEWQ CALL
         LI,R0    WRT1              END ACTION ADDRESS FOR WRITE
         B        DO%IO1            GO DO I/O
         ELSE
         B        END
         FIN
*
         PAGE
*        READ CHECK USER            *
*
*        IF LOW BYTE OF HALF WD SAVED IN CL IS USER #, THEN
*        A PHY PG HAD NOT BEEN ALLOCATED WHEN USER WAS WRITTEN
*        TO RAD,SO DON'T CHECK
*        OTHERWISE, CHECK THAT DA IN PHY PG IS SAME AS IN DA TABLE
*        AND IF OK RESTORE HALF WD OF PG SAVED IN CL
*
RDCK0    EQU      %
         DO       RDCK
         LI,8     5
         STB,8    MB:SFC,4          SET FCN TO RD CK
         LI,8     #RETRIES
         STB,8    MB:#RTRY,4
         B        RDCK2
*
RDCK1    EQU      %
         LW,10    M:WCKBCL,4        GET LAST ID
         LW,7     M:WCKECL,4
         LW,6     Y02
         STW,6    S:JCL+2           RESTORE READ ORDER
RDCK2 EQU      %
         FIN
         LW,6     S:ISUN
         LI,1     -3                DISP IN CL OF LOW BYTE OF DA
         LI,2     5                            OF HIGH
         LOAD,5   UX:JIT,6
         SLS,5    9
         DO       RDCK
         LW,6     5
         SLS,6    1
         AI,6     JHSWPCK
         FIN
         LW,13    TSC4              END OF CL.  AFTER PROCS.
         DO       RDCK
         CI,3     5                 IS IT RD OR CONT RD CK
         BE       SICK1             CONTINUE RD CK
         LH,10    0,6
         AND,10   M21
         FIN
         LW,7     JCLPA,5
         LW,14    7
         AND,14   XFFFE00
         AI,14    JDA
         SLS,14   2
         LW,15    M24
         STS,14   0,7
SICK1    EQU      %
         AI,7     2                 MEM ADR ENTRY OF CL
         LW,3     Y01
         AND,7    M22
         AND,13   M22
SICK2    EQU      %
         DO       RDCK
          REF  DORDCK
         LW,8     DORDCK
         BEZ      SICK6
*  LOOP, ONCE PER CL ENTRY IE PAGE
         CS,3     1,7               DON'T CHECK IF SKIP FLG SET
         BE       SICK6             YES, NO PHY PG ALLOC
         LW,5     0,7               GET BA OF MEM ADR
         SLS,5    -1
*        LH,8     RDCKDISP,5
         AND,8    M21
         CW,8     10                DOES PG ID=COMPUTED ID
         BE       SICK4             YES
         STW,10   M:WCKBCL,4        SAVE ID
         AI,6     1
         LH,10    0,6
         AND,10   M21
         CW,8     10                DOES ID = PURE P ID
         BE       SICK4             UH HUH
*READ CHECK ERROR-DO PARTIAL REREAD
*
         AI,7     -2
         STW,7    M:WCKECL,4
         LW,15    7
         SLS,15   -1
         LB,7     MB:SDI,4          IN CASE NO RETRIES LEFT
         STD,15   DCT13,7
         AW,15    Y08
         STW,15   S:JCL+2           TIC TO PARTIAL CL
         LI,15    DA(S:JCL)
         B        RDCK%RTRY
*  CHECK OK - RESTORE HALF WD TO PG
SICK4    EQU      %
         LB,8     *7,1              LOW BYTE
         LB,9     *7,2              HIGH BYTE
         SLS,9    8
         OR,8     9                 SAVED HALF WD
*        STH,8    RDCKDISP,5
SICK6    EQU      %
         LW,8     SH:JAJDA
         CB,8     X4
         BL       %+2
         AI,8     250               BUMP TO NEXT CYL #
         AI,8     2
         STW,8    SH:JAJDA
         AI,10    1
         AND,10   M21
         FIN
         DO       RDCK=0
SICK6    EQU      %
         FIN
         STS,2    1,7               CLEAR SKIP FLAG
         STS,2    3,7
         STS,2    5,7
         STS,2    7,7
         AI,7     10
         CW,7     13
         BLE      SICK2
         B        END
         PAGE
*        FLAG ERRORED USER
*
N%ERRORS EQU      %
         AND,8    M21               TDV INFO FROM DCT13
         SLS,8    1
         CI,3     2
         BL       N%W0              WRITE ERR
         BE       N%R0              READ ERR
         CI,3     4
         BL       N%W0              WRT CHK ERR
         B        N%R0              READ ER
*
N%R0     EQU      %
         LW,1     S:ISUN
*
N%R2     EQU    %
         CLM,8    SCLLIM
         BOL      N%R2C
*S*      SCREECH CODE: 96
*S*      REPORTED BY: DPSIO
*S*      MESSAGE:  UNRECOVERABLE I/O ERROR READING
*S*               SHARED PROCESSOR.
*S*      REGISTERS: 8=COMMAND LIST ADDRESS FROM TDV STATUS
         SCREECH  X'96'             SCREECH .96
N%R2C    CLM,8    JCLLIM
         BOL      N%R5
*
*      ERROR READING JIT OR AJIT
         LH,9     UH:FLG2,1
         OR,9     X1                BAD JIT
         STH,9    UH:FLG2,1
         B        END
*
*        TEST FOR ERROR OUTSIDE OF USER CLIST AREA
N%R5     LOAD,2   UX:JIT,1
         SLS,2    9                 GET PHYSICAL LIMITS OF CLIST
         LW,12    JCLPA,2
         LW,13    JCLPA,2
         AW,13    JCLE,2
         CLM,8    12
         BOL      N%W5F             SC93 IF OUT OF LIMITS.
*
*        ERROR READING USER
         LB,12    *8
         CI,12    2                 IS IT READ ORDER
         BE       N%R6+1            YES
         CI,12    X'08'             IS IT ERROR ON TIC
         BE       N%R6
         SCREECH  X'A'              SCREECH .A
*
N%R6     EQU      %
         AI,8     2
         LW,12    *8
         AND,12   M24
         SLS,12   -11
         LOAD,9   UX:JIT,1
         SLS,9    9
         AI,9     JCMAP
         LI,10    2
         LI,2     JXBUFVP
         LI,13    JAJITVP+1
*
N%R7     EQU      %
         COMPARE,12   *9,2
         BE       N%R8              YES
         AI,2     1
         CW,2     13
         BNE      N%R7
         CI,2     JAJITVP+1         END SPARES OR JITS
         BNE      N%R9              NO.. END DCBS...
         LI,2     JDCBUL-JCMAP
         LW,13    *9,2              UPPER LIMIT OF DCBS
         AI,13    1
         LI,2     JDCBLL-JCMAP      BEGIN SEARCHING FOR
         LW,2     *9,2              ERROR IN HIS DCBS
         CW,2     13                ANY DCBS TO CHECK
         BNE      N%R7              YES
N%R9     EQU      %
         LI,10    4
*
N%R8     EQU      %
         LH,12    UH:FLG2,1
         OR,12    10
         STH,12   UH:FLG2,1
         AI,8     1
         LB,12    *8
         CI,12    X'20'             IS THERE CHAINING
         BAZ      END               NO
         AI,8     1
         LI,12    #RETRIES
         STB,12   MB:#RTRY,4
N%R81    EQU      %
N%W10    EQU      %
         SLS,8    -1
         LW,0     8
         LW,14    4
         BAL,11   SET%REG           SETUP NEWQ CALL
         OR,13    Y4                WITH EXTERNAL CLIST
         B        DO%IO1            GO TO NEWQ
         PAGE
*
N%W0     EQU      %
         LW,9     X1FE00
         LB,1     SB:OSUL
         LI,10    4                 ASSUME DATA ERROR
*
N%W3     EQU      %
         LD,12    S:BECL,1
         CW,8     12
         BL       N%W5              ERR NOT IN S:SCL
         AI,12    7
         CW,8     12                IS IT BTWN BCL,BCL+7
         BG       N%W4              YES
         LI,10    1                 NO. SET JIT ERROR FLAG
         B        N%W6
*
N%W4     EQU      %
         CLM,13   SCLLIM
         BCR,9    N%W5
         CS,8     13
         BE       N%W6
*
N%W5     EQU      %
         BDR,1    N%W3
*S*      SCREECH CODE: 93
*S*      REPORTED BY: DPSIO
*S*      MESSAGE:  TDV COMMAND ADDRESS DOSN'T POINT TO
*S*               COMMAND LIST.
*S*      REGISTERS: 8=COMMAND LIST ADDRESS FROM TDV.
*S*                 12,13=COMMAND LIST LIMITS.
*S*      REMARKS:  OCCURS AFTER UNRECOVERABLE I/O ERROR
N%W5F    SCREECH  X'93'
*
N%W6     EQU      %
         LB,1     SB:OSUL,1
         LH,12    UH:FLG2,1
         OR,12    X4
         STH,12   UH:FLG2,1
         LI,12    #RETRIES
         STB,12   MB:#RTRY,4
         LW,12    M:HLTIC,4
         AND,12   XFFFF
         SLS,12   1
         CW,8     12                FINISHED YET
         BE       END
         LB,12    *8                ORDER CODE
         CI,12    3
         BL       N%W7              ITS A READ OR WRITE
         CI,3     3
         BE       %+3
         LW,13    M:WCKECL,4
         AI,13    -2
         CW,8     13
         BE       WTCK1             LAST IOCD IN CHAIN
*
N%W7     EQU      %
         LI,1     2
*
N%W8     EQU      %
         AI,8     2
         LB,13    *8
         CI,13    3
         BE       N%W10
         CB,13    DPCMD
         BE       N%W10
         CI,13    SENSE
         BE       N%W10
         CI,13    8
         BE       N%W10
         BDR,1    N%W8
*S*      SCREECH CODE: 94
*S*      REPORTED BY: DPSIO
*S*      MESSAGE:  COMMAND LIST CLOBBERED DURING WRITE CHECK
*S*      REGISTERS: 8=COMMAND LIST ADDRESS
*S*      REMARKS: CANT FIND SEEK OR TIC WITHIN NEXT FIVE
*S*               COMMAND LIST ENTRIES.  OCCURS AFTER
*S*               UNRECOVERABLE ERROR DURING WRITE OR WRITE
*S*               CHECK.
         SCREECH  X'94'             SCREECH .94
*
N%W9     EQU      %
         AI,8     2
         END

