         DEF      RBSSS:            FOR XDELTA SYMBOL
RBSSS:   EQU      %
*
*
*M*      RBSSS    REMOTE PROCESSING COMMON CODE MODULE
*
*
*P*      NAME:    RBSSS
*P*
*P*      PURPOSE: CONTAINS ROUTINES USED BY ALL OF THE REMOTE
*P*               PROCESSING HANDLERS:  DSCIO (7670), HASPIO (IRBT)
*P*               AND 2780IO (2780) AND IS INCLUDED IN ALL
*P*               SYSTEMS SUPPORTING ONE OR MORE OF THESE TYPES
*P*               OF REMOTE PROCESSING.
*P*
*P*      DESCRIPTION:
*P*               RBSSS CONTAINS THE SIX ROUTINES DESCRIBED BELOW
*P*               WHICH ARE USED BY EACH OF THE REMOTE PROCESSING
*P*               HANDLERS:
*P*
*P*               1)  RBSS:  THIS ROUTINE IS CALLED BY CLOCKI
*P*                   AT THE FIVE SECOND MARK.  FOR EACH RP LINE
*P*                   IT CALLS THE FIVE SECOND CLOCK ROUTINE IN
*P*                   APPROPRIATE HANDLER.  THESE ROUTINES VARY IN
*P*                   USE FROM IRBT'S DIAL UP CHECKER TO 7670'S
*P*                   LINE MANAGER.  THE CALLED ROUTINES IN TURN
*P*                   CALL RB%TDV WHICH DETECTS NEW DIAL UPS (AND
*P*                   REPORTS THEM TO RBBAT) AND NEW HANG UPS.  WHEN
*P*                   THE CALLED ROUTINES COMPLETE THEY EXIT TO
*P*                   NXT%DEV WHICH PROCEEDS TO THE NEXT RP LINE.
*P*
*P*               2)  RBSGCQ (RBSGCQP):  THIS ROUTINE IS USED IN
*P*                   THE HANDLERS TO COMPLETE THE SETUP OF THE
*P*                   REGISTERS AND CALL RBBAT TO REPORT DUP, HUP,
*P*                   AND LORR. (SEE RBBATM)
*P*
*P*               3)  RB%CU:  THIS IS THE COMMON HANDLER BACKEND
*P*                   CHECKER ROUINE.  IT SETS UP HANDLER REGISTERS
*P*                   AND REPORTS TO THE HANDLER WHETHER THE LINE
*P*                   HAS DISCONNECTED, THE OPERATION HAS TIMED
*P*                   OUT, OR EVERYTHING IS OK.  REG%SET IS ALSO
*P*                   USED BY THE HANDLER FRONT ENDS.
*P*
*P*               4)  RB%PREX:  THIS IS THE COMMON HANDLER FRONT
*P*                   END EXIT TO COMLIST.  IT CORRECTS THE I/O
*P*                   ADDRESS OF THE LINE FOR FULL DUPLEX OPERATIONS.
*P*
*P*               5)  RB%LGER:  THIS IS THE COMMON RP ERR LOGGER
*P*
*P*               6)  RBQCK:  THIS IS THE IOQ INTERCEPT FOR SYMBIONT
*P*                   I/O TO RP DEVICES.  IRBT AND 2780 I/O'S ARE
*P*                   SENT TO BSCIO FOR DISPOSITION, WHILE THOSE FOR
*P*                   7670 ARE ALLOWED TO CONTINUE THROUGH IOQ.
*P*
*P*      REFERENCE:
*P*               THE REMOTE PROCESSING TABLES ARE DESCRIBED IN
*P*               DATA BASE TECHNICAL MANUAL.  THE RROUTINES IN RBSSS
*P*               ARE USED BY HASPIO,BSCIO, DSCIO, AND 2780IO
*P*
*
*
************************************************
* RBSSS IS THE COMMON CODE MODULE FOR ALL THE  *
*REMOTE PROCESSING HANDLERS (2780IO,HASPIO,    *
*DSCIO) IT CONTAINS THE CLOCK AND IOQ CALLED   *
*ROUTINES AND SOME OTHERS USED BY ALL THE      *
*HANDLERS  -- SMK                              *
************************************************
         SYSTEM   SIG7P
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
*
*
*
         DEF      HASPBIT           RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 IRBT LINE
         DEF      SSSBIT            RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 SUSPEND AND SWITCH SYMBIONT
         DEF      RBXBIT            RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 HANG LINE UP (RBX)
         DEF      OADBIT            RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 KEEP RBX'ED AFTER DISCONNECT
         DEF      OFFBIT            RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 DISABLE 5 SEC SCHEDULING
         DEF      LIPBIT            RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 LOGON IN PROGRESS
         DEF      ACTBIT            RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 TERMINAL LOGGED ON
         DEF      DISCBIT           RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 DISCONNECT AFTER OUTPUT DONE
         DEF      LOFBIT            RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 LOGGING OFF
         DEF      MORBIT            RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 CONTINUE READING ON THIS I/O
         DEF      FRBIT             RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 FIRST READ OF JOB STREAM
         DEF      BPBIT             RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 BLOCK PROTECT TOGGLE
         DEF      DUPBIT            RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 1=> FULL DUPLEX
         DEF      EMBIT             RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 1=> DONT PUNCH EM
         DEF      ALBIT             RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 RBLOG KEYIN DONE
         DEF      DCBIT             RB:FLAG BITS - SEE D.B. TECH MANUAL
*,*                                 WSN SPECIFIED BY SYSGEN
*
         DEF      RBSS              CALLED BY THE 5 SECOND CLOCK
*,*                                 CALLS APPROPRIATE LINE MNGR.
*,*                                 FOR LINE TYPE
         DEF      NXT%DEV           RETURN POINT FOR 5 SECOND CLOCK
*,*                                 ROUTINES
         DEF      RB%TDV            PERFORMS TDV ON RP LINE - REPORTS
*,*                                 DISCONNECTS AND CONNECTS TO RBBAT
         DEF      RBSGCQ            CALLS SGCQ USING DCTX IN R1
         DEF      RBSGCQP           PUSHES R1 AND CALLS RBSGCQ
         DEF      RBSGCQ1           CALLS SGCQ WITH DCTX IN R7,
*,*                                 STORES BITS INTO RB:FLAG FROM
*,*                                 R11 IF SUCCESSFUL - EXITS TO
*,*                                 NXT%DEV
         DEF      RB%CU             HANDLER BACKEND COMMON CODE FOR
*,*                                 RP HANDLERS
         DEF      REG%SET           RB:FLAG=>R13,DCT7=>R7,IOQ5=>R5
         DEF      RB%PREX           RP HANDLER FRONTEND COMMON
*,*                                 CODE - MANAGES DUAL DEV ADDRS FOR
*,*                                 FULL DUPLEX
         DEF      RB%LGER           LOG RP ERROR IN ERRLOG
         DEF      RBQCK             CALLED BY IOQ TO WEED OUT IRBT
*,*                                 AND 2780 SYMBIONT CALLS AND PASS
*,*                                 THEM TO BSCIO (RBQCKH)
*
         REF      Y8                RB:FLAG BIT - BPBIT
         REF      Y4                RB:FLAG BIT - IGBIT
         REF      Y2                RB:FLAG BIT - MORBIT
         REF      Y1                RB:FLAG BIT - HUBIT
         REF      Y08               RB:FLAG BIT - PUNBIT
         REF      Y04               RB:FLAG BIT - DCBIT
         REF      Y02               RB:FLAG BIT - HASPBIT
         REF      Y01               RB:FLAG BIT - SLVBIT
         REF      Y008              RB:FLAG BIT - ALBIT
         REF      Y004              RB:FLAG BIT - XP1BIT
         REF      Y002              RB:FLAG BIT - 2780BIT
         REF      Y001              RB:FLAG BIT - IBMBIT
         REF      Y0008             RB:FLAG BIT - DIALBIT
         REF      X1                RB:FLAG BIT - FRBIT
         REF      XN2               CHANGES DEV ADDR FROM ODD TO EVEN
*
         REF      DCT1P             I/O:  DCVICE ADDRESS - CHANGED FOR
*,*                                 FULL DUPLEX LINES
         REF      DCT3              INPUT:  X'10' BIT SAYS I/O TIMED OUT
         REF      DCT7              INPUT:  CLIST D.W. ADDRESS
         REF      DCT13             INPUT:  TDV STATUS Y02 SET SAYS
*,*                                 LINE HUNG UP
         REF      IOQ5              INPUT:  USED TO SET UP R5 FOR
*,*                                 HANDLERS
         REF      RBLIMS            INPUT:  USED FIND RP DCT INDICES
         REF      RB:FLAG           I/O:  RBSSS KNOWS ABOUT ALL BITS -
*,*                                 USES DUP,ACT,LIP,HASP,2780,HU,CTR,
*,*                                 AND OFF. - RBSGCQ1 STS'ES IN
*,*                                 WHATEVER THE CALLER HAS IN R11
         REF      RBD:WSN           INPUT:  WSN FOR ERRLOG ENTRY
         REF      S:RBBRN           INPUT:  FLAG = 1 WHEN BOOT OR
*,*                                 RECOVERY COMPLETE
         REF      DUP               INPUT:  RBBAT GFC FOR DIAL UP
         REF      TDV760X           CALLED:  TO DO OR SIMULATE TDV
*,*                                 DEPENDING ON WHETHER DEVICE IS ON
*,*                                 AN FECP
         REF      TSTACK            ??:  TO PUSH AND PULL
         REF      COMLIST           CALLED:  TO MAKE FINAL PRE-HANDLER
*,*                                 EXIT FROM RB%PREX
         REF      ERRLOG            CALLED:  TO PUT ENTRY IN ERRLOG
*,*                                 BY RB%LGER
         REF      SGCQ              CALLED:  TO REPORT EVENTS TO RBBAT
*,*                                 BY RBSGCQ,RBSGCQ1, AND RBSGCQP
         REF      Q15A              CALLED:  TO RETURN TO IOQ FROM
*,*                                 RBQCK IF IO IS NOT IRBT OR 2780
         REF      IOSERCK           CALLED: BY RB%CU TO CHECK FOR 760X
*,*                                 DEVICE ERRORS.
         REF      IOSCU             CALLED:  TO EXIT AND REPORT ERRORS
*,*                                 IF ERRORS ARE FOUND BY IOSERCK
*
         SREF     RBQCKH            CALLED:  WHEN SYMBIONT I/O'S FOR
*,*                                 IRBT'S AND 2780'S ARE FOUND IN RBQCK
         SREF     D%SSET            CALLED:  BY RBSS IF THE LINE IS
*,*                                 A 7670 LINE
         SREF     H%SSET            CALLED:  BY RBSS IF THE LINE IS
*,*                                 AN IRBT LINE
         SREF     27SSS             CALLED:  BY RBSS IF THE LINE IS
*,*                                 A 2780 LINE
         SREF     DCT26             INPUT: FEDX OF DEVICE ON FECP IN
*,*                                 FECP SYSTEMS
         SREF     FDB:FEX           INPUT: FEX INDEXED BY FEDX IN FECP
*,*                                 SYSTEMS
         SREF     FE:CRD            INPUT: FECP FLAGS IN FECP SYSTEMS
         SREF     FECPRDY           INPUT: FECP READY FLAG - RBSSS WAITS
*,*                                 FOR THIS TO BE SET TO RUN IF DEVICE
*,*                                 IS ON AN FECP
*
*
*
*
FRBIT    EQU      X1
OBBIT    EQU      1
EMBIT    EQU      2
FINBIT   EQU      4
LIPBIT   EQU      8
SSSBIT   EQU      X'10'
FIABIT   EQU      X'20'
OADBIT   EQU      X'40'
XP2BIT   EQU      X'80'
CTRBIT   EQU      X'100'
ACTBIT   EQU      X'200'
CLKBIT   EQU      X'400'            RB:FLAG BIT DEFINITIONS
HALBIT   EQU      X'800'
SYSBIT   EQU      X'1000'
LOFBIT   EQU      X'2000'
DISCBIT  EQU      X'4000'
DUPBIT   EQU      X'8000'
RBXBIT   EQU      X'10000'
OFFBIT   EQU      X'20000'
EDISBIT  EQU      X'40000'
DIALBIT  EQU      Y0008
IBMBIT   EQU      Y001
2780BIT  EQU      Y002
XP1BIT   EQU      Y004
ALBIT    EQU      Y008
SLVBIT   EQU      Y01
HASPBIT  EQU      Y02
DCBIT    EQU      Y04
PUNBIT   EQU      Y08
HUBIT    EQU      Y1
MORBIT   EQU      Y2
IGBIT    EQU      Y4
BPBIT    EQU      Y8
HUCTOFBT DATA     X'10020100'
BSCBITS  DATA     X'02200000'
*
*
*F*      NAME:    RBSS
*F*
*F*      PURPOSE: CALLS THE APPROPRIATE 5 SECOND CLOCK ROUTINE FOR
*F*               EACH REMOTE PROCESSING LINE
*F*
*
*
RBSS     EQU      %                 CLOCK DRIVEN ROUTINE DRIVER
         LW,R8    S:RBBRN           :
         BEZ      *R14              RBSS IS CALLED BY CLOCKI EVERY
         PSW,R14  TSTACK            5 SECONDS
         LW,R7    RBLIMS+1          :
TRY%DEV  EQU      %                 IF WE ARE NOT UP YET EXIT
         LW,R13   RB:FLAG,R7        :
         CW,R13   HUCTOFBT          FOR EACH RB DEVICE THAT DOES NOT
         BANZ     NXT%DEV           HAVE HUBIT,CTRBIT OR OFFBIT SET
         LI,R1    DCT26             CALL THE APPROPRIATE CLOCK HANDLER
         BEZ      TR%DV1            ROUTINE
         LB,R1    DCT26,R7          :
         BEZ      TR%DV1            IF THE DEVICE IS ON AN FECP DON'T
         LB,R1    FDB:FEX,R1        MESS WITH IT UNLESS THE FECP IS
         LW,R1    FE:CRD,R1         RUNNING
         CI,R1    FECPRDY
         BAZ      NXT%DEV
TR%DV1   EQU      %
         CW,R13   2780BIT
         BANZ     27SSS
         CW,R13   HASPBIT
         BANZ     H%SSET
         B        D%SSET
*
*
*F*      NAME:    RB%TDV
*F*
*F*      PURPOSE: EXECUTES A TDV ON A REMOTE PROCESSING LINE AND
*F*               INFORMS THE CALLER WHETHER IT IS STILL CONNECTED.
*F*               IF IT DETECTS A LINE CONNECTED THAT WAS NOT
*F*               CONNECTED PREVIOUSLY, IT REPORTS REMOTE TERMINAL
*F*               DIAL UP TO RBBAT AND EXITS FOR THE CALLER.
*F*
*
*
RB%TDV   EQU      %                 CHECK FOR HANG UP - DIAL UP
         LW,R1    R7                :
         BAL,R6   TDV760X           IF TDV CCS OR DSRDY SAY HANGUP
         BCS,8    0,R5              EXIT 0,5 IF TERM IS THERE AND
         CW,R9    Y02               WE HAVE ALREADY SEEN DIAL UP EXIT
         BANZ     0,R5              1,R5  IF THIS IS THE FIRST NOTICE
         CI,13    ACTBIT+LIPBIT     OF DIAL UP TELL RBBAT AND DONT
         BANZ     1,R5              RETURN
         LI,R12   DUP               :
RBSGCQ1  LW,R1    R7                NOTE THAT WHEN THIS IS CALLED
         STS,R15  RB:FLAG,R7
         BAL,R4   RBSGCQ            FROM RB%CU BELOW ACTBIT OR LIPBIT
         STS,R14  RB:FLAG,R7        MUST BE SET -- IF NOT RBBAT BUG
*
*
*F*      NAME:    NXT%DEV
*F*
*F*      PURPOSE: ADVANCES TO NEXT REMOTE PROCESSING LINE DURING
*F*               5 SECOND CLOCK ROUTINE (RBSS) - EXIT FOR HANDLER
*F*               5 SECOND CLOCK ROUTINES.
*F*
*
*
NXT%DEV  EQU      %
         AI,R7    -1
         CW,R7    RBLIMS
         BGE      TRY%DEV
         PLW,R14  TSTACK
         B        *R14
RBSGCQP  EQU      %                 CALL RBBAT PUSHING 1
         PSW,R1   TSTACK
RBSGCQ   EQU      %                 CALL RBBAT
         SLS,R1   8                 :
         OR,R12   R1                DCT INDEX TO RITE SPOT IN R12
         B        SGCQ
*
*
*F*      NAME:    RB%CU
*F*
*F*      PURPOSE: SETS UP REGISTERS FOR REMOTE PROCESSING HANDLER
*F*               BACKENDS - CHECKS FOR CONTROLLER ERRORS VIA
*F*               IOSERCK - INFORMS THE CALLER WHETHER THE I/O
*F*               COMPLETED OK, THE I/O TIMED OUT, OR THE LINE
*F*               HAS DISCONNECTED.
*F*
*
*
RB%CU    EQU      %                 COMMON HANDLER BACKEND CODE
         LB,R5    DCT3,R1           :
         CI,R5    X'10'             IF WE HUNG UP EXIT 0,R4
         BANZ     HNDL%TO           :
         BAL,R6   TDV760X           IF WE TIMED OUT EXIT 1,R4
         CW,R9    Y02               :
         BAZ      %+3               IF ALL NORMAL EXIT 2,R4
         LW,R9    R4                :
         B        REG%SET           EACH WITH R5=CUR FC,R13=RB:FLAG
         BAL,R9   IOSERCK           R7=CLIST DA
         B        IOSCU             :
         BAL,R9   REG%SET           IOSERCK IS CALLED TO CHECK FOR
         B        2,R4              RARE REAL DEVICE OR IOP ERRORS
HNDL%TO  EQU      %
         BAL,R9   REG%SET
         BAL,5    RB%TDV+1
         B        0,R4
         LB,R5    IOQ5,R3
         B        1,R4
*
*
*F*      NAME:    REG%SET
*F*
*F*      PURPOSE: SETS UP REGISTERS FOR REMOTE PROCESSING HANDLERS:
*F*               R13 = (RB:FLAG) , R5 = (IOQ5) , R7 = (DCT7)
*F*
*
*
REG%SET  EQU      %
         LW,R13   RB:FLAG,R1
         LH,R7    DCT7,R1
         LB,R5    IOQ5,R3
         B        *R9
*
*
*F*      NAME:    RB%PREX
*F*
*F*      PURPOSE: EXITS TO COMLIST FOR REMOTE PROCESSING HANDLER
*F*               FRONTENDS, CORRECTING DEVICE ADDRESS FOR FULL
*F*               DUPLEX LINES WHICH HAVE TWO DEVICE ADDRESSES.
*F*
*
*
RB%PREX  EQU      %                 COMMON FRONTEND EXIT TO COMLIST
         CI,R13   DUPBIT            :
         BAZ      COMLIST           IF HALF DUPLEX JUST EXIT
         LH,R9    DCT1P,R1          :
         AND,R9   XN2               IF FULL PUT EVEN - ODD BIT
         OR,R9    R0                FROM R0 INTO DEV ADDR TO
         STH,R9   DCT1P,R1          SELECT CORRECT DEV CHANNEL
         B        COMLIST
*
*
*F*      NAME:    RB%LGER
*F*
*F*      PURPOSE: SETS UP REGISTERS AND CALLS ERRLOG TO LOG REMOTE
*F*               PROCESSING LINE ERRORS.
*F*
*
*
RB%LGER  EQU      %                 LOG RP LINE ERROR
         LCI      2                 :
         PSM,R12  TSTACK            SEE RP REF FOR DESC OF
         LW,R9    R13               ERRLOG RECORD
         LH,R7    DCT7,R1
         LD,R12   *R5,R7
         LD,R10   RBD:WSN,R1
         LH,R7    DCT1P,R1
         LI,R6    X'2608'
         STH,R6   R7
         LI,R6    R7
         BAL,R5   ERRLOG
         LCI      2
         PLM,R12  TSTACK
         B        *R12
*
*
*F*      NAME:    RBQCK
*F*
*F*      PURPOSE: CALLED BY IOQ TO LOOK AT ALL I/O'S THAT HAVE REMOTE
*F*               PROCESSING DCT INDICES.  RETURNS FOR 7670 CALLS.
*F*               CALLS RBQCKH IN BSCIO FOR 2780 OR IRBT.
*F*
*
*
RBQCK    EQU      %                 IOQ ENTRY FOR INTERCEPT
         LW,4     BSCBITS           :
         CW,4     RB:FLAG,1         IF IRBT OR 2780 GO TO BSCIO TO
         BAZ      Q15A              SEE IF THIS SHOULD BE INTERCEPTED
         B        RBQCKH
         END

