*M*      OPNTP    PERFORMS OPEN FOR DEVICE TAPE AND CONTAINS SUBROUTINES
*,*               IN SUPPORT OF TAPE OPEN.
*P*      NAME:    OPNTP
*,*      PURPOSE  OPENS DEVICE TAPES AND CONTAINS VARIOUS SUBROUTINES
*,*               FOR TAPE OPEN.
*,*      DESCRIPTION FOR DEVICE TAPE OPEN, FINDS THE TAPE IN THE AVR TABLES
*,*               OR REQUESTS THE OPERATOR TO 'MOUNT' THE TAPE AND
*,*               INITIALIZES AND SETS OPEN THE DCB
MONPROC  SET      1
ANSPROC  SET      1
         SYSTEM   UTS
         DEF      OPNTP:            PATCHIG DEF
OPNTP:   RES
*                 SIGMA 5/7         BPM M:OPNT
         PAGE
K0       EQU      X'0'
K10000   EQU      X'10000'
K1FFFF   EQU      X'1FFFF'
         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
SR1      EQU      8
SR2      EQU      9
SR3      EQU      10
SR4      EQU      11
D1       EQU      12
D2       EQU      13
D3       EQU      14
D4       EQU      15
         PAGE     REFS
*******************  DEF'S  ******************
************DATA**************
         DEF      LOCCODE1          ANLZ OBJECT TO COMPUTE *R7,R3
         DEF      VOL1              C'VOL1'
         DEF      Y45
         DEF      80UHL1            ANS USER LABEL HEADER
         DEF      80UTL1            ANS USER TRAILER LABEL HEADER
         DEF      :ACN              C':ACN'
         DEF      :LBL              C':LBL'
         SPACE    3
************ROUTINES*************
         DEF      ABN1411           SET 14 11 AND EXIT TO OPER
         DEF      ABN1413           SET 14 13 AND EXIT TO OPER
         DEF      ABN3001           SET 30 01 AND EXIT TO OPER
         DEF      CCCHK             HANDLE CODE CONVERSION OPTION
         DEF      CCCHK2            CHK FOR CHANGE TO CODE CONV OPTION
         DEF      CHKADR            VERIFY ADDRESSES IN USER AREA
         DEF      CHKFLACN          CHECK NAME AND ACCNT VLPS
         DEF      COMPARE           COMPARE WORD STRINGS MACRO
         DEF      DCBNCHK           CHECK DCB NAME FOR FILE EXTENSION
         DEF      DOCCMS1           DO NS TAPE OPTION MODE CONTROL
         DEF      DOCCSET           DO CODE CONVERSION MODE CONTROL
         DEF      GETACNADR         GET ADDRESS OF ACCOUNT VLP
         DEF      GETFILADR         GET ADDRESS OF NAME VLP
         DEF      GETFLG1           SET CC1-4 FROM TB:FLGS1(0-3)
         DEF      LOCCODE           SEARCH FOR VLP
         DEF      LOCCODEA          SEARCH FOR VLP WITH DATA
         DEF      MSRMOVE           MOVE WORD STRING
         DEF      OERX              DESTRUCT AND EXIT TO MSR01EXIT
         DEF      OPENER01          EXIT WITH ABN 01 00
         DEF      OPENER03          EXIT WITH ABN 14 00
         DEF      OPNT              OPEN DEVICE TAPE
         DEF      OPNT3             SET AVRTBL ENTRY BUSY
         DEF      OPNXTP            EXIT, AND IF ANS SET ANSFLGS
         DEF      PROTCHK           PERFORM LABEL AND RING PROTECT
         DEF      SECCHK            CHECK USER ACCESS TO XEROX TAPE FILE
         DEF      SETACOG           SET DCB ACS AND ORG
         DEF      SETASCII          SET DRIVE TO ASCII IF AVAILABLE
         DEF      SETEBCD           INITIALIZE DRICE TO EBCDIC
         DEF      SETOPN            SET DCB OPEN
         DEF      SIXPACK           CONVERT 6 CHAR SN TO ONE WORD
         DEF      TRNABRT           RELEASE BUFFER AND GIVE ABN 14 02
         DEF      TRNINFO           MOVE FPARAMS TO USER
         SPACE    5
*****************  REF'S  ****************
*
*************CONSTANTS***********
         REF      ACCN
         REF      ANSPRT
         REF      AVRTBLSIZ
         REF      BAQBUF
         REF      BATAPE
         REF      BT31TO0
         REF      DOUBLEONE
         REF      DOUBLEZERO
         REF      M7
         REF      M8
         REF      NBATAPE
         REF      NB31TO0
         REF      SH:OPNM
         REF      XCF
         REF      XFF
         REF      X1
         REF      X4
         REF      Y00FE
         REF      Y00FF
         REF      Y0014
         REF      Y002
         REF      Y01
         REF      Y04
         REF      Y2
         REF      Y4
*************VARIABLES*************
         REF      ANSFLGS           INPUT; OUTPUT;
         REF      AVRFLGS           INPUT; OUTPUT;
         REF      AVRFNMT           INPUT;BY19-23 OUTPUT;BY19-23
         REF      AVRTBL            OUTPUT;X'FFFFFFFF01FF0000' INPUT;B34
         REF      AVRID             CHECK IF TAPE MOVED
         REF      BOOTFLG           INPUT;
         REF      DCT13             INPUT;
         REF      J:JIT             INPUT;
         REF      JB:PRIV           INPUT;
         REF      S:CUN             INPUT;
         REF      SOLICIT           OUTPUT;
         REF      TB:FLGS           INPUT;X'C4'
         REF      TB:FLGS1          INPUT;X'C0'
         REF      UH:FLG            INPUT;X'1000'
         SPACE    5
***************FUNCTION REFS*******
         REF      ABN1403           BREAK OUT OF MOUNT
         REF      ABNRMB            ABNORMAL EXIT
         REF      ANSERR            ANS LABEL ERROR MESSAGES
         REF      ANSLINIT          SET UP TO READ ANS LABELS
         REF      ANSREEL           'ANS REEL NO' ERROR MSG
         REF      AOPNL1            TRANS VECTOR REFERENCE
         REF      CHKANS0           SKIP IF DCB NOT ANS
         REF      CHKREW            WAITS FOR REWIND COMPLETION
         REF      CLSLBL            TRANS VECTOR REFERENCE
         REF      CLSTP             TRAN VECTOR REFERENCE
         REF      GETASN            GET 3 BIT DCB:ASN
         REF      GETAVR            GET AVRTBL ENTRY AND AVRX
         REF      GETFUN            GET DCB:FUN
         REF      GETTYC            GET DCB:TYC
         REF      IOSPIN            WAIT FOR I/O COMPLETE
         REF      IOWT              WAIT FOR TAPE IO TO CMPLETE
         REF      JULIAN            CONVERT DATE TO JULIAN FORMAT
         REF      MODSET            DO MODE CONTROL COMMAND
         REF      MSRCLSLBL         TRAN VECTOR REFERENCE
         REF      MSRWRTX           NORMAL EXIT
         REF      MSR01EXIT         ABN/ERR EXIT
         REF      OPNLA             TRANS VECTOR REFERENCE
         REF      OPNLBL            TRANS VECTOR REFERENCE
         REF      OPNLO             TRANS VECTOR REFERENCE
         REF      OPNT2             INITIALIZE CIS
         REF      PLX1SR4           RETURN TO C(SR4)+1
         REF      PULLEXIT          RETURN TO ADDRESS IN TSTACK
         REF      PULLEXIT1         RETURN TO (ADDRESS IN TSTACK)+1
         REF      RDCLS             TRAN VECTOR REFERENCE
         REF      READTP            READ A RECORD
         REF      RELTP             TRANS VECTOR REFERENCE
         REF      REWTP             REW TAPE
         REF      RLSBF             RELEASE BUFFER
         REF      RMB               RELEASE MONITOR BUFFER
         REF      SETTYC            SET DCB:TYC
         REF      SKRECR            SKIP RECORD REVERSE
         REF      T:IACU            CHECK USER WRITE ACCESS TO PAGE
         REF      T:SELFDESTRUCT    ZAP OVERLAY
         REF      TAPECHK           GET/FIND TAPE OR DEVICE DISK VOLUME
ONE      EQU      1
         PAGE
         PAGE
         AI,0     %+1
*
         B        *0
         B        OPNLA
         B        OPNLO
         B        OPNT
         B        AOPNL1
         B        OPNLBL
         B        OPNT1
         B        RDCLS
         B        CLSTP
         B        MSRCLSLBL
         B        CLSLBL
         B        RELTP
         PAGE
         PAGE     OPNT
*                                   GET SERIAL NO. FOR TAPE
OPNT     EQU      %
*F*      NAME:    OPNT
*,*      PURPOSE  OPEN DEVICE TAPE
*,*      DESCRIPTION FINDS OR OBTAINS THE SPECIFIED TAPE AND INITIALIZES
*,*               AND SETS OPEN THE DCB
*D*      NAME:    OPNTP
*,*      CALL     OVERTO OPENTP,OPNT#
*,*      INTERFACE CALLS OPNT2, CCCHK, TAPECHK, DOCCSET, SETOPN
*,*      DESCRIPTION THE DCB IS INITIALIZED AS NEEDED FOR DEVICE TAPE.
*,*               NSTAPE OPTIONS ARE CHECKED FOR APPROPRIATENESS.
*,*               THE TAPE IS FOUND IN AVRTBL OR IS MOUNTED THRU OPERATOR
*,*               INTERACTION.  NECESSARY NSTAPE COMMANDS ARE THEN
*,*               EXECUTED AND THE AVRTBL IS SET OPEN.  THE DCB IS
*,*               SET OPEN. EXIT IS TO OPNX.
         BAL,2    OPNT2
*
OPNT1    EQU      %
*                      LEGALITY CHECK ASCII AND CHANGE AS REQUIRED
         BAL,SR4  CCCHK
         BAL,5    TAPECHK
         BAL,SR4  DOCCSET
*
         LI,D2    OPNT3A
OPNT3    RES      0
*D*      NAME:    OPNT3
*,*      REGISTERS R0-R3 VOLATILE
*,*      CALL     BAL,D2 OPNT3
*,*      OUTPUT   AVRTBL SET TO OPEN AND 1 USER
*,*      SCRATCH  R0,R1 CONTAIN AVRTBL ENTRY, R2=AVRX
*,*      DESCRIPTION SETS AVRTBL ENTRY TO OPEN AND NOU TO 1
         BAL,R3   GETAVR
         OR,R1    Y01               SET OPEN BIT
         AI,R1    K10000
         STD,R0   AVRTBL,R2         SET TO BUSY
         B        *D2
OPNT3A   RES      0
*
*
         BAL,0    SETOPN
         LI,D2    K1FFFF
         STS,D1   CLK,R6
*
OPNXTP   EQU      %
*D*      NAME:    OPNXTP
*,*      INTERFACE EXITS TO OPNX
*,*      DESCRIPTION STANDARD EXIT FOR ALL NORMAL TAPE OPENS
*,*               IF DCB IS ANS, THE ANS FLAG IS SET IN ANSFLGS.
         LI,R1    BADSI
         LB,R1    *R6,R1
         AI,R1    -BATAPE
         BLZ      OPNX
         CI,R1    AVRTBLSIZ
         BGE      OPNX
         LB,R4    ANSFLGS,R1
         AND,R4   M7
         BAL,R0   CHKANS0
         AI,R4    X'80'
         STB,R4   ANSFLGS,R1
*                    IF ANS OR LABEL U ORG, SET ACS TO BLOCKED
         CI,R4    X'80'
         BANZ     OPNX2             IS ANS
         BAL,R0   GETASN
         CI,D2    2
         BNE      OPNX              NOT LABEL
         LI,R3    X'70'
         AND,R3   ORG,R6
         CI,R3    X'40'
         BNE      OPNX              NOT U ORG
OPNX2    LI,R2    3                 FORCE BLOCK ACCESS
         LI,R3    X'F'
         STS,R2   ACS,R6
         B        OPNX
*
*
         PAGE
ASCVOL1  DATA     X'564F4C31'       ASCII 'VOL1'
*
BAAVRFNMT STB,SR4 AVRFNMT,R1
MVJXPR   GEN,8,24 5,19
*
         BOUND    8
80UHL1   GEN,24,8,32 ,80,'UHL1'
80UTL1   GEN,24,8,32 ,80,'UTL1'
Y45      DATA     X'45000000'
*D*      NAME:    SIXPACK
*,*      REGISTERS R1 THRU R5 ARE VOLATILE
*,*      CALL     BAL,SR4 SIXPACK
*,*      INPUT    R1=ADDRESS OF 6 CHARACTER INPUT
*,*      OUTPUT   R2=PACKED SN
*,*      DESCRIPTION PACKS A SIX CHARACTER SERIAL NUMBER INTO A SINGLE
*,*               WORD. STRIPS AWAY FIRST 2 BITS OF EACH CHARACTER,
*,*               PACKS NEXT 2 BITS INTO HIGH ORDER 12 BITS OF WORD,
*,*               AND CONVERTS LO ORDER 4 BITS INTO A BINARY NUMBER
*,*               AS THOUGH THE VALUES WERE DECIMAL DIGITS.
SIXPACK  EQU      %
         PUSH     3,R3
         LI,R5    0
         LI,R4    6
SIXPACK1 EQU      %
         LB,R3    0,R1
         AI,R1    1
         SLS,R3   26
         SLD,R2   2
         SLS,R3   -28
         MI,R5    10
         AW,R5    R3
         BDR,R4   SIXPACK1
         SLS,R2   20
         OR,R2    R5
         PULL     3,R3
         B        *SR4
         PAGE
PROTCHK  EQU      %                 SUBROUTINE TO PERFORM TAPE PROTECT
*D*      NAME:    PROTCHK
*D*      REGISTERS: 9-11,13-14 VOLATILE
*D*      CALL:    BAL,15 PROTCHK
*,*      INTERFACE ANSERR,READTP,SKRECR,IOSPIN,REWTP,SIXPACK,ANSLINIT,RMB,
*,*                 GETTYC,GETAVR,SETTYC,SETEBCD,JULIAN,GETFLG1,SETASCII
*,*      INPUT    R6=DCB ADDRESS, R12=TAPECHK FLAGS
*D*      OUTPUT:  8=10 TAPE OK, 8=-10 TAPE NO GOOD.
*D*               IF 8=-10, 0=10 IF TRY ANOTHER, 0 IF USER BREAK,
*D*                                 -10 IF KEYIN MOVED TAPE DRIVE.
*D*               ANSFLGS,AVRFLGS SET IN RESPONSE TO OVER,READ KEYINS
*,*      DESCRIPTION TAPE IS CHECKED FOR UNEXPIRED ANS LABEL OR OTHER
*,*               INCOMPATIBLITY(IE, TAPE OR DCB, BUT NOT BOTH, ANS).
*,*               THEN, IF INOUT, ALSO CHECKED FOR RING IN REEL.
*,*               FAILURE OF ANY CHECKS RESULTS IN OC INTERACTION WITH
*,*               OPERATOR.
         BAL,3    GETAVR            GET SN, INDEX ETC
         LW,3     0                 IN R3
         PUSH     7,15
         PUSH     12
         BAL,12   CHKREW            CATCH ANY PREVIOUS ATO ERRORS
         NOP                        RETURN TO BAL+2
         LW,3     Y00FE             AND RESET TYC
         STS,2    TYC,6
*                       IF NOT PROTECTED, SKIP TO RING CHK
         LW,R3    ANSPRT
         BLZ      PROT7T
*                      7T ANS NOT SUPPORTED, SO BYPASS CHECKS
         LI,R3    X'3F00'
         AND,R3   DSI,R6            TYPE
         SLS,R3   -8
         LB,R3    TB:FLGS,R3
         AND,R3   L(X'C4')
         CI,R3    X'80'             7T
         BE       PROT7T            YES
         LW,12    *TSTACK           RESTORE FLAGS
         CI,12    IN
         BANZ     PROTOK            SKIP PROTCHK FOR IN
*
         LB,R3    ANSFLGS,R2        CLR ERROR BITS
         AND,R3   XCF
         STB,R3   ANSFLGS,R2
         CI,R3    4
         BAZ      PROTOB2
*                    REOPEN OF IN MOUNT-IF AT LP, DO PROTCHK
         LB,D3    AVRFLGS,R2        DON'T ASK FOR RING IF PREVIOUSLY
         CI,D3    1                    GOT 'READ' KEYIN
         BANZ     PROT0B1           BR IF 'READ'
PROTOB2  CW,R1    =X'40007FFF'
         BAZ      PROT0B            AT LP, DO CHECKS
         CI,R3    4                 OK IF WEVE FOUND RING ALREADY
         BAZ      PROTOK3
         B        PROTNG
PROT0B1  EQU      %
         CI,12    OUT+OUTIN         IF INOUT, FORCE IN SINCE NOT AT LP
         BANZ     PROTNG            OR FORCE ERROR IF OUTPUT
         LI,SR2   -3**17
         AWM,SR2  FUN,R6
         B        PROTOKIN
PROT0B   EQU      %
         AND,R1   NB31TO0+25        CLR OPN FOR KEYIN/AVR
         STD,R0   AVRTBL,R2
         CI,R3    2
         BANZ     PROT2             'BLP' CHK PRIV, ETC.
         CW,R1    Y2                CHK IF AVR'D
         BANZ     PROT1
PROT0A   EQU    %    REW TAPE, CHK 1ST RECORD FOR VOL1
         BAL,SR4  SETEBCD
         BAL,0    ANSLINIT
PROT0C   EQU      %
         BAL,SR2  REWTP             REWIND
         BAL,SR2  READTP
         BAL,SR3  IOWT
         LW,D3    QBUF,R6           GET ADDRESS OF BUFFER
         LI,SR4   PROT3             SET RETURN FROM RMB
         BDR,R3   RMB               GOT ERROR
         LW,SR2   *D3
         CW,SR2   ASCVOL1           CHECK FOR ASCII LABELS
         BE       PROASC
         CW,SR2   VOL1              IS ANS TAPE
         BNE      RMB
         LW,12    *TSTACK           RESTORE FLAGS..0,1,2 SET BY IOWT
         CI,12    X'2000'
         BAZ      PROT4             BRANCH IF NOT ANS DCB.
         LW,R1    D3
         AI,R1    1                 STEP TO BA OF SN
         SLS,R1   2
         BAL,SR4    SIXPACK
         CW,R0    R2                DO SN.S AGREE
         BE       PROT4
         CI,R0    -1
         BE       PROTSN            ANSSCRATCH...SO SAVE SN
         LI,SR4   PROT3C
         CI,12    X'4000'
         BAZ      RMB
         CI,R0    0                 ASSURE AVR:SN SET
         BNE      PROT4
PROTSN   EQU      %
         STW,R2   SR4
         BAL,R3   GETAVR
         STW,SR4  0
         STD,0    AVRTBL,2          SAVE SN IN AVR
PROT4    EQU      %
         BAL,SR2  READTP            READ HDR1
         BAL,SR2  SKRECR             AND REPOSITION BEFORE HDR1
         BAL,3    GETAVR            GET AVR FLGS
         CW,1     Y2
         BANZ     %+2
         BAL,9    REWTP
         BAL,10   IOWT
         LW,D3    QBUF,R6
         BDR,3    RMBNG             HAD ERROR
         ANLZ,SR3 BAQBUF
         LW,R1    R2                AVR INDEX
         MI,R1    6*4
         ANLZ,SR4 BAAVRFNMT         BYTE ADDRESS AVRFNMT
         AW,SR4   MVJXPR
         MBS,SR3  48
         BAL,SR4  RMB
PROT5    EQU      %                 MUST BE EXPIRED TO WRITE
         LW,12    *TSTACK           REGET FLAGS
         BAL,SR4  JULIAN            SR1-2 = EBCDIC DATE
         BAL,R3   GETAVR
         LI,R1    6
         MW,R1    R2                FETCH TAPE EXP DATE F/AVR
         LW,SR3   AVRFNMT+4,R1      EXP DATE
         LW,SR4   AVRFNMT+5,R1
         OR,SR3   L(X'F0F0F0F0')    FORCE NUMERIC IN CASE OF ASCII
         OR,SR4   L(X'F0F0F0F0')
         AND,SR3  M8
         LI,R1    2                 NOT EXPIRED CODE
         CD,SR1   SR3
         BL       PROT6             INDEED ISNT
         CI,12    X'2000'
         BANZ     PROT3B            ANS OVER EXP ANS, WRITE ON IT
         LI,R1    3                 NO  'ANS VOL'
         B        PROT6
PROT2    EQU      %
         LB,1     JB:PRIV           CHK FOR C0 PRIV FOR BLP USER
         CI,1     X'C0'
         BGE      PROTOK2           TRUNDLE THRU TO THE END
         B        PROT0A
PROASC   EQU      %
         BAL,SR2  GETFLG1
         BCR,4    RMBNG             NO CAN DO
         BAL,SR4  SETASCII          READ IN ASCII
         LW,D3    QBUF,R6           RESTORE BUFFER ADDRESS
         B        PROT0C
PROT1    EQU      %
         LB,1     ANSFLGS,R2
         CI,1     X'80'
         BANZ     PROT5             TAPE IS ANS
PROT3    EQU      %                 TAPE NOT ANS
         BAL,R3   GETAVR
         LW,12    *TSTACK           RESTORE 12
         CI,12    X'2000'           DCB ANS
         BANZ     PROT3A            YES
PROT7T   EQU      %
         CW,1     Y2
         BANZ     PROTOK
PROT3B   EQU      %
         BAL,SR2  REWTP
         B        PROTOK
PROT3C   EQU      %
         BAL,SR2  REWTP
         LI,R1    1
         LI,SR4   ANSREEL
         B        PROT6A
PROT3A   EQU      %
         BAL,SR2  REWTP
         LI,R1    1                 'NOT ANS'
PROT6    EQU      %                 PUT OUT ERROR MESSAGE
         LI,SR4   ANSERR
PROT6A   EQU      %
         LI,R2    BADSI
         LB,R2    *R6,R2
         AI,R2    NBATAPE
         STB,R1   SOLICIT,2         SET SOLICIT NON-ZERO
         LW,R4    R1
         LB,D4    ANSFLGS,2
         SLS,R4   4
         OR,D4    R4
         AND,D4   NB31TO0+3         RESET READONLY
         AW,R1    TERR
         CI,R1    X'100'
         BAZ      %+3
         AI,D4    4                 UNLESS RING REQUEST
         LW,R1    L('RING')         ENTRY FROM PROTOKIO
         STB,D4   ANSFLGS,2
         PUSH     R1                SAVE R1 FOR BELOW
         BAL,SR4  *SR4
         PULL     R4                MESSAGE WORD
         CI,R0    0                 DID USER ABORT OR SOMETHING
         BLE      ABN1403           SURE DID
         BAL,R3   GETAVR
         LI,0     -10               SET MOVED TAPE FLAG
         LW,3     S:CUN
         CH,3     AVRID,2
         BNE      PROTNG1
         LB,1     ANSFLGS,R2
         CW,R4    L('RING')
         BE       PROTOK1           RETURN FROM SPECIAL ENTRY
         CI,1     X'30'             CHK ERR FLAGS-0=OVER RESPONSE
         BANZ     PROTNG
PROTOK   EQU      %
*                   WRITE RING CHECK
         BAL,R3   GETAVR            AVR IX TO R2
         LW,D1    *TSTACK           RESTORE FLAGS
         CI,D1    IN
         BAZ      PROTOKIO
*                   IN-SET IN ONLY
PROTOKIN EQU      %
         LB,R3    ANSFLGS,R2
         OR,R3    X4                SET IN ONLY
         B        PROTOK3
PROTOKIO EQU      %                 INOUT-DO CHECK
         BAL,10   IOWT
         CI,R3    8                 LESS THAN ERROR IS OK
         BGE      PROTNG
         LW,R3    R0                GET SN
         LD,0     DCT13+BATAPE+BATAPE,2 GET TDV STATUS
         CW,1     Y4
         BANZ     PROTOK2           OK-RING IN
         LI,R1    X'103'            3 FOR ERR FLAG
*                                     100 FOR 'NOT ANSERR'
         B        PROT6             DO MSG,WAIT KEYN,RETURN
PROTOK1  EQU      %                 RETURN FROM TYPR
         AND,1    XCF
         CB,1     ANSFLGS,R2
         STB,1    ANSFLGS,2         CLEAR ERROR BITS
         BNE      PROT3B            SHOULD HAVE RING NOW
         LW,12    *TSTACK           RESTORE FLAGS
         CI,D1    OUT+OUTIN         NO 'READ' FOR OUTPUT
         BANZ     PROT3B
         LB,D1    AVRFLGS,R2
         OR,D1    X1                SET 'READ' KEYIN RECVD
         STB,D1   AVRFLGS,R2
         B        PROTOKIN
IN       EQU      X'100'
OUT      EQU      X'200'
INOUT    EQU      X'400'
OUTIN    EQU      X'800'
PROTOK2  EQU      %
*        CHECK AND SET CC/DD NOW
         BCR,8    PROTNDD           NO
         LW,1     Y04               CHECK SPECIFICATION
         AND,R1   ACS,R6
         SCS,R1   13
         AI,R1    X'100'            SET DENSITY FLAG FOR MODSET
         LB,0     AVRFLGS,R2
         AND,0    NB31TO0+8         CLEAR
         BAL,SR4  DOCCMS1           DO DD SETUP
PROTNDD  RES
         BAL,SR4  DOCCSET           DO CODE CONVERSION TOO
         BAL,3    GETAVR            RESTORE AVR INDEX
         LB,R3    ANSFLGS,R2
         AND,R3   NB31TO0+3         CLR RD BIT
PROTOK3  EQU      %
         STB,R3   ANSFLGS,R2
         LI,SR1   10
         B        PROTX
RMBNG    BAL,SR4  RMB               RELEASE BUFFER
PROTNG   EQU      %
         LI,0     10
PROTNG1  EQU      %
         LI,1     -6                PUT R0 IN TSTACK'S R0
         STW,0    *TSTACK,1
         LI,SR1   -10
PROTX    EQU      %
         PULL     12
         PULL     7,15
         B        *15
TERR     TEXT     'ANS0'
         PAGE     'ROUTINES FROM OBSE'
K2       EQU      2
K9       EQU      X'9'
K1       EQU      X'1'
K3       EQU      X'3'
K4       EQU      X'4'
K5       EQU      X'5'
K6       EQU      X'6'
K14      EQU      X'14'
K4000    EQU      X'4000'
KF0      EQU      X'F0'
KFFFF    EQU      X'FFFF'
KN1      EQU      -X'1'
         BOUND    8
NONE     TEXT     'NONE'
ALL      TEXT     'ALL'
         PAGE
OPENER01 LI,SR3   K1
*D*      NAME:    OPENER01
*,*      CALL     B OPENER01
*,*      DESCRIPTION SETS ABN CODE 01 - 00 AND EXITS TO OERX
*E*      ERROR:   01 - 00  INSUFFICIENT INFORMATION GENERAL
*,*                        EXIT FOR TAPE
         B        OERX
OERXM1   PULL     SR3               RESTORE ERROR CODE
OERX     EQU      %
*D*      NAME:    OERX
*,*      DESCRIPTION ALL OPEN ERRORS AND ABNORMALS COME HERE TO
*,*               DISASSOCIATE THE OPEN OVERLAY.
         LI,11    MSR01EXIT
         B        T:SELFDESTRUCT
OPNX     EQU      %
         LI,11    MSRWRTX
         B        T:SELFDESTRUCT
*
*
*
*
LOCCODEA EQU      %
*D*      NAME:    LOCCODEA
*D*      REGISTERS R1, R3, R4, R7, & D2 ARE VOLATILE
*D*      CALL     R5 IS THE LINK, SKIPPING EXIT IF FOUND
*D*      DESCRIPTION  FIND A SIGNIFICANT VLP ENTRY
*D*      INPUT    D1 HAS REQUESTED VLP CODE
         BAL,R4   LOCCODEB
         B        0,R5              DIDN'T FIND CODE
         LI,R1    K2
         LB,R1    D2,R1             CURRENT SIZE
         BEZ      0,R5              DIDN'T FIND
         B        ONE,R5
LOCCODEB LW,R7    FLP,R6
LOCCODE  EQU      %                 LOCATE CODE OF VARIABLE LENGTH
*D*      NAME:    LOCCODE
*D*      REGISTERS R3,D2 VOLATILE
*D*      CALL     R4 IS LINK, SKIPPING EXIT IF FOUND
*D*      INPUT    D1 HAS REQUESTED VLP CODE
*D*      DESCRIPTION FIND A VLP ENTRY
         LI,R3    K0
LOCCODE1 LW,D2    *R7,R3
         AI,R3    K1
         CB,D1    D2
         BE       ONE,R4
         CW,D2    Y00FF             DONE
         BANZ     0,R4
         AND,D2   XFF
         AW,R3    D2
         B        LOCCODE1
*
         SPACE    3
GETFUNA  EQU      %
         LW,D1    FUN,R6
         CW,D1    Y0014             CHK OUTIN & OUT
         B        *D2
         SPACE    3
*
COMPARE  EQU      %                 COMPARE WORD STRING
         LI,R0    K2
COMPL    RES      0
*D*      NAME:    COMPARE
*D*      REGISTERS R0,R2,R3,& D2 ARE VOLATILE
*D*      CALL     SR4 IS THE LINK
*D*      INPUT    STRING POINTERS IN R7 & D3, R7 OFFSET IN R3
*D*      DESCRIPTION  COMPARE WORD STRINGS
         LW,D2    *R7,R3
         CW,D2    *D3,R2
         BNE      BISR4             NO COMPARE, GO TO SR4
         AD,R2    DOUBLEONE
         BDR,R0   COMPL
         B        PLX1SR4           DO COMPARE, GO TO SR4+1
         SPACE    3
MSRMOVE  EQU      %
*D*      NAME:    MSRMOVE
*D*      REGISTERS  R0,R2,R3,& D2 ARE VOLATILE
*D*      CALL     SR1 IS THE LINK
*D*      INPUT    STRING POINTERS IN R7 & D3, R7 OFFSET IN R3
*D*               D3 OFFSET IN R2.
*D*      DESCRIPTION  MOVE WORD STRINGS
         AW,R0    R3                R0 = END DISPLACEMNT
         B        MSRMOVE1
MSROPN14 LW,D2    *R7,R3            XFER FILE PARAMS
         STW,D2   *D3,R2
         AD,R2    DOUBLEONE
MSRMOVE1 EQU      %
         CW,R3    R0
         BL       MSROPN14
         B        *SR1
GETACNADR EQU     %
         LI,R2    HAACD
         B        GETFILADR+1
GETFILADR EQU     %
*D*      NAME:    GETFILADR
*,*      REGISTERS R2 VOLATILE
*,*      CALL     BAL,R0 GETFILADR
*,*      OUTPUT   R7=ADDRESS OF FILE NAME(01) VLP
*,*      DESCRIPTION COMPUTES R7=C(DCB:FLD)+C(DCB:FLP)
         LI,R2    HAFLD             GET ADDRESS OF FILE NAME
         LH,R7    *R6,R2
         AW,R7    FLP,R6
         B        *R0
CHKFLACN EQU      %
*D*      NAME:    CHKFLACN
*D*      REGISTERS  ALL VOLATILE
*D*      CALL     R0 IS THE LINK
*D*      DESCRIPTION  CHK TO SEE THAT THE DCB HAS SUFFICIENT
*D*               INFORMATION AND SPACE TO OPEN A FILE.
         LI,D4    K1FFFF            MUST HAVE KEY BUFFER
         AND,D4   KBUF,R6
         BEZ      OPENER03
*                                   MUST BE SPACE FOR ACCOUNT NUMBER
         LI,D1    K1                MUST HAVE FILE NAME
*                                   CHECK FOR NEXT OPTION
         LW,D3    Y01               CLR X'4000' FOR USR RESET
         AND,D3   NXTF,R6
         BNEZ     CHKFLACN3         SPECIFIED
*
         BAL,R5   LOCCODEA
         B        OPENER03
         LW,R2    *R7,R3
         LB,R2    R2                CHK NAME LEGAL
         BEZ      OPENER03          CAN'T BE ZERO
         CI,R2    FNEMAX
         BL       1A1
*
OPENER03 EQU      %
*D*      NAME:    OPENER03
*,*      CALL     B OPENER03
*,*      DESCRIPTION SETS ABN CODE 14 00 AND EXITS TO OERX
         LI,SR3   K14
OPER     RES      0
         PUSH     SR3               SAVE ERROR CODE
         LI,SR4   OERXM1            SET RETURN
         B        *SR4
1A1      SLS,R2   -2                WORD ALIGN
         AND,D2   XFF               # WDS AVAIL
         CW,R2    D2
         BL       CHKFLACN5         THERE'S ENUF ROOM
         LI,SR3   1                 NOT ENUF RUUM
         B        OPER
*
CHKFLACN3 BAL,R4  LOCCODEB
         B        OPENER03
         CI,D2    X'F8'             MUST BE 8 WORDS OR MORE
         BAZ      OPENER03          LESS THAN 8
CHKFLACN5 EQU     %
         LI,R2    HAFLD             SAVE FILE NAME DISP
         STH,R3   *R6,R2
*
*
*
         LI,D1    K2
         BAL,R4   LOCCODE
         B        OPENER03
*                                   SET UP ACCOUNT NO
         CI,D2    X'FE'             2 WORDS REQUIRED
         BAZ      OPENER03          BAD NEWS
         LI,R2    HAACD
         STH,R3   *R6,R2
         LW,R1    J:JIT+ACCN
         LW,R2    J:JIT+ACCN+1
         CI,D2    X'FF00'
         BANZ     CHKFLACN1         USER SPEC'D AN ACCT
         LCI      2
         STM,R1   *R7,R3
         B        CHKFLACN2A        CLR USR FLG
*
CHKFLACN1  EQU    %
         CW,R1    *R7,R3
         BNE      CHKFLACN2         DIFFERENT FILE
         AI,R3    1
         CW,R2    *R7,R3
         BE       CHKFLACN2A
CHKFLACN2  EQU    %
         LI,D3    K4000
CHKFLACN2A   EQU  %
         LI,D4    K4000
         STS,D3   USR,R6
         B        *R0
*
*D*      NAME:    SECCHK
*,*      REGISTERS ALL VOLATILE
*,*      CALL     BAL,R0 SECCHK
*,*      INTERFACE CALLS LOCCODE, COMPARE
*,*      INPUT    D3=ADDRESS OF BUFFER CONTAINING :BOF
*,*               R3=DISPLACEMENT IN BUFFER TO START OF VLP'S
*,*      DESCRIPTION SKIPPING EXIT IS TAKEN IF USER MAY ACCESS FILE IN
*,*               MANNER INDICATED BY DCB:FUN.  OK IF USER PRIV=C0,
*,*               OR IF FILE IS NOT PASSWORDED OR PASSWORD IN DCB MATCHES
*,*               THAT IN :BOF AND EITHER IS USERS FILE OR HIS
*,*               ACCOUNT IS IN THE READ OR WRITE ACCOUNTS OR ALL IS
*,*               INDICATED.
SECCHK   EQU      %                 CHECK SECURITY
         PUSH     1,R0
*                                   MONITOR CAN OPEN ALLFILES
         LB,4     JB:PRIV
         CI,4     X'C0'
         BGE      PULLEXIT1
SECCHK0  LI,D1    K3
         BAL,R4   LOCCODE
         B        SECCHK1           PASSWORD IS NOT SPECIFIED
         CI,13    X'FF'
         BANZ     SECCHK05          PASSWORD HAS REAL WORDS
SEC3     LI,D2    K4000
         STS,D1   USR,R6
         B        PULLEXIT1         YES PERMIT NULL ACCESS
SECCHK05 EQU      %
         LW,R2    R3
         BAL,R5   LOCCODEA
         B        CLRFIB
         BAL,SR4  COMPARE
         B        CLRFIB
         LW,R7    D3                GO BACK AND CHECK ACCOUNTS
SECCHK1  EQU      %
         LI,D1    K4000             IS THIS USERS OWN FILE
         AND,D1   USR,R6
         BEZ      PULLEXIT1         YES--CAN READ OR WRITE
         LI,D1    K6                WRITE ACCTS
         BAL,R4   LOCCODE
         B        SECCHK4
SECCHK2  LI,SR2   X'FF'
         AND,SR2  D2
SECCHK2B LW,D2    *R7,R3
         CLM,D2   NONE
         BCR,12   SECCHK3
         BE       SECCHK2R
         LI,D3    J:JIT
         LI,R2    ACCN
         BAL,SR4  COMPARE
         B        SECCHK2A
SECCHK3  CI,D1    K6
         BNE      PULLEXIT1
         B        SEC3
SECCHK2A AW,R3    R0
         AI,SR2   KN1
         BDR,SR2  SECCHK2B
SECCHK2R CI,D1    K6
         BE       SECCHK4           TRY FOR READS
         B        PULLEXIT          NO ACCESS
SECCHK4  RES      0
         BAL,D2   GETFUN
         CI,D1    14
         BANZ     PULLEXIT
         LI,D1    K5                READ ACCTS
         BAL,R4   LOCCODE
         B        PULLEXIT1       DEFAULT IS READ ALL
         B        SECCHK2
*
CLRFIB   EQU      PULLEXIT
*
SETACOG  EQU      %                 SET ACCESS AND ORGANIZATION
*D*      NAME:    SETACOG
*D*      REGISTERS  ALL VOLATILE
*D*      CALL     SR4 IS LINK
*D*      DESCRIPTION  SET ACCESS & ORGANIZATION.  ALSO GET
         BAL,D2   GETFUNA
         BANZ     PPSET0X
         LI,D1    K9
         BAL,R4   LOCCODE           GET FILE INFO
         B        PPSET0X
*                                   R3 = DISPLACEMENT OF CODE
         LW,D2    *R7,R3
         LB,D1    D2                ORG
         SLS,D1   K4
         LI,R1    BAKEYM
         LH,R0    D2                KEYM
         STB,R0   *R6,R1
PPSET0   LI,D2    X'70'
         STS,D1   ORG,R6
PPSET0X  EQU      %
         LI,R3    3                 ASSUME CONSEC
         LI,1     BAKEYM
         LI,2     X'20'
         CW,2     ORG,R6            ORGTEST
         BAZ      SETACOG3B         IT'S CONSEC
         LB,R3    *R6,R1
         BNEZ     SETACOG3A
SETACOG3C AI,R3   11
SETACOG3B   EQU   %
         LW,R0    SR4
         STB,R3   *R6,R1
         AI,R3    1
SETSCR   LI,R2    BASCR
         STB,R3   *R6,R2
         B        *R0
SETACOG3A  EQU    %
         CI,R3    FNEMAX-1          KEY CAN'T BE TOO LARGE
         BLE      SETACOG3B
         LI,R3    FNEMAX-1
         B        SETACOG3B
FRSTWRD  GEN,8,8,8,8 1,0,FNEMAX/4+1,FNEMAX/4+1
         SPACE    3
TRNINFO  RES      0
*D*      NAME:    TRNINFO
*,*      REGISTERS VOLATILE EXCEPT R6
*,*      CALL     BAL,SR1 TRNINFO
*,*      INTERFACE CALLS CHKADR,TRNABRT,MSRMOVE
*,*      DESCRIPTION IF THE DCB HAS AN FPARAM ADDRESS, THE LIMITS OF
*,*               THE ADDRESS ARE CHECKED FOR USER WRITE ACCESS. IF BAD
*,*               EXIT IS TO TRNABRT. OTHERWISE, 90 WORDS OF VLP INFO
*,*               IS TRANSFERRED FROM THE :BOF TO THE USERS FPARAM AREA
         LI,D3    X'1FFFF'
         AND,D3   FPARAM,R6
         BEZ      *SR1
         LI,D2    89
         BAL,R2   CHKADR            RETURN IF D3 THRU D3+D2 IS USERS
         BNE      TRNABRT           FPARAM NOT IN USER AREA
         LW,R7    QBUF,R6           INPUT FROM QBUF+1 IF TAPE
         AI,R7    1
TRNINFO1 LI,0     89
         LD,2     DOUBLEZERO
         B        MSRMOVE+1
         SPACE    3
CHKADR   LW,R7    D3             CHECK D3 AND D3+D2 FOR USER AREA
*D*      NAME:    CHKADR
*,*      REGISTERS VOLATILE EXCEPT R6, D3, D2
*,*      CALL     BAL,R2 CHKADR
*,*      INTERFACE CALLS T:IACU
*,*      INPUT    D3=START ADDRESS TO CHECK
*,*               D2=NUMBER OF WORDS IN CHECK AREA
*,*      OUTPUT   CC1 & CC2 =0 IF USER HAS WRITE ACCESS TO AREA
*,*      DESCRIPTION FIRST AND LAST PAGE OF BUFFER IS CHECKED FOR THE
*,*               USER HAVING WRITE ACCESS. IF NOT A CONDITION CODE
*,*               OF OTHER THAN EQUAL IS RETURNED UNLESS
*,*               BOOTFLG IS NON-ZERO AND THE USER HAS SPECIAL JIT ACCESS.
         AW,R7    D2
         SLS,R7   -9
         BAL,11   T:IACU
         BCS,3    CHKADR1           BAD ADDRESS, CHK SJAC
         LW,R7    D3
         SLS,R7   -9
         BAL,11   T:IACU
         BCR,3    0,R2
CHKADR1  LW,R7    BOOTFLG
         BNEZ     CHKADR2
         LCI      3
         B        0,R2
CHKADR2  LW,R7    S:CUN
         LH,R7    UH:FLG,R7
         EOR,R7   BT31TO0+13
         AND,R7   BT31TO0+13        SETS EQ IF BIT WAS SET, ELSE NE
         B        0,R2
         SPACE    3
DCBNCHK  EQU      %
*D*      NAME:    DCBNCHK
*,*      REGISTERS VOLATILE EXCEPT R6, R7
*,*      CALL     BAL,SR4 DCBNCHK
*,*      INPUT    R6=DCB ADDRESS
*,*      OUTPUT   D2=BIT FOR THIS DCB'S FILE EXTENSION FLAG
*,*      DESCRIPTION IF THE DCB NAME IS 4 CHARACTERS LONG , STARTS
*,*               WITH M:, AND ENDS WITH AN OPLABEL D2 IS SET WITH A BIT
*,*               FOR THAT DCB'S FILE EXTENSION FLAG AND THE RETURN IS
*,*               SKIPPING
         LW,R5    TSTACK
         LW,R4    -4,R5
         LB,SR1   R4
         LI,R5    J:JIT
         LW,D1    0,R4
         LW,D2    1,R4
         SLD,D1   -8
         CI,D1    X'4D47A'
         BNE      BISR4
         SLD,D1   16
         LI,R2    17                # ENTRIES FOR FILE EXTENSION
         LI,D2    KFFFF
OPFIND1  LH,D3    SH:OPNM,2         FIND M:II OPLB
         CS,D1    D3
         BE       OPFIND2           MATCH
         BDR,R2   OPFIND1
         CW,D1    MGODCB            M:GO ISN'T IN TABLE
         BNE      *SR4
         LI,R2    1                 M:GO IS FIRST ENTRY
OPFIND2  RES      0
         LI,D2    K1
         SLS,D2   -1,R2
         AI,SR4   1
BISR4    RES      0
         B        *SR4
MGODCB   TEXT     'M:GO'
*
         SPACE    3
SETOPN   LW,D1    Y002
*D*      NAME:    SETOPN
*D*      REGISTERS  D1 & D2 ARE VOLATILE
*D*      CALL     R0 IS THE LINK
*D*      DESCRIPTION  SET THE DCB OPENED AND RESET THE TYC FIELD
         LW,D2    Y002C3
         STS,D1   FCD,R6
         B        SETTYC
Y002C3   DATA     X'002C3000'
         PAGE
TRNABRT  EQU      %                 DO 14 02 ERROR
*D*      NAME:    TRNABRT
*,*      INTERFACE EXITS TO OPER
*,*      DESCRIPTION RELEASES BLOCKING BUFFER VIA RLSBF, SETS ABN 14 02,
*,*               AND EXITS TO OPER
         BAL,SR4  RLSBF
         LW,SR3   L(2**25+X'14')
         B        OPER
         SPACE    3
ABN3001  EQU      %                 BAD USER HEADER
*D*      NAME:    ABN3001
*,*      DESCRIPTION SET ABN CODE 30 01 AND EXITS TO ABNRMB
*
*E*      ERROR:   30 - 01  GENERAL ROUTINE FOR BAD USER LABELS
*
*D*      NAME:    GETFLG1
*,*      CALL     BAL,SR2 GETFLG1
*,*      SCRATCH  R1=DCTX
*,*      DESCRIPTION SETS CONDITION CODES FROM HI ORDER DIGIT OF TB:FLGS1
*,*               FOR THE RESOURCE INDICATED BY THE DCB
         LW,SR3   %+2
         B        ABNRMB
         ERRABNCD X'30',1
         SPACE    3
GETFLG1  EQU      %          SETS COND CODE FROM HI-ORDER TB:FLGSI
         LI,1     X'3F00'
         AND,1    DSI,6
         SLS,1    -8
         LC       TB:FLGS1,1
         B        *SR2
         SPACE    3
DOCCSET  EQU      %
*D*      NAME:    DOCCSET
*,*      REGISTERS VOLATILE EXCEPT R6
*,*      CALL     BAL,SR4 DOCCSET
*,*      INTERFACE CALLS GETFLG1, GETAVR, MODSET
*,*      DESCRIPTION IF AVRTBL:AVR IS SET(INPUT, UPDATE, OR AVR'D OUTPUT)
*,*               DCB:CCF IS SET FROM AVRFLGS:CCF. OTHERWISE
*,*               AVRFLGS:CCF IS SET FROM DCB:CCF AND THE APPROPRIATE MODE
*,*               CONTROL COMMAND IS EXECUTED.
         BAL,3    GETAVR
         CW,1     Y2
         BAZ      DOCCSET1
*
         LB,0     AVRFLGS,2
         SLS,0    1
         LI,1     X'80'
         STS,0    ORG,R6
DOCCSET1 EQU      %
         LW,SR2   SR4
         LI,R1    X'80'
         AND,R1   ORG,R6            GET DCB:CCF
         BNEZ     SETASCII
*
SETEBCD  EQU      %
*                   SETS AVRFLGS:CC TO EBCDIC IF DRIVE HAS CC
*                   AND DOES MODE SET
         LI,15    0
SETCC    EQU      %
*                   ENTRY POINT COMMON TO SETEBCD/ASCII
         BAL,SR2  GETFLG1
         BCR,4    *SR4              NO CC SO DONT TRY
*
         BAL,R3   GETAVR            RESTORE AVRX
         LW,1     15
         LB,0     AVRFLGS,2
         AND,0    NB31TO0+7         CLR CC
*
*
DOCCMS1  EQU      %
*D*      NAME:    DOCCMS1
*,*      REGISTERS VOLATILE EXCEPT R6
*,*      CALL     BAL,SR4 DOCCMS1
*,*      DATA     CCMS TABLE- CONTAINS MODE CONTROL COMMANDS
*,*               INDEXED BY 0=NO CODE CONV
*,*                  1=CODE CONV
*,*                  4=1600 BPI
*,*                  6=800 BPI
*,*                  OTHER VALUES PRODUCE INDETERMINENT ERRORS
*,*      INPUT    R1=CCMS INDEX**6, WHICH INCLUDES A 'SET' VALUE FOR
*,*               AVRFLGS
*,*      DESCRIPTION BITS 23-24      OF R1 ARE OR'D TO HI ORDER 2 BITS
*,*               OF AVRFLGS TO INDICATE LAST MODE CONTROL FOR THAT DRIVE
*,*               AND BITS 22-24 ARE THEN USED TO SELECT THE MODE CONTROL
*,*               COMMAND FROM CCMS AND EXECUTE IT, SETTING THE DESIRED
*,*               OPTION.
         LW,SR2   SR4
         OR,0     1                 NEW CC BIT
         STB,0    AVRFLGS,2
         SLS,1    -6                RT JUSTIFY
         LW,15    CCMS,1
         B        MODSET            DOIO W/ R15=CODE
CCMS     DATA     X'08000000',X'10000000'  0,1 CODE CONV-NO,YES
:ACN     TEXT     ':ACN'            2
:LBL     TEXT     ':LBL'            3
         DATA     X'80000000'       4 SET 1600 BPI
VOL1     TEXT     'VOL1'            5
         DATA     X'40000000'       6 SET 800 BPI
*
SETASCII EQU      %
*                   SETS AVRFLGS:CC TO ASCII IF DRIVE HAS CC
*                   AND DOES MODE SET
         LI,15    X'40'
         B        SETCC
CCCHK    EQU      %
*D*      NAME:    CCCHK
*,*      REGISTERS R0,R1,R2,SR2,SR3 VOLATILE
*,*      CALL     BAL,SR4 CCCHK
*,*      INTERFACE USES GETFLG1
*,*      INPUT    R6=DCB ADDRESS, SR4=LINK
*,*      OUTPUT   GIVES ABNORMAL RETURN IF ERROR DETECTED
*,*      DESCRIPTION CHECKS DCB:CCF, DCB:DDF, TB:FLGS1 FOR CODE
*,*               CONVERSION AND DENSITY SELECTION LEGALITY
*,*               FOR DEVICE TYPE.
         BAL,SR2  GETFLG1
         BCS,4    CCCHK1            CC OK, CHECK DD
*
         LI,R0    X'80'
         AND,R0   ORG,R6            DCB:CCF
         BEZ      CCCHK1            NOT ASCII...OK, CHECK DD
*
ABN1411  EQU      %
*D*      NAME:    ABN1411
*,*      DESCRIPTION SETS 14 11 ABN CODE AND EXITS TO OPER
*E*      ERROR:   14 - 11  CODE CONVERSION REQUESTED ON DRIVE WITHOUT ITT
         LW,SR3   L(X'11'**25+X'14')
         B        OPER              REQUESTED ASCII ON DRIVE W/O CC
CCCHK1   EQU      %                 CHECK DD
         LC       TB:FLGS1,1
         BCS,8    *SR4
         LW,0     Y04
         AND,0    ORG,R6            DCB:DDF
         BNEZ     ABN1412
         B        *SR4
*
*
CCCHK2   LB,R0    AVRFLGS,R2
*D*      NAME:    CCCHK2
*,*      REGISTERS R0, R1 VOLATILE
*,*      CALL     BAL,SR4 CCCHK2
*,*      INPUT    R2=AVRX, R6=DCB ADDR
*,*      DESCRIPTION COMPARES THE CODE CONVERSION FIELDS OF THE DCB AND
*,*               AVRFLGS, AND IF THEY DISAGREE AN ABNORMAL 14 13
*,*               IS RETURNED
         SLS,R0   1
         AND,R0   BT31TO0+8
         LI,R1    X'80'
         AND,R1   ORG,R6
         EOR,R1   R0
         BEZ      *SR4              DCB AND AVR SAME
*
ABN1413  LW,SR3   L(X'13'**25+X'14')
*D*      NAME:    ABN1413
*,*      DESCRIPTION SETS ABN CODE 14 13 AND EXITS TO OPER
*
*E*      ERROR:   14 - 13  CODE CONVERSION REQUESTED ON ANS TAPE
*,*                        NOT AT LOAD POINT OR ON XEROX LABELED TAPE
*
         B        OPER
*
ABN1412  LW,SR3   L(X'12'**25+X'14')
         B        OPER
         END

