         DEF      BSCIO:            FOR XDELTA SYMBOL
BSCIO:   EQU      %
*
*
*M*      BSCIO    BISYNC COMMON CODE MODULE
*
*
*P*      NAME:    BSCIO
*P*
*P*      PURPOSE: CONTAINS CODE COMMON TO IRBT AND 2780 SUPPORT
*P*               AND IS CONTAINED IN ANY SYSTEM HAVING EITHER OR
*P*               BOTH.  ONLY REAL USE IS TO MAKE MIXED SYSTEMS
*P*               SMALLER
*P*
*P*      DESCRIPTION:
*P*               BSCIO CONTAINS ROUTINES USED FOR ERROR LOGGING,
*P*               CRC CALCULATION, LINE HANDLING, BUFFER BUILDING
*P*               AND PARSING, AND LINE MANAGEMENT USED BY
*P*               HASPIO AND 2780IO.  VECTORS AT THE END OF THE
*P*               MODULE COULD EVENTUALLY BE USED TO SUPPORT
*P*               ADDITIONAL TYPES OF TERMINALS REQUIRING SIMILAR
*P*               PROCESSING
*P*
*P*      REFERENCE:
*P*               BSCIO ACTS IN CONJUNCTION WITH HASPIO, 2780IO,
*P*               AND RBSSS
*P*
*
*
*P
******************************************************
* THIS MODULE IS A CONGLOMERATION OF COMMON CODE FOR *
* 2780 AND IRBT CONSISTING OF WHATEVER CODE I COULD  *
* COMBINE FROM 2780IO AND HASPIO -- SMK              *
******************************************************
         SYSTEM   SIG7P
*                                   COMMON USAGE
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4                 SYMB INDEX
R5       EQU      5                 IOQ INDEX
R6       EQU      6                 ALWAYS CXT BUF ADDR (RB:BUF)
R7       EQU      7                 ALWAYS DCTX
SR1,R8   EQU      8
SR2,R9   EQU      9
SR3,R10  EQU      10
SR4,R11  EQU      11
D1,R12   EQU      12                CURRENT CRC
D2,R13   EQU      13
D3,R14   EQU      14
D4,R15   EQU      15
*
*
*
         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
*,*                                 ALSO HUNG-UP TYC
         REF      Y01               RB:FLAG BIT - SLVBIT
*,*                                 ALSO NORMAL TYC
         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      XF7FF             X'FFFFF7FF' TURNS OFF WFQ BIT
         REF      M8                VARIOUS MASKING USES
         REF      M16               VARIOUS MASKING USES
         REF      M19               VARIOUS MASKING USES
*
         REF      DCT2              INPUT: CIT INDEX TO RESTORE FOR IOSCU
         REF      DCT7              INPUT: CLIST D.A. TO RESTORE FOR
*,*                                 IOSCU
         REF      DCT13             INPUT: TDV STATUS USED TO GET REAL
*,*                                 BYTE COUNT READ FOR INPUT MSGS
         REF      DCT10             INPUT: RE-ENTRANCY COUNTER USED
*,*                                 TO RESTORE R14 AFTER USE - THESE
*,*                                 HANDLERS CANNOT BE RE-ENTERED
*,*                                 ON SEPERATE I/O'S BECAUSE OF THE
*,*                                 NATURE OF LINE PROTOCOLS
         REF      DCT17             OUTPUT: RIGHT BYTE CHANGED TO CAUSE
*,*                                 FOLLOWON TO NEW F.C. NOT ON NORMAL
*,*                                 PATH
         REF      IOQ2              I/O: IOQ TABLE FORWARD LINK USED
*,*                                 TO LINK AND UNLINK Q ENTRIES
*,*                                 CAPTURED BY RBQCKH
         REF      IOQ4              INPUT: HANDLER CALLING FUNC. CODE
*,*                                 USED IN ERR LOGGING AND AS NEW
*,*                                 FOLLOWON WHEN RPT%ORG IS CALLED
         REF      IOQ5              I/O: HANDLER CURRENT F.C. USED IN ERR
*,*                                 LOGGING AND TO STORE IN DISCONNECT
*,*                                 FUNCTION CODE WHEN RBXBIT IS SET
         REF      IOQ7              INPUT: DCT INDEX OBTAINED BY RBQCKH
         REF      IOQ8              I/O: BUFFER BA USED TO FIND DATA
*,*                                 AND SET BIN AND BACKUP BITS
         REF      IOQ9              INPUT: BYTE COUNT USED TO MOVE MSGS
*,*                                 TO AND FROM SYMB BUFFERS
         REF      IOQ11             I/O: RETRIES REMAINING USED TO COUNT
*,*                                 DOWN RETRYS AND DETECT ERROR MAX
         REF      IOQ12             INPUT: SYMBIONT INDEX FOR INTERCEPTED
*,*                                 IOQ CALLS
         REF      IOQ13             INPUT: END ACTION ADDRESS AND INFO
*,*                                 USED TO GIVE SYMB PSEUDO ENDAC
         REF      CURBQ             OUTPUT: COUNT OF FREE Q ENTRIES - COUNTED
*,*                                 UP WHEN Q'S ARE RELEASED BY PSEUDO
*,*                                 END ACTION
         REF      QFREE             I/O: HEAD OF FREE Q'S - USED TO RELEASE
*,*                                 Q ENTRIES IN PSEUDO END ACTION
         REF      JIT               INPUT: JIT - WORD 1 = 0 WE'RE UNMAPPED
         REF      TSTACK            I/O: TO PUSH AND PULL
         REF      RB:BUF            INPUT: TERMINAL CONTEXT AND BUFFERS
*,*                                 ADDRESS KEPT IN R6
         REF      RB:FLAG           I/O: REMOTE PROCESSING FLAGS
         REF      RBH:ACK           INPUT: SET UP AS BUFFER IN COMMAND DW
*,*                                 BY COMLIST SPECIAL ROUTINE
         REF      RBB:CRC           INPUT: 0 IF ON FECP 2 IF NOT
         REF      STB:Q             I/O: SYMBIONT TABLE THAT HOLDS IOQ
*,*                                 CHAIN HEAD FOR THIS SYMBIONT
         REF      STH:FLG           I/O: SYMBIONT STREAM FLAGS FOR RP
         REF      SYMX              INPUT: SYMBIONT DESCRIPTORS BIT7=1
*,*                                 MEANS INPUT SYMBIONT
         REF      FIN               INPUT: FIN IN TEXT USED TO DETECT ILLEGAL
*,*                                 !FIN'S IN INPUT STREAMS
         REF      HUP               INPUT: RBBAT GFC FOR RP TERM HUNG UP
         REF      LORR              INPUT: RBBAT GFC FOR RP TERM LOGON
*
         REF      ENBSR4            CALLED: TO ENABLE AND B *11
         REF      NEWQ              CALLED: TO DO REAL LINE I/O
         REF      Q15A              CALLED: TO RETURN TO IOQ WHEN AN IO IS
*,*                                 NOT TO BE INTERCEPTED
         REF      Q51               CALLED: TO RETURN TO IOQ WHEN AN I/O
*,*                                 HAS BEEN INTERCEPTED
         REF      USECOM            CALLED: TO RETURN TO COMLIST AFTER SPECIAL
*,*                                 PROCESSING
         REF      IOSCU             CALLED: TO RETURN TO IOQ WHEN HANDLER
*,*                                 BACKEND PROCESSING IS COMPLETE
         REF      REG%SET           CALLED: TO SET UP RP REGISTERS FOR
*,*                                 HANDLER FRONT END
         REF      RB%LGER           CALLED: TO LOG LINE ERRORS
         REF      RBSGCQP           CALLED: TO REPORT HUP AND LORR TO RBBAT
*
*
         SREF     BACKUP            CALLED: TO BACKUP SYMBIONTS FOR IRBT
*,*                                 WHEN BLOCK MUST BE RE-BUILT
         SREF     H%BCLS            CALLED: TO COMPLETE CLOSING OF IRBT BLOCKS
         SREF     H%BCK             CALLED: TO CHECK WHETHER DLE INSERTION
*,*                                 WILL OVERFLOW OUTPUT BLOCK
         SREF     H%CRC1            CALLED: TO CHECK FOR SPECIAL CHARS DURING
*,*                                 IRBT INPUT CRC'ING
         SREF     H%PRS2            CALLED: FOR IRBT - MIDDLE OF
*,*                                 PARSE ROUTINE
         SREF     27P2              CALLED: FOR 2780 - MIDDLE OF
*,*                                 PARSE ROUTINE
         SREF     H%PRS1            CALLED: FOR IRBT - BEGINNING OF
*,*                                 PARSE ROUTINE
         SREF     27P               CALLED: FOR 2780 - BEGINNING OF
*,*                                 PARSE ROUTINE
         SREF     H%PEOF            CALLED: FOR IRBT - !FIN FOUND IN
*,*                                 INPUT PROCESSING ROUTINE
         SREF     27PEF             CALLED: FOR 2780 - !FIN FOUND IN
*,*                                 INPUT PROCESSING ROUTINE
         SREF     H%BLD3            CALLED: FOR IRBT - CONTINUE BUILDING
*,*                                 ROUTINE
         SREF     27BG              CALLED: FOR 2780 - CONTINUE BUILDING
*,*                                 ROUTINE
         SREF     H%BLD             CALLED: FOR IRBT - BEGIN BUILDING
*,*                                 ROUTINE
         SREF     27B               CALLED: FOR 2780 - BEGIN BUILDING
*,*                                 ROUTINE
         SREF     H%CTL4            CALLED: FOR IRBT - ROUTINE TO CALL
*,*                                 WHEN FORCE WRITE FAILS
         SREF     27DIO1            CALLED: FOR 2780 - ROUTINE TO CALL
*,*                                 WHEN FORCE WRITE FAILS
         SREF     H%CTL3            CALLED: FOR IRBT - ROUTINE TO CALL
*,*                                 WHEN FORCE WRITE SUCCEEDS
         SREF     27WRT             CALLED: FOR 2780 - ROUTINE TO CALL
*,*                                 WHEN FORCE WRITE SUCCEEDS
         SREF     H%CTL             CALLED: FOR IRBT - LINE END ACTION
*,*                                 HANDLER
         SREF     27CTL             CALLED: FOR 2780 - LINE END ACTION
*,*                                 HANDLER
         SREF     H%HU              CALLED: FOR IRBT - TO HANDLE LINE
*,*                                 HANG UP
         SREF     27HU              CALLED: FOR 2780 - TO HANDLE LINE
*,*                                 HANG UP
*
*
         DEF      UNKN%RD1          LOG RP LINE ERROR - RP1 = X'C'
         DEF      UNKN%RD2          LOG RP LINE ERROR - RP1 = X'B'
         DEF      UNKN%RD3          LOG RP LINE ERROR - RP1 = X'A'
         DEF      UNKN%RD4          LOG RP LINE ERROR - RP1 = 9
         DEF      BD%CRC            LOG RP LINE ERROR - RP1 = 8
         DEF      TO%NAK            LOG RP LINE ERROR - RP1 = 7
         DEF      HE%NAKD           LOG RP LINE ERROR - RP1 = 6
         DEF      ENQ%PRB           LOG RP LINE ERROR - RP1 = 5
         DEF      LGN%ACK           LOG RP LINE ERROR - RP1 = 4
         DEF      ENQ%NOT           LOG RP LINE ERROR - RP1 = 3
         DEF      TO%OUT            LOG RP LINE ERROR - RP1 = 2
         DEF      BD%BCB            LOG RP LINE ERROR - RP1 = 1
         DEF      OLD%BCB1          LOG RP LINE ERROR - RP1 = 0
         DEF      LOG%ERR           LOG RP LINE ERROR - RP1 = 0
*
         DEF      4SYNC             DATA CELL W/4 SYNCS FOR BSC
         DEF      BSCAKM            CANNED ACK0 MESSAGE FOR BSC
         DEF      BSCNAKM           CANNED NAK MESSAGE FOR BSC
*
         DEF      BSCSPC            COMLIST SPECIAL ROUTINE - MOVES
*,*                                 BUFFER ADDR. IN R11 TO CMD IN R8
         DEF      BSCSPC1           COMLIST SPECIAL ROUTINE - SETS
*,*                                 UP BA(RBH:ACK,R1) IN COMMAND
         DEF      BSC%PRE           COMMON CODE FOR HANDLER FRONT ENDS
         DEF      BSC%GL            GETS THE LENGTH OF A MESSAGE INPUT
*,*                                 OVER THE LINE AND ITS FIRST CHAR.
         DEF      E%DISC            TESTS FOR LAST RETRY - IF THIS IS
*,*                                 IT DISCONNECTS THE LINE AND SETS
*,*                                 EDISBIT
         DEF      BSC%FL            COMMON HANDLER BACKEND FOLLOWON EXIT
         DEF      BSC%PX            COMMON HANDLER BACKEND NORMAL EXIT
         DEF      BSC%PX1           COMMON HANDLER BACKEND EXIT -
*,*                                 CALLER SUPPLIES TYC
         DEF      BSC%RTR           COMMON HANDLER BACKEND RETRY EXIT
         DEF      H%CRCI            IRBT INPUT CRC ENTRY
         DEF      CRCI              COMMON INPUT CRC ROUTINE
         DEF      CRCI0             ENTRY TO CRCI WITH PARTIAL CRC
*,*                                 ALREADY COMPUTED IN R12
         DEF      CRCI1             RETURN POINT TO CRCI WHEN CHAR
*,*                                 EXAMINED BY CALLER NOT TO BE
*,*                                 COUNTED OR CRC'ED
         DEF      CRCI2             RETURN TO CRCI - CHAR TO BE INSERTED
*,*                                 INTO MESSAGE AND CRCED
         DEF      CRCI3             RETURN TO CRCI - CHAR TO BE CRC'ED
*,*                                 BUT NOT INSERTED INTO MESSAGE
         DEF      CRCI4             RETURN TO CRCI - CHAR TO BE COUNTED
*,*                                 BUT NOT STORED OR CRC'ED
         DEF      CRCO              COMMON OUTPUT CRC ROUTINE
         DEF      CRCX              ENTRY TO CRCO WITH CALLER SPECIFIED
*,*                                 CHARACTER (DLE) CHECKER
         DEF      CRCO3             RETURN TO CRCO - CHAR TO BE CRC'ED
*,*                                 AND STORED INTO MESSAGE
         DEF      CRC4              RETURN TO CRCO - CHAR TO BE CRC'ED
*,*                                 BUT NOT STORED INTO MESSAGE
         DEF      CRC1              COMMON ROUTINE TO CRC AND STORE
*,*                                 1 CHARACTER INTO MESSAGE
         DEF      ENDAC             GIVE PSEUDO END-ACTION TO CALLER
         DEF      ENDAC1            ENTRY TO ENDAC - CALLER SUPPLIES TYC
         DEF      ENDAC2            ENTRY TO ENDAC - CALLER SUPPLIES
*,*                                 TYC, BIN BIT AND BACKUP TOGGLE
         DEF      RBQCKH            INTERCEPTOR FOR SYMBIONT CALLS TO
*,*                                 IOQ BOUND FOR IRBT AND 2780 DEVICES
         DEF      BSC%HEA           GIVE PSEUDO END-ACTION WITH HANG
*,*                                 UP TYC.
         DEF      BSC%PRS           COMMON BLOCK PARSING ENTRY POINT
         DEF      BSC%PEA           COMMON ROUTINE TO TEST FOR !FIN
*,*                                 AND SET UP RBC FOR PSEUDO ENDAC
*,*                                 ON SYMBIONT READS
         DEF      BSC%PE1           ADVANCE PARSE POINTER AND GO TO
*,*                                 MIDDLE OF PARSE ROUTINE
         DEF      BSC%EOB           COMMON ROUTINE TO HANDLE END OF
*,*                                 BUFFER WHEN PARSING
         DEF      BSC%GB            COMMON LINE BUFFER GETTER
         DEF      BSC%FB            COMMON LINE BUFFER FREER
         DEF      BSC%BLD           COMMON BLOCK BUILDING ENTRY POINT
         DEF      BSC%BL0           RETURN TO BSC%BD WITH BIP ALREADY SET
         DEF      BSC%BO            COMMON BUILDER EXIT
         DEF      BSC%BO1           COMMON BUILDER EXIT
         DEF      BSC%BC            COMMON CODE TO FINISH OFF BUILDING
*,*                                 OF BLOCK
         DEF      BSC%BCX           RETURN TO BSC%BC FOR SPECIAL IRBT
*,*                                 BLOCK CLOSING CODE (H%BCLS)
         DEF      BSCDIO            COMMON CODE TO CALL NEWQ FOR LINE I/O
         DEF      FORCWR            COMMON CODE TO FORCE BUILD BUFFER
*,*                                 FULL WHEN LINE NEEDS ONE
         DEF      ML%CTL            COMMON LINE END-ACTION HANDLER
         DEF      BSC%LGN           COMMON CODE TO REPORT LOGON RECORD
*,*                                 RECIEVED TO RBBAT
         DEF      TEL%RBBAT         COMMON CODE TO REPORT EVENTS TO
*,*                                 RBBAT - FOLLOWON IF NO BUFS
         DEF      RPT%ORG           HANDLER COMMON CODE TO RETURN TO
*,*                                 THE CALLING FUNCTION CODE
         DEF      NEW%FLO           COMMON CODE TO TAKE A NEW FUNCTION
*,*                                 CODE PATH FOR HANDLERS
         DEF      BSC%GN            COMMON CODE FOR HANDLERS TO REPORT
*,*                                 HANG UP TO RBBAT AND CALLER
         DEF      BSC%HO            COMMON HANG UP EXIT ROUTINE
         DEF      BSC%PO            COMMON PARSE EXIT ROUTINE
         DEF      BSC%GO            COMMON EXIT ROUTINE - ALL EXITS
*,*                                 (MOST ANYWAY) FROM THE BUILDER-
*,*                                 PARSER-LINE-MANAGERS GO THROUGH HERE
         DEF      BSC%DSC           COMMON CODE TO CHECK FOR LOGOFF AND
*,*                                 DISCONNECT LINE WHEN APPROPRIATE
         DEF      BSC%FEC           CHECKS TDV BIT FOR CRC BAD IF DEVICE
*,*                                 IS ON AN FECP
         DEF      BSC%CRG           RETURNS AS THOUGH CRC WAS GOOD
**********************************************
*
*        FLAG WORD BIT MASKS
*
FRBIT    EQU      1
EMBIT    EQU      2
OBBIT    EQU      1
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'
HALBIT   EQU      X'800'
SYSBIT   EQU      X'1000'           FLAG BITS FOUND IN RB:FLAG
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
*
SYNC     EQU      X'32'
SOH      EQU      X'01'
STX      EQU      X'02'
ITB      EQU      X'1F'
ETB      EQU      X'26'
ETX      EQU      X'03'
ENQ      EQU      X'2D'
EOT      EQU      X'37'             BSC-EBCDIC LINE CODES
NAK      EQU      X'3D'
DLE      EQU      X'10'
ACK0     EQU      X'70'
ACK1     EQU      X'61'
WACK     EQU      X'6B'
RVI      EQU      X'7C'
EM       EQU      X'19'
BEL      EQU      X'2F'
ESC      EQU      X'27'
PAD      EQU      X'FF'
4SYNC    DATA     X'32323232'       FOUR SYNCS FOR MSG START
PRIO     EQU      X'FF'             IOQ PRIORITY
FCKPTR   GEN,8,24 4,BA(FIN)         USED TO SCAN INPUT FOR FIN
BUBIT    EQU      X'100'            ++SEE HASPIO
HUTYC    EQU      2                 HUNG UP TYC FROM HANDLER
HUTYC1   EQU      Y02               H. U. TYC TO SYMB
%RBC     EQU      389               DATA SPACE IN 400 BYTE BUFF
%%RBC    EQU      501
DISC:DOT EQU      0                 DISCONNECT FC
NORTYC   EQU      Y01               NORMAL TYC TO SYMB
NWFCN    EQU      2                 NO DATA TO OUTPUT FC
NWFQBT   EQU      XF7FF             ++ SEE HASPIO
BDCRC    EQU      Y04
*********************************************
*                                   CONTEXT POINTERS****
FNSV     EQU      0
HPB      EQU      1                 HEAD PARSE BUFFS
HBB      EQU      2                 HEAD BUILD BUFFS
HRB      EQU      3                 HEAD READ BUFFS
HWB      EQU      4                 HEAD WRITE BUFFS
CPB      EQU      5                 CURRENT PARSE BUFF
CBB      EQU      6                 CURRENT BUILD BUFF
CRB      EQU      7                 CURRENT READ BUFF
CWB      EQU      8                 CURRENT WRITE BUFF
POP      EQU      9                 POINTER OF PARSE
POB      EQU      10                POINTER OF BUILD
PIP      EQU      11                PARSE IN PROGRESS
CBCB     EQU      12                CUR. OUTPUT BCB
OCRCB    EQU      13                INPUT RCB FOR OC
RBC      EQU      14                REMAINING BYTE COUNT (OUT)
CCRC     EQU      15                CUR. CRC (OUT)
CURX     EQU      16                CUR. USER (OUT)
*FOR 2780 CURX HOLDS SYMX OF O.S. UNTIL RREADY
BIP      EQU      17                BUILD IN PROGRESS
FBF      EQU      18                FORCE BUFFER FULL
CIP      EQU      19                CONTROL IN PROGRESS
FCSI     EQU      20                COMB. INPUT FCS
*FOR 2780 FCSI HOLDS VFC BEING SIMULATED
CFC      EQU      21                CUR. FUNCTION CODE
BUT      EQU      22                BACKUP TOGGLE
BIN      EQU      23                BINARY REC RCVD.
CURF     EQU      24                LAST FAILING USER (OUT)
*FOR 2780 CURF COUNTS CURRENT RECS IN OUTPUT BLOCK
LTYC     EQU      25                LINE TYC
RST      EQU      26                SUSPENDED USERS TO RESTART
SAB      EQU      27                SUSCK ABORTS BUILD
*FOR 2780 SAB IS USED TO PREVENT WRITES B4 READY
PSP      EQU      28                PERMISSION SPECIAL POINTER
EOF      EQU      29                EOF IN THIS BLOCK
CONT     EQU      30                CONTINUATION BUFF ADDR
*FOR 2780 CONT SET MEANS SYMB OPERATION IN PROG.
CONTCK   EQU      31                CONT SYMB INDES
*FOR 2780 CONTCK IS SET BY RBBAT TO: SRB=1,MRB=FF
CONTCNT  EQU      32                CONT BYTE COUNT
SCRC     EQU      33                PERMISSION SPECIAL CRC
HIP      EQU      34                HANG-UP IN PROGRESS
BKD      EQU      35                SYMB BACKED UP
TTYP     EQU      36                1=2780 -- 0=IRBT
RTRY     EQU      37                NUMBER OF RETRIES
SPB      EQU      38                BUFFER WHEN WAB SENT
**********************************************
*           COMLIST ROUTINES
BSCSPC1  EQU      %                 SET BUF TO BA(RBH:ACK,1)
         LI,R11   HA(RBH:ACK)
         AW,R11   R1
         SLS,R11  1
         AND,R11  M19
BSCSPC   EQU      %                 PUT NEW BUF IN 11 INTO COMMAND IN 8
         OR,R8    R11
         B        USECOM
*********************************************
:CHAR    CNAME
         PROC
         BOUND    4
LF       EQU      %
I        DO       NUM(AF)
         GEN,8    AF(I)
         FIN
         PEND
*
*
*
*   SPECIAL MESSAGES : COMMAND DBL WRD BUFFERS
*
EIEIO    EQU      %       WITH A SYNC-SYNC HERE, AND A . . .
*                 SYNC-SYNC THERE, HERE A SYNC, THERE A SYNC,
*                 EVERYWHERE A SYNC-SYNC . . . . . . . . .
*
*
BSCAKM   :CHAR    SYNC,SYNC,SYNC,SYNC,DLE,ACK0,PAD
BSCNAKM  :CHAR    SYNC,SYNC,SYNC,SYNC,NAK,PAD
         BOUND    4
********************************************
*                                   HANDLER PRE ENTRY COMMON CODE
BSC%PRE  EQU      %                 :
         BAL,R9   REG%SET           SET R13=RB:FLAG,R5=CUR FC,R7=CLIST DA
         CI,R13   RBXBIT            :
         BAZ      %+3               IF RBXBIT CHANGE FC TO DISCONNECT
         LI,R5    DISC:DOT
         STB,R5   IOQ5,R3
         B        *R11
************************************************
BSC%GL   EQU      %                 GET INPUT MESSAGE LENGTH
         LD,R8    0,R7              :
         LD,R10   DCT13,R1          ON EXIT:  R11= -(MSG LENGTH)
         AND,R11  M16                           R5= FIRST CHAR
         AND,R9   M16               COME IN W/R6=BA(MESSAGE)
         SW,R11   R9
         LB,R5    0,R6
         B        *R12
*****************************************
BSC%FEC  EQU      %                 CHECK FOR CRC ERRORS ON FECPS
         LB,R0    RBB:CRC,R1        :
         BNEZ     *R10              IF RBB:CRC = 0 DEV ON FECP
         LD,R8    DCT13,R1          IN THAT CASE CHECK TDV STAT
         CW,R9    BDCRC             BIT FOR CRC BAD AND GO TO
         BAZ      *R10              BD%CRC IF SET
         B        BD%CRC
*******************************************************
*
*
*                 NAK ERRLOGING ROUTINES
*
ENTER    COM,8,4,20 X'73',+1,R5    MTB,+1 R5
*
**
UNKN%RD1 ENTER                      X'C'
UNKN%RD2 ENTER                      X'B'
UNKN%RD3 ENTER                      X'A'
UNKN%RD4 ENTER                        9
BD%CRC   ENTER                        8
TO%NAK   ENTER                        7
         LI,R0    BSC%FL            AFTER LOG FOLLOWON ON ABOVE
         MTB,6    R5
         B        LOG%ERR
HE%NAKD  ENTER                        6
ENQ%PRB  ENTER                        5
LGN%ACK  ENTER                        4
ENQ%NOT  ENTER                        3
         LI,R0    RPT%ORG           AFTER LOG REDO ORIG FC ON ABOVE
         MTB,2    R5                :
         B        LOG%ERR           :
TO%OUT   ENTER                        2
         LI,R0    BSC%RTR           ON TO%OUT RETRY AFTER LOG
BD%BCB   ENTER                        1
OLD%BCB1 EQU      %                   0
LOG%ERR  EQU      %                 :
*                                   :
         LB,R6    IOQ5,R3           FOR ERRLOG DESC SEE RP REF MANUAL
         SLS,R6   16
         OR,R5    R6
         LB,R6    IOQ4,R3
         SLS,R6   8
         OR,R5    R6
         LW,R14   R5
         LI,R5    0
         BAL,R12  RB%LGER           LOG THE ERROR
         MTB,-1   IOQ11,R3          :
         BNEZ     *R0               LAST RETRY????
E%DISC   EQU      %                 :
         MTB,1    IOQ11,R3          YES SET BIT FOR ERROR MAX MSG
         LI,R5    DISC:DOT          AND DISCONNECT
         AI,R13   EDISBIT
         B        NEW%FLO
*********************************************************
*            FOLLOWON
BSC%FL   EQU      %
         LI,R12   X'6000'           SET FOLLOW-ON, INTER-OP
         B        BSC%PX1           RETURN TO DSC HANDLER
*          NORMAL EXIT OF I/O
BSC%PX   EQU      %
         LI,R12   1                 NORMAL COMPLETION
BSC%PX1  LH,R7    DCT7,R1           RESTORE CLST
         LB,R4    DCT2,R1    RESTORE CITX FOR IOS ROUTINES
         LI,R11   0                 RBC
         STW,R13  RB:FLAG,R1
         LI,R13   0
         LH,R14   DCT10,R1          MAKE RE:ENT HAPPY
         B        IOSCU             EXIT TO CLEANUP
*
*             RETRY
BSC%RTR  EQU      %
         LI,R12   X'C008'
         B        BSC%PX1
******************************************************
*                                   INPUT CRC ROUTINE
H%CRCI   LI,R0    H%CRC1            :
CRCI     EQU      %                 IN:  R11= -(BC),R6=BA(BUF),R7=BA(BUF) (IF US
         LI,R12   0                 OUT:  EXITS SKIPPING IF CRC IS OK
CRCI0    EQU      %                 :
         LB,R4    RBB:CRC,R1
         BEZ      CRCINO
CRCI1    EQU      %                 ON EACH BYTE A TYPE SPECIFIC CHECK
         LB,R5    0,R6              ROUTINE (*R0) IS CALLED TO LOOK FOR
         AI,R6    1                 DLE,ITB,ETC.  IRBT USES CRCI2 TO SQUEEZE
         B        *R0               DLE'S -- 2780 USES CRCI3 AND CRC'S IN PLACE
CRCI2    EQU      %
         STB,R5   0,R7
         AI,R7    1
CRCI3    EQU      %
         LB,R10   R12,R4
         AND,R12  M8
         EOR,R5   R12
         LH,R12   CRCTBL,R5
         EOR,R12  R10
CRCI4    EQU      %
         BIR,R11  CRCI1
         BNEZ     *R9
BSC%CRG  EQU      %
         AI,R9    1
         B        *R9
CRCINO   EQU      %                 DONT CRC IF ON FECP BUT DO
         LB,R5    0,R6              CALL 2780IO FOR ITBS
         AI,R6    1
         CI,R5    ITB
         BE       *R0
         BIR,R11  CRCINO
         B        BSC%CRG
************************************************
CRCO     EQU      %                 OUTPUT CRC ROUTINE
         LI,R10   CRC2              :
CRCX     LB,R1    RBB:CRC,R7        IN: R9=BC R2=BA(SOURCE)R3=BA(DEST)
         BEZ      CRCNO
CRC5     EQU      %                 OUT:  MSG MOVED R2 -> R3 AND CRC IN R12
         LB,R5    0,R2              :
         CI,R5    DLE               :
         B        *R10              AS EACH CHAR IS PICKED UP A CALLER SPECIFIC
CRC2     EQU      %                 DLE CHECKING ROUTING (*R10) IS CALLED TO ACT
         BNE      CRCO3              ON DLE'S FOUND.-- ONE USE IS CRC2 WHICH
         MTW,1    RBC,R6            INSERTS AN EXTRA UN-CRCED DLE FOR TRANSPAREN
         BGZ      H%BCK             IF THERE IS BUFFER SPACE -- 2780 USES CRCO3
         STB,R5   0,R3              IN R10 -- HASPIO USES CRC2 AND OTHERS
         AI,R3    1
CRCO3    EQU      %
         STB,R5   0,R3
         AI,R3    1
CRC4     LB,R13   R12,R1
         AND,R12  M8
         EOR,R5   R12
         LH,R12   CRCTBL,R5
         EOR,R12  R13
         AI,R2    1
         BDR,R9   CRC5
         B        *R11
CRCNO    EQU      %                 DONT CRC IF ON FECP BUT MOVE
         STB,R9   R3
         MBS,R2   0
         LI,R9    0
         B        *R11
*****************************************************
CRC1     EQU      %                 CRC AND STORE ONE CHAR
         STB,R2   0,R3              :
         AI,R3    1                 IN:  R2=CHAR,R3=BA(DEST BUF)
         LB,R12   RBB:CRC,R7
         BEZ      *R11
         LW,R12   CCRC,R6           OUT: CHAR CRCED AND STORED -- BUF ADVANCED
         INT,R13  CCRC,R6
         SLS,R13  -8
         AND,R12  M8
         EOR,R2   R12
         LH,R12   CRCTBL,R2
         EOR,R12  R13
         STW,R12  CCRC,R6
         B        *R11
********************************************************
*    PARTIAL REMAINDER TABLE FOR CRC CALCULATION
CRCTBL   EQU      %
         DATA     X'0000C0C1'
         DATA     X'C1810140'
         DATA     X'C30103C0'
         DATA     X'0280C241'
         DATA     X'C60106C0'
         DATA     X'0780C741'
         DATA     X'0500C5C1'
         DATA     X'C4810440'
         DATA     X'CC010CC0'
         DATA     X'0D80CD41'
         DATA     X'0F00CFC1'
         DATA     X'CE810E40'
         DATA     X'0A00CAC1'
         DATA     X'CB810B40'
         DATA     X'C90109C0'
         DATA     X'0880C841'
         DATA     X'D80118C0'
         DATA     X'1980D941'
         DATA     X'1B00DBC1'
         DATA     X'DA811A40'
         DATA     X'1E00DEC1'
         DATA     X'DF811F40'
         DATA     X'DD011DC0'
         DATA     X'1C80DC41'
         DATA     X'1400D4C1'
         DATA     X'D5811540'
         DATA     X'D70117C0'
         DATA     X'1680D641'
         DATA     X'D20112C0'
         DATA     X'1380D341'
         DATA     X'1100D1C1'
         DATA     X'D0811040'
         DATA     X'F00130C0'
         DATA     X'3180F141'
         DATA     X'3300F3C1'
         DATA     X'F2813240'
         DATA     X'3600F6C1'
         DATA     X'F7813740'
         DATA     X'F50135C0'
         DATA     X'3480F441'
         DATA     X'3C00FCC1'
         DATA     X'FD813D40'
         DATA     X'FF013FC0'
         DATA     X'3E80FE41'
         DATA     X'FA013AC0'
         DATA     X'3B80FB41'
         DATA     X'3900F9C1'
         DATA     X'F8813840'
         DATA     X'2800E8C1'
         DATA     X'E9812940'
         DATA     X'EB012BC0'
         DATA     X'2A80EA41'
         DATA     X'EE012EC0'
         DATA     X'2F80EF41'
         DATA     X'2D00EDC1'
         DATA     X'EC812C40'
         DATA     X'E40124C0'
         DATA     X'2580E541'
         DATA     X'2700E7C1'
         DATA     X'E6812640'
         DATA     X'2200E2C1'
         DATA     X'E3812340'
         DATA     X'E10121C0'
         DATA     X'2080E041'
         DATA     X'A00160C0'
         DATA     X'6180A141'
         DATA     X'6300A3C1'
         DATA     X'A2816240'
         DATA     X'6600A6C1'
         DATA     X'A7816740'
         DATA     X'A50165C0'
         DATA     X'6480A441'
         DATA     X'6C00ACC1'
         DATA     X'AD816D40'
         DATA     X'AF016FC0'
         DATA     X'6E80AE41'
         DATA     X'AA016AC0'
         DATA     X'6B80AB41'
         DATA     X'6900A9C1'
         DATA     X'A8816840'
         DATA     X'7800B8C1'
         DATA     X'B9817940'
         DATA     X'BB017BC0'
         DATA     X'7A80BA41'
         DATA     X'BE017EC0'
         DATA     X'7F80BF41'
         DATA     X'7D00BDC1'
         DATA     X'BC817C40'
         DATA     X'B40174C0'
         DATA     X'7580B541'
         DATA     X'7700B7C1'
         DATA     X'B6817640'
         DATA     X'7200B2C1'
         DATA     X'B3817340'
         DATA     X'B10171C0'
         DATA     X'7080B041'
         DATA     X'500090C1'
         DATA     X'91815140'
         DATA     X'930153C0'
         DATA     X'52809241'
         DATA     X'960156C0'
         DATA     X'57809741'
         DATA     X'550095C1'
         DATA     X'94815440'
         DATA     X'9C015CC0'
         DATA     X'5D809D41'
         DATA     X'5F009FC1'
         DATA     X'9E815E40'
         DATA     X'5A009AC1'
         DATA     X'9B815B40'
         DATA     X'990159C0'
         DATA     X'58809841'
         DATA     X'880148C0'
         DATA     X'49808941'
         DATA     X'4B008BC1'
         DATA     X'8A814A40'
         DATA     X'4E008EC1'
         DATA     X'8F814F40'
         DATA     X'8D014DC0'
         DATA     X'4C808C41'
         DATA     X'440084C1'
         DATA     X'85814540'
         DATA     X'870147C0'
         DATA     X'46808641'
         DATA     X'820142C0'
         DATA     X'43808341'
         DATA     X'410081C1'
         DATA     X'80814040'
****************************************************
ENDAC    EQU      %                 SYMBIONT PSEUDO END ACTION
         OR,R12   NORTYC            :
ENDAC1   EQU      %                 SETS UP REGISTERS AS IN
         WD,0     X'37'             NEWQ END ACTION INCLUDEING
         LB,R2    IOQ2,R5           BIN BIT AND BACKUP TOGGLE IN
         STB,R2   STB:Q,R4          TOP BYTE OF BUF.
         WD,0     X'27'             :
         LI,R15   0                 MANAGES AND FREES Q ENTRY
         XW,R15   BIN,R6            :
         OR,R15   BUT,R6            ENTER WITH RBC IN 12
ENDAC2   EQU      %                 :
         OR,R15   IOQ8,R5           ENDAC1 I CALLED FOR OTHER THAN
         LD,R10   IOQ13,R5          NORMAL TYC'S AND ENDAC2 IN
         LW,R14   R11               SPECIAL BACKUP CASES.
         WD,0     X'37'
         LB,R2    QFREE
         STB,R5   QFREE
         STB,R2   IOQ2,R5
         WD,0     X'27'
         MTW,-1   CURBQ
         AI,R10   0
         BEZ      *R8
         LCI      3
         PSM,R6   TSTACK
         BAL,R11  *R10              WHEN YOU LEAVE HERE YOU MAY
         LCI      3                 GET BACK VIA (E.G.) BSC%BLD
         PLM,R6   TSTACK            BUT IUCK WILL PREVENT RE-ENTS
         B        *R8
*****************************************
RBQCKH   EQU      %                 IOQ INTERCEPT ROUTINE
         LW,R4    IOQ12,R3          :
         BEZ      Q15A              :
         LW,R7    HUBIT             IF IOQ12 IS NON ZERO THIS IS A
         STB,R7   IOQ2,R3           SYMBIONT CALL AND WE PROCESS --
         WD,0     X'37'             RBSSS HAS DECIDED ITS OURS ALREADY
         MTW,0    RB:BUF,R1         IF IOQ12 IS ZERO ITS OUR OWN REAL
         BEZ      %+3               I/O CALL AND WE LET IT GO
         CW,R7    RB:FLAG,R1        :
         BAZ      RBQCK1            IF THE LINE IS HUNG-UP GIVE INSTANT
         WD,0     X'27'             END ACTION WITH HUTYC -- NOTE THAT
         LW,R5    R3                SYMB MAY GET ENDAC B4 Q EXIT BUT
         LI,R8    Q51               THATS REALTIME BIZ.
BSC%HEA  EQU      %                 :
         LW,R12   HUTYC1            IF ALL IS COOL WE SAVE THE Q ENTRY
         B        ENDAC1            IN THE APPROPRIATE STB:Q AND GO TO
RBQCK1   EQU      %                 THE PARSER IF ITS INPUT-- IF ITS
         LB,R7    STB:Q,R4          OUTPUT WE SEE IF WE ARE WAITING TO
         BNEZ     %+3               BACK THIS GUY UP AND IF SO GO
         STB,R3   STB:Q,R4          TO BACKUP-- OTHERWISE OFF TO BUILD
         B        %+2               :
         STB,R3   IOQ2,R7           WFQBIT IS RESET TO TELL BUILD THIS
         WD,0     X'27'             SYMB IS READY TO GO
         LB,R7    IOQ7,R3
         LI,R11   Q51
         LB,R9    SYMX,R4
         CI,R9    1
         BANZ     BSC%PRS
         WD,0     X'37'
         LH,R10   STH:FLG,R4
         AND,R10  NWFQBT
         CI,R10   BUBIT
         BANZ     BACKUP
         STH,R10  STH:FLG,R4
         WD,0     X'27'
         B        BSC%BLD
***********************************************
BSC%PRS  EQU      %                 COMMON PARSING ENTRY
         LI,R14   PIP               :
         BAL,R10  IUCK              IF WE ARE ALREADY PARSING EXIT
         LW,R2    POP,R6            :
         BNEZ     MPRSVC,R1         IF WE HAVE A BUFFER TO PARSE
PRS0     EQU      %                 CONTINUE PARSING
         LI,R15   HPB               :
         BAL,R11  BSC%GB            OTHERWISE TRY TO GET A BUFFER TO
         BEZ      BSC%PO            PARSE -- IF NONE EXIT --IF THERE IS
         STW,R2   CPB,R6            ONE REMEMBER IN CPB GET BA IN 2 AND
         SLS,R2   2                 POP AND GO TO APPROPRIATE BEGINNING
         AI,R2    4                 OF PARSER.
         STW,R2   POP,R6
         B        PRSVC,R1
**************************************************
BSC%PEA  EQU      %                 SETUP INPUT PSEUDO END ACTION
         LW,R14   IOQ8,R5           :
         LW,R15   FCKPTR            IF THIS WAS A FIN COMMAND SET IGBIT
         CBS,R14  0                 AND GO TO APPROPRIATE (APP) PARSE
         BNE      PRSEA2            EOF PROCESS
         LW,R1    IGBIT             :
         STS,R1   RB:FLAG,R7        OTHERWISE CALC RBC AND GO TO ENDAC
         LW,R1    TTYP,R6           :
         B        PEOFVC,R1         AFTER ENDAC GET CORRECT POP INTO 2
PRSEA2   EQU      %                 AND GO TO APP CONTINUE PARSING
         STW,R2   POP,R6            ROUTINE
         LH,R12   IOQ9,R5
         SW,R3    IOQ8,R5
         SW,R12   R3
         BAL,R8   ENDAC
BSC%PE1  EQU      %
         MTW,1    POP,R6
         LW,R2    POP,R6
         LW,R1    TTYP,R6
         B        MPRSVC,R1
****************************************************
BSC%EOB  EQU      %                 END OF BUFFER PARSE
         LI,R2    0                 :
         STW,R2   POP,R6            CLEAR POP AND CPB
         XW,R2    CPB,R6            :
         LI,R15   HRB               CHAIN BUFFER BACK TO READ
         LI,R11   PRS0              BUFFERS AND TRY TO PARSE
         LW,R1    TTYP,R6           ANOTHER ONE
         B        BSC%FB
******************************************************
IUCK     EQU      %                 RE-ENTRANCY PREVENTING ROUTINE
         LW,R6    JIT               :
         BNEZ     *R11              NONE OF THIS CAN RUN MAPPED (IOQ CAN)
         LW,R6    RB:BUF,R7         :
         WD,0     X'37'             EXIT WITH 6=RB:BUF AND 1=TTYP
         LW,R15   CIP,R6            :
         BNEZ     ENBSR4            ON INPUT R15 HAS DISP OF LOCK
         LW,R15   *R14,R6           WORD IF THIS FUNCTION OR THE
         BNEZ     ENBSR4            CONTROL FUNCTION IS IN PROG
         STW,R11  *R14,R6           WE EXIT -- OTHERWISE THE LOCK IS
         WD,0     X'27'             SET AND WE CONTINUE
         LW,R1    TTYP,R6
         B        *R10
******************************************************
***************************************************
BSC%GB   EQU      %                 GET A BUFFER
         WD,0     X'37'             :
         LW,R2    *R15,R6           LI,15 APPHEAD
         BEZ      GBOUT             BAL,11 BSC%GB
         LW,R0    *R2               BEZ   NO BUFFERS
         STW,R0   *R15,R6           ***BUF ADDR IN 2
GBOUT    WD,0     X'27'
         AI,R2    0
         B        *R11
BSC%FB   EQU      %                 FREE A BUFFER
         WD,0     X'37'             :
         LW,R0    *R15,R6           LI,15 APPHEAD
         STW,R2   *R0               BAL,11 BSC%FB
         STW,R0   *R15,R6           ***BUFFER IS FREE
         LI,R0    0
         STW,R0   *R2
         B        ENBSR4
**************************************************
BSC%BLD  EQU      %                 COMMON BUILDING ENTRY
         LI,R14   BIP               :
         BAL,R10  IUCK              IF ALREADY BUILDING EXIT
BSC%BL0  EQU      %                 :
         EXU      2BTST,R1          IF THIS IS THE SECOND BUFFER
         AW,R3    SAB,R6            AND WE ARENT SUPPOSED TO BUILD
         BNEZ     BSC%BO1           MORE THAN ONE OR SOMEONE IS
         LW,R3    POB,R6            WAITING (USUALLY CONTROL) FOR
         BNEZ     MBLDVC,R1         BUILD TO FINISH --EXIT
         LW,R2    CBB,R6            :
         BNEZ     BLD01             IF WE HAVE A BUFFER PARTIALLY
         LI,R15   HBB               BUILT GO TO THE APP CONTINUE
         BAL,R11  BSC%GB            BUILDING PROCESS
         BEZ      BSC%BO1           :
         STW,R2   CBB,R6            IF WE HAVE A BUFFER BUT ITS
BLD01    EQU      %                 EMPTY DONT GET ANOTHER
         AI,R2    2                 :
         LW,R3    R2                IF WE NEED ONE GET ONE
         SLS,R3   2                 NONE? -- EXIT
         LI,R15   0                 :
         STW,R15  CCRC,R6           PUT BUF IN CBB (BUT NOT YET
         LI,R15   -%RBC             POB) AND BA IN 3 -- SET UP
         CI,R1    1                 SKIP IRBT
         BNE      %+4
         LW,R4    OCRCB,R6          3780 TEST
         BEZ      %+2
         LI,R15   -%%RBC
         STW,R15  RBC,R6            CCRC AND RBC AND GO TO APP
         B        BLDVC,R1          BUILD STARTING ROUTINE
*************************************************
BSC%BO   EQU      %                 EXIT OF BUILD ROUTINES
BSC%BO1  LI,R14   BIP
         B        BSC%GO
BSC%BC   EQU      %                 CLOSE COMPLETED BLOCK
BLDCLS1  WD,0     X'27'             :
         LW,R9    POB,R6            CALCULATE SIZE OF BLOCK INTO 9
         LW,R15   CBB,R6            :
         SLS,R15  2                 CLEAR CELLS DEPENDENT ON THIS BLOCK
         SW,R9    R15               :
         AI,R9    -3                IF WE REALLY DIDNT GET ANY DATA IN
         LI,R3    0                 EXIT
         STW,R3   CURF,R6           :
         STW,R3   FBF,R6            IF ITS IRBT THERE IS EXTRA STUFF
         XW,R3    POB,R6            TO DO IN HASPIO
         CI,R9    10                :
         BLE      BSC%BO1           PUT A PAD ON THE END -- PUT
         LW,R1    TTYP,R6           THE BUFFER ON THE WRITE CHAIN --
         BEZ      H%BCLS            INCREMENT THE IRBT BCB COUNT --
BSC%BCX  EQU      %                 CLEAR CBB -- PUT THE BC IN THE FRONT
         LI,R2    PAD               OF THE BLOCK FOR THE HANDLER--
         STB,R2   0,R3              AND TRY TO BUILD ANOTHER BLOCK
         LI,R2    0
         LI,R15   HWB
         LI,R11   BSC%BL0
         WD,0     X'37'
         MTW,1    CBCB,R6
         XW,R2    CBB,R6
         STW,R9   1,R2
         B        BSC%FB
*******************************************************
BSCDIO   EQU      %                 DO REAL I/O
         LI,R15   0                 :
         STW,R15  FBF,R6            SET UP NEWQ REGS BUF ALREADY
         STW,R15  BKD,R6            IN 13 AND BC IN 14 ENDAC IS
         LI,R0    ML%CTL            ML%CTL -- CONTROL CALLER IS SAVED
         SLS,R12  16
         AI,R12   PRIO**8
         OR,R12   RTRY,R6
         AND,R7   M8
         SLS,R12  8
         OR,R12   R7
         LW,R11   CIP,R6
         PSW,R11  TSTACK
         BAL,R11  NEWQ
         NOP
         LI,R11   0
         STW,R11  CIP,R6
         B        *R10
**************************************************
FORCWR   EQU      %                 TRY TO FORCE A BUFFER FULL
         STW,R12  CFC,R6            TO GET SOME DATA TO WRITE
         MTW,1    FBF,R6            :
         LW,R1    TTYP,R6           SET THE FORCE FULL FLAG
         LI,R11   FORCWR1           :
         XW,R11   BIP,R6            IF WE ARE NOT BUILDING NOW
         BEZ      BSC%BL0           OFF TO BUILD
         XW,R11   CIP,R6            :
         B        *R11              IF WE ARE BUILDING FIX IT SO THAT
FORCWR1  EQU      %                 BUILD EXITS TO US -- CONTROL
         LW,R12   CFC,R6            EXITS TO THE GUY WHO CALLED BUILD
         LW,R1    TTYP,R6           AND TAKE THE CONTROL EXIT NOW
         LW,R11   HWB,R6            :
         BNEZ     FWW,R1            GO TO SUCCESS OR FAILURE ROUTINE
FORCWR2  EQU      %                 BASED ON WHETHER WE GOT SOME DATA
         LI,R12   NWFCN             OR NOT
         B        FWN,R1
***********************************************
ML%CTL   EQU      %                 END ACTION FOR REAL LINE I/O
         LW,R6    RB:BUF,R7         :
         STW,R11  CIP,R6            SET UP 6,1 AND THE CONTROL LOCK
         LW,R1    TTYP,R6           :
         LB,R3    R12               IF WE GOT HUNG UP GO TO THE HANGUP
         CI,R3    HUTYC             ROUTINE
         BE       HANGUP            :
         STW,R3   LTYC,R6           FREE THE CWB IF ANY AND GO TO
         LI,R2    0                 THE APP CONTROL ROUTINE
         XW,R2    CWB,R6
         BEZ      CTLVEC,R1
         AI,R2    -1
         LI,R15   HBB
         ANLZ,R11 CTLVEC,R1
         B        BSC%FB
**********************************************
BSC%LGN  EQU      %                 TELL RBBAT ABOUT TERM LOGON REC RCVD
         LI,R12   LORR              :
         LW,R14   IOQ8,R3           WHEN DONE ZAP RMB ENDACTION
         SLS,R14  -2
         BAL,R0   TEL%RBBAT
         LI,R12   0
         STD,R12  IOQ13,R3
         B        0,R5
TEL%RBBAT EQU     %                 CALL RBBAT FROM HANDLER
         BAL,R4   RBSGCQP           :
         LI,R0    BSC%FL            IF NO BUFFS FOLLOWON
         PLW,R1   TSTACK
         B        *R0
**************************************************
RPT%ORG  EQU      %                 REPEAT CALLING FUNCTION
         LB,R5    IOQ4,R3
NEW%FLO  EQU      %                 START NEW FC IN R5
         STH,R5   DCT17,R1
         B        BSC%FL
****************************************************
BSC%GN   EQU      %                 LINE H.U. IN HANDLER
         LW,R5    HUBIT             :
         STS,R5   RB:FLAG,1         SET HUBIT
         OR,R13   HUBIT             :
         LI,R12   HUP               TELL RBBAT
         BAL,R0   TEL%RBBAT         :
         LI,R12    HUTYC            TELL ML%CTL
         B        BSC%PX1
BSC%HO   EQU      %                 HANG UP ROUTINE EXIT
         LW,R11   HIP,R6
         B        *R11
*****************************************************
BSC%PO   EQU      %                 PARSING ROUTINE EXIT
         LI,R14   PIP
BSC%GO   EQU      %                 GENERAL EXIT ROUTINE
         LI,R11   0                 :
         XW,R11   *R14,R6           CLEAR THE LOCK POINTED TO
         LW,R1    HUBIT             BY R14
         CW,R1    RB:FLAG,R7        :
         BAZ      ENBSR4            IF WE WERE HUNG UP THE LAST
         LW,R1    BIP,R6            INTERRUPT LEVEL (OUT OF A POSS-
         AW,R1    PIP,R6            IBLE 3) TO EXIT DRIVES INTO
         AW,R1    HIP,R6            THE APP HANGUP ROUTINE IF WE
         BNEZ     ENBSR4            ARENT ALREADY THERE
         STW,R11  HIP,R6
         LW,R1    TTYP,R6
         B        HUVEC,R1
*******************************************************
HANGUP   EQU      %                 H.U. REPORTED TO ML%CTL
         STW,R11  SAB,R6            :
         LI,R14   CIP               STOP BUILD AND EXIT - BSC%GO
         B        BSC%GO            WILL FINISH VIA HUBIT
*****************************************************
BSC%DSC  EQU      %                 IDLE: DISC IF DISCBIT SET
         LI,R11   DISCBIT+RBXBIT    :
         CW,R11   RB:FLAG,R7        EXITS SKIPPING IF NOT
         BAZ      1,R1
         STS,R11  RB:FLAG,R7
         B        0,R1
*******************************************************
*VECTORS TO CALL PROCESSES BY TYPE OF TERMINAL
*TO ADD A NEW ONE PICK A NEW VALUE (2 IS NEXT)
*FOR TTYP AND PUT AN APPROPRIATE INSTRUCTION
*IN EACH VECTOR  -- SMK
MPRSVC   B        H%PRS2            CONTINUE PARSING
         B        27P2              *
PRSVC    B        H%PRS1            BEGIN PARSING
         B        27P               *
PEOFVC   B        H%PEOF            PARSE EOF FOUND
         B        27PEF             *
2BTST    LW,R3    HWB,R6            TEST FOR SECOND BUFF LEGAL
         LW,R3    EOF,R6            *
MBLDVC   B        H%BLD3            CONTINUE BUILDING
         B        27BG              *
BLDVC    B        H%BLD             BEGIN BUILDING
         B        27B               *
FWN      B        H%CTL4            FORCE WRITE FAILED
         B        27DIO1            *
FWW      B        H%CTL3            FORCE WRITE WORKED
         B        27WRT             *
CTLVEC   B        H%CTL             CONTROL ENTRY
         B        27CTL             *
HUVEC    B        H%HU              HUNG UP ENTRY
         B        27HU
         END

