         DEF      DPSIO:
DPSIO:   EQU      %
*  CREATED 29OCT71  JESSE FISHER
         SYSTEM   UTS
*
*
DEBUG    SET      0
CLCK     SET      1
RDCK     SET      0
WTCK     SET      1
         DEF      DPSIO
DPSIO    EQU      %
*
         REF      SWAP%PRI
*
         REF      ;
 LOW,;
 M7,;
 M24,M23,M22,M21,;
 M:CLBGN,;
 M:HLTIC,;
 M:WCKBCL,;
 M:WCKECL,;
 MB:#RTRY,;
 MB:SFC,;
 MB:SDI,;
 JBUPVP,;
 J:JIT,;
 JH:DA,;
 JCLE,;
 JCLPA,;
 JCMAP,;
 JCLT,;
 JJITVP,;
 M8,;
 S:BECL,;
 S:ISUN,;
 S:JCL,;
 SB:OSUL,;
 UX:JIT,PX:HPP,;
 UH:FLG2,;
 X1FE00,;
 Y01,;
 HGP,;
          SC2SK,;
 S:ECL,;
 S:BCL,;
 S:SCL,;
 SB:OSULT,;
 SB:NP,;
 SB:PNL,;
 Y02,;
 SH:JAJDA,;
 DCT8,;
 CJOB,;
 IOSERCK,;
 MSGOUT,;
 DCT11,;
 MSG3,;
 IOCLOCK,;
 PB:C#,;
 PB:DC#,;
 PH:DDA,;
 PH:PDA,;
 S:JSP,;
 SCL%END,;
 UB:APR,;
 UB:ASP,;
 UB:DB,;
 UB:PCT,;
 UH:AJIT,;
 UH:FLG,;
 Y03,;
 Y08,;
 TSC3
S:CYLSIZ EQU      S:CYLSZ
         SREF     S:CYLSZ,UB:C#
*
*
         REF      XFFFF
         REF      XFFFE00
         REF      JDA
         REF      Y4
         REF      Y1
         REF      DCT13
         REF      NEWQ
         DEF      T:SENSE
         DEF      T:SEXIT
         DEF      T:SIO
         DEF      T:SIOEA
         REF      RCVPSD
         REF      SB:OSN
         REF      HIGH
         REF      DOWTCK
         REF      SCLLIM
         REF      S:IOEA%ADR,S:#SWAP%DEV
         REF      S:C2SEEK
         REF      ERRLOG,TIME
         REF      SB:#TBL,SB:XTBL,SB:WST
         REF     UB:ACP
         DO1      RDCK
         REF      JHSWPCK
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
************************************************************************
*        SWAPPER I/O ERROR CODES                                       *
*        ***********************                                       *
*  INTERPRETATION OF                                                   *
*  BYTE IN REGISTER 15                                                 *
*                                                                      *
*         80          SENSE NOT = SEEK ON WRITE                        *
*         81          READ CHECK NOT SATISFIED                         *
*         82          WRT CK ERR - BAD ORDER ETC 7 = WHERE ERROR OCCURED
*         83          NOT DONE WITH CL ON WRITE BUT NO STATUS BITS SET *
*         90          DEV UNUSUAL END OR IOP HALT SET & NO OTHER BITS  *
*         91          WRT CHECK NOT IN SYSTEM BUT TRYING TO DO IT      *
*         92          IN LOGGING SECTOR, IOCD POINTS BAD               *
*        99       INSUFFICIENT DATA-CAN'T COMPUTE
*                                                                      *
*  0 1 2 3 4 5 6 7                                                     *
*                                                                      *
*  1                  SWAPPER IO ERRER                                 *
*                                                                      *
*    0 0              BITS 3-7 NOT STATUS INDICATORS BUT RATHER AS ABOVE
*    0 1              WRITE FCN    BITS 3-7 STATUS ERRORS AS BELOW     *
*    1 0              READ  FCN     '    '    '      '    '    '       *
*    1 1              WRT CK FCN    '    '    '      '    '    '       *
*                                                                      *
*        1            TRANSMISSION DATA ERROR -|                       *
*          1                '      MEM    '    |   THESE ARE           *
*            1        MEMORY ADDRESS      '     >  STRAIGHT FROM       *
*              1      IOP MEMORY          '    |   STATUS BITS 9-13    *
*                1    IOP CONTROL         '   -|                       *
************************************************************************
         PAGE
*                                   INTERRUPT COMES IN
#RETRIES EQU      5
*
* 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
*
*
*
*
*
         REF DPCMD
*
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
         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
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
         SCREECH  X'A'              SCREECH .A
T35G     EQU      %
         AI,2     1
         LB,1     *2
         AI,2     -1
         CI,1     X'4C'             CHECK FOR NO CC
         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,2     0,2
         CW,2     M:HLTIC,4
         BE       DON1              END OF CLIST
         AND,2    M21
         SLS,2    1
         B        T1                CONTINUE
DON1     EQU      %
         LB,R2    MB:SFC,R4         I/O FUNCTION CODE
         BGZ      DON1C
SCR0F    SCREECH  X'F'              SCREECH .F
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
         BEZ      T435              NO PROCS, HAS TO BE INIT
         LB,1     SB:PNL,1
         LOAD,1   PX:HPP,1
         BEZ      IP                PROCS TO BRING IN
T435     EQU      %
         LW,1     TSC3
         AI,1     2                 START OF INIT CL
         CW,1     6
         BE       IU                SWAP IN INIT/DCBS
         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,R15  SET%REG           SET REGS FOR NEWQ
         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
*
SET%REG  EQU      %
         LW,R2    R14               GET SWAP RAD SPECIAL TABLE INDEX
         STB,R2   R1                INCLUDE SWP TBL NDX IN END INFO
         LB,R12   MB:SDI,R2         GET SWAP RAD DCT INDEX
         LI,13    SWAP%PRI
         STH,13   12
         LW,R13   R0                COMMAND LIST ADDRESS
         OR,R13   Y4                FLAG TO IGNORE DISC PRE-HANDLER
         LI,R14   1                 ONE 5 SEC TIME OUT INCREMENT
         LI,R0    T:SIOEA           MOST PROBABLE END ACTION ADDRESS
         B        *R15              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
         STB,8    #TBL,2
         STB,4    XTBL,2
         STB,2    WST,4
         AI,2     1
         BDR,3    RE0
         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
         LCFI     2
         LM,8     DPCMD
         STM,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
         CI,1     1
         BE       OU0               ONLY 1 TO SWAP OUT
         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
         B        OU1+1
OU0      EQU      %
         LB,2     SB:OSUL,1
         STB,2    #TBL,1
         STB,1    XTBL,1
         B        OU11
OU1      EQU      %
         PUSH     L
         LB,1     SB:OSULT
OU11     EQU      %
         LB,1     #TBL,1            UUSR #
         LOAD,2   UX:JIT,1
         SLS,2    9
         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                 USER DATA STARTS AT SECT 4
         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      %
         LW,2     1
         LB,3     UB:PCT,2          TEST IF 2ND CYL NECESSARY
         MTH,0    UH:AJIT,2
         BNEZ     %+2
         AI,3     1
         CW,3     S:CYLSIZ
         BLE      *L
         LW,3     Y03
         AI,3     BA(C2SEEK)
         STW,3    SC2SK,4
         LW,3     =X'2E000004'
         STW,3    SC2SK+1,4
         LB,3     UB:C#,2
         AI,3     1                 2ND CYL #
         STH,3    C2SEEK
         B        *L
OU111    EQU      %
         LB,1     SB:OSULT
         LI,0     2                 ALLOCATE TO PROPER CYL
         LH,3     UH:AJIT,2
         BEZ      OU112
         LB,3     XTBL,1
         LW,2     S:BCL,3
         AI,2     4                 IF AJIT => NOP JITS ENTRY
         LW,3     2
         AI,3     2
         BAL,L    SSN
         LB,2     SB:#TBL,1
         LI,0     0
*NOTE: ALLYCAT IS ALWAYS ALLOCATED SWAPPING SPACE BEGINNING
*       AT CYL# 0,TRACK# 0,SECTOR# 4
OU112    EQU      %
         LB,2     UB:C#,2
         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
*
         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 UCR 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,3     JCLE,2
         LW,2     JCLPA,2
         AW,3     2
         AI,2     2
         BAL,L    SSN
IUXT     EQU      %
         PULL     6
         CW,1     6
         BE       IUXT1
         LW,4     6
         BAL,L    OU11A             2ND SEEK MAY BE NECESSARY
IUXT1    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..
         LB,1     SB:NP
         BDR,1    IP0               MORE THAN 1 PROC
         LI,1     1
         LB,2     SB:PNL,1          PROC #
         STB,2    #TBL,1
         STB,1    XTBL,1            INDEX INTO S:BCL,S:ECL
         B        IP11
IP0      EQU      %
         LI,7     SB:PNL
         BAL,L    REORDR            BUILD INDEX AND # TABLES
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     SB:NP
         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
*
         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     %
         CI,R12   1                  1 = NORMAL
         REF      DCT12,DCT16
         REF      M:SWPEND,M:SNSDA
         BE       IOK
         LW,8     DCT12,7           IO ADDRESS
         LI,3     X'1603'           ERROR LOG ENTRY CODE/COUNT.
         STH,3    8
         LW,9     TIME              TIME OF DAY
         INT,0    M:HLTIC,4
         LW,0     1                 ADDRESS OF SNSDA
         PUSH     14
         LB,14    14                DEVICE TABLE INDEX
         PUSH     10,11
         LW,12    M:SWPEND,4
         STW,12   M:SNSDA,4
         BAL,15   SET%REG
         LI,0     0
         MTH,-1   12
         BAL,11   NEWQ              SENSE
         NOP
         PULL     10,11
         BDR,0    %
         LW,10    M:SNSDA,4         SENSE INFORMATION
         CW,10    M:SWPEND,4
         BL       %+2
         LI,14    -1                IF NOT A SWAPPER SEEK ADDRESS
         LI,6     8
         BAL,5    ERRLOG
         LI,12    0
         PULL     14
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     END               ALL DONE
         LI,1     1
         STB,1    MB:SFC,4
         PUSH     4
         LI,L     T44
         B        OU1
*
         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
         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
         LB,8     *5
         AI,8     X'E'
         STB,8    *5
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
         CB,14    *6                IS IT SENSE
         BE       WTCK6
         LB,14    *6
         CB,14    DPCMD
         BE       WTCK65
         CI,14    SEEK
         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      %
         AI,5     -1                GET TO FLAGS
         LB,14    *5                SET NO CMD CHAINING
         AI,14    -X'E'
         STB,14   *5
WTCK7    EQU      %
         STW,R5   M:WCKECL,R4
         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       WRT5              YES
         CI,1     SENSE
         BE       WRT5
         CB,1     DPCMD
         BE       WRT5
         CI,1     8                 IS IT TIC
         BE       WRT4C
         SCREECH  X'63'             SCREECH .63
WRT4C    EQU      %
         INT,3    *3                YES-GET DA TO NEXT PART OF CL
         B        WRT3
WRT5     EQU      %
         LW,4     0,3
         CW,4     M:HLTIC
         BE       WRT7              DONE
*        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'20'             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   DCT13,7         TDV STATUS W/ CLIST ADR
         CI,2     5                 IS IT WRT CHK
         BE       RETRY             YES
         BAL,R15  SET%REG           LOAD REGS FOR NEWQ
         LI,R0    WRT1              END ACTION ADDRESS FOR WRITE
         BAL,R11  NEWQ              Q I/O REQUEST
         NOP                        +2 RETURN FROM NEWQ
         B        T:SEXIT           ALL FOR NOW
         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    JCLPA,5
         AW,13    JCLE,5            END OF CL
         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    %
         LI,15    X'96'             ERR READING PROCR
         CLM,8    SCLLIM
         BOL      N%R2C
         SCREECH  X'96'             SCREECH .96
N%R2C    CI,8     S:JCL
         BGE      N%R2F
         SCREECH  X'95'             SCREECH .95
N%R2F    EQU      %
         CI,8     S:JCL+8
         BG       N%R5
*
*      ERROR READING JIT OR AJIT
         LH,9     UH:FLG2,1
         OR,9     X1                BAD JIT
         STH,9    UH:FLG2,1
         B        END
*
*        ERROR READING USER
N%R5     EQU      %
         LB,12    *8
         CI,12    2                 IS IT READ ORDER
         BE       N%R6+1            YES
         CI,12    SENSE
         BE       N%R6
         SCREECH  X'A'              SCREECH .A
*
N%R6     EQU      %
         AI,8     2
         LW,12    *8
         SLS,12   -11
         AND,12   M8
         LOAD,9   UX:JIT,1
         SLS,9    9
         AI,9     JCMAP
         LI,10    2
         LI,2     JJITVP
*
N%R7     EQU      %
         COMPARE,12   *9,2
         BE       N%R8              YES
         AI,2     1
         CI,2     JBUPVP
         BNE      N%R7
         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
         SLS,8    -1
         LW,0     8
         B        DO%IO
         PAGE
*
N%W0     EQU      %
         LW,9     X1FE00
         LB,1     SB:OSUL
*
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
         BLE      N%W6              YES
*
N%W4     EQU      %
         CLM,13   SCLLIM
         BCR,9    N%W5
         CS,8     13
         BE       N%W6
*
N%W5     EQU      %
         BDR,1    N%W3
         SCREECH  X'93'             SCREECH .93; CAN'T FIND ERRD AREA
*
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%W9              ITS REAR OR WRITE
         CI,3     3
         BE       %+3
         CI,3     SENSE
         BNE      N%W7
         LW,13    M:WCKECL,4
         CI,12    5
         BNE      %+2
         AI,13    2
         CW,8     13
         BNE      %+2
         B        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
         SCREECH  X'94'             SCREECH .94
*
N%W9     EQU      %
         AI,8     2
N%W10    EQU      %
         SLS,8    -1
         LW,0     8
         B        DO%IO
         END

