         DEF      OUTSYM:
OUTSYM:  EQU      %
         PSR      0                 *DONT LIST SUPPRESSED CODE
         PCC      0                 *DONT LIST CONTROL INFO
*
*        A00  RJR  08:30  05/08/73  'A00G'.
*        A00  RJR  20:00  04/18/73  'A00D'(DONE ON SIG 7E).
*        A00  RJR  13:54  04/12/73 'A00D.1'  .
*        A00  RJR  13:35  04/03/73   'A00C.1'  PRE7- #0325.
*        E00  RJR  19:48  03/27/73  'A00.2'.
*        E00   RJR   19:43   3/09/73   'A00.1'.
*        E00   RJR   12:30   1/8/73  'INITIAL'.
*        D00 RJR  19:30 10/24/72.
*   ##            16:00  04/24/72  RJR  *
*
*        THINGS TO DO
*                 ...SPILL OPERATIONS...
*                 ...RESTORE OPERATIONS...
*                 ...IMAGE OPERATIONS...
*                 ...SPOOL OPERATIONS...
*                 ...PROCESS ABORT...
*                 ...SPEC SERVICES...(HEAD/FOOT)
*
*                                    - SIGMA 6/9 CP-V OUTSYM.
*                 CATALOG NO. 70XXXX - SIGMA 6/9 UTS OUTSYM.
*                 CATALOG NO. 704935 - SIGMA 5/7 BPM M:SYMPPRTY
         SYSTEM   UTS
         DEF      SYMPPRTY
         DEF      OSDEA             *OUTSYM DEVICE END ACTION
         DEF      OSFEA             *   ''  FILE    ''   ''
         DEF      BADDA2            * PABRT ENTRY TO OSERRLOG
         DEF      OS%EA             * OFFSET B4 OS%REG AT EA
OS%EA    EQU      EA                * (USE OUTSYM PARTICULAR EXTRNL)
         DEF      OSDEA0            * DEV EA AOK SO CHK SIGNALS
         DEF      OS%UDAP           * OUTSYM SUBR:UPDATE DA PTRS
         DEF      OSDEA00           * NO SIGNALS--PROCESS NEXT ENTRY
         DEF      OSDEA0A           * ASSUME 'Q'SIG ENTRY
         DEF      OSDEA00A          * CHK BLOCK END ENTRY(RCC IN HAND)
         DEF      OSDEA5            * SET UP DEV IO AND DOIT ENTRY
         DEF      OSDEA51           * DO FILE IO ENTRY(ALL SETUP)
         DEF      OSFEA4            * FILE EA AND AOK SO QFACT ETC ENTRYY
         DEF      OS1D              * SETUP AND DO FILE IO ENTRY
         DEF      OS09A             * NEXT DA IN HAND QUIT OR CONTINUE
         DEF      OS%REG            * OS: SETUP THE REGS SUBR
SPFL     SET      0
         DO       SPFL
         DEF      OSFVEA            *   ''   '' VOLUME  ''  ''
         DEF      OSDVEA            *   ''  DEVICE ''   ''  ''
         FIN
SYMPPRTY EQU      %
         PAGE
R4       FNAME
         PROC
         DO1      1-SCOR(CF(2),R4)
*        ERROR,1  'ILLEGAL USE OF BASE REGISTER'
         PEND     4
         PCC      0
         OPEN     BASE
         OPEN     B,BNEZ,BE,BNE,BEZ,BG,BCR
         OPEN     BLEZ,BLE,BAL
         OPEN     BCS,BSNE,BGE,BGEZ
         OPEN     BSE,BL,BLZ,LW,LM,OR,ANLZ
         OPEN     BIR,BDR,BANZ,BAZ,BGZ
BASE     SET      SYMPPRTY
BNEZ,BNE CNAME    X'693'
B        CNAME    X'680'
BEZ,BE   CNAME    X'683'
BCR      CNAME    X'68',1
BLEZ,BLE CNAME    X'682'
BAL      CNAME    X'6A',1
ANLZ     CNAME    X'44',1
BCS      CNAME    X'69',1
BSNE,BGE,BGEZ CNAME X'681'
BSE,BL,BLZ CNAME  X'691'
LW       CNAME    X'32',1
OR       CNAME    X'49',1
LM       CNAME    X'2A',1
BIR      CNAME    X'65',1
BDR      CNAME    X'64',1
BANZ     CNAME    X'694'
BAZ      CNAME    X'684'
BGZ,BG   CNAME    X'692'
         PROC
         LOCAL    IFE,A
IFE      SET      'INSTRUCTION FORMAT ERROR'
       DO ((TCOR(S:IFR(AF(1)),BASE))=0=0)&(CS(BASE)=CS(S:IFR(AF(1))))
A        SET      AF(1)-BASE
   ERROR,,(AFA(1)=0=0)|(AF(2)=0=0)|((NAME(2)=0)&(CF(2)=0=0)) IFE
         ERROR,,(AFA(1)=0=0) 'NO AFA ALLOWED'
         ERROR,,(AF(2)=0=0) 'NO INDEX ALLOWED'
         ERROR,,((NAME(2)=0)&(CF(2)=0=0)) 'ILLEGAL CF'
LF       GEN,1,7+4*(1-NAME(2)),4*NAME(2),3,3,14 0,NAME(1),CF(2);
         ,4,0,A
         ELSE
LF       GEN,1,7+4*(1-NAME(2)),4*NAME(2),3,3+14 AFA(1);
         ,NAME(1),CF(2),AF(2),AF(1)
         FIN
         PEND
         CLOSE    BASE
*
*
LSBR     CNAME                      LOAD SYMBIONT BASE REGISTER
         PROC
         DO       SCOR(AF(1),EA)
LF       LW,4     *R14
         ELSE
LF       LW,4     *SR3
         FIN
         PEND
*
LSCP     CNAME                      LOAD SYMBIONT CONTEXT POINTER
         PROC
LF       LW,1     SR3
         PEND
*
PABRT    CNAME
         PROC
         LOCAL    L,L1
         DO       1
         LI,SR4   AF(1)+W
         DO       CF(2)<16
         BCR,CF(2) BADDA2
         FIN      CF(2)
         ELSE
         DO       CF(2)=0=0
         BCS,CF(2)&15 %PEND
         FIN      CF(2)
         BAL,R7   BADDA2
         GEN,8,8,8,8 S:UT(AF(2))
         FIN
*L(AF(1)-X'40F0') SET AF(1),AF(2),%,AF(3)
         DO       0
L1       SET      AF(1)&X'F'+((AF(1)&X'F00')**-4)
L(L1)    SET      AF(1),AF(2),%,AF(3)
         FIN
%PEND    SET      %
         PEND
*
LIEA     CNAME                      LOAD IMMEDIATE INTERNAL
         PROC                       END ACTION ADDRESS
LF       LI,CF(2) AF-SYMPPRTY       GET ABSOLUTE ADDRESS
         AW,CF(2) R4                AND BASE
         AND,CF(2) M17              DELETE SYMX
         PEND
*
         PAGE
*
*                             PROGRAM NAME - BATCH MONITOR.
*
         SPACE    5
*
*        MODULE: OUTSYM                          CP-V A00 RON RILEY
*
*        GENERAL NAMEING CONVENTION
*                 OS PREFIX FOR SYMBIONT LABELS.
*                 OSF - FOR FILE SIDE PROCEDURE.
*                 OSD - FOR DEVICE SIDE PROCEDURE.
*                  ENDING IN A DIGIT- MODULE GLOBALS.
*                  ENDING IN A LETTER- LOCALS.
*                 ...EA... - IMPLIES END ACTION.
*                 ...DA    - IMPLIES DISC ADDRESS.
*                 SC PREFIX FOR SYMBIONT CONTEXT BLOCK.
*                   F AND D MEANING AS ABOVE.
*
*                 OTHER LETTERS SHOULD BE OBVIOUS.
*
*        REGISTER CONVENTION
*                 REGISTERS DEFINED ARE USED AND ARE VOLATILE.
*                 SR3(R10) CONTAINS PROCESS FUNCTIONS CONTEXT POINTER
*                          (SC...).
*                 R1 USUALLY CONTAINS SC FOR INDEXING EASE.
*                 R4  CONTAINS SYMBIONT BASE ADDRESS FOR RUN-TIME
*                          RELOCATION.
*                 R0 USUALLY CONTAINS SC FLAGS FROM SCDEVTYP.
*                 D2(R13) USUALLY CONTAINS CURRENT SIGNAL CHARACTER.
*                    A,B,C,I,L,P,Q,R,S,X
*                 R3 CONTAINS SYMB TABLE INDEX FOR PROCESS FUNCTION.
*                 SR1(R8) TYPICALLY CONTAINS SOME DISC ADDRESS(DA)
*                 SR2(R9) IS USED AS THE SUBGLOBAL LINK REG.
*                 SR4(R11) CONTAINS THE SYMB EXIT UNLESS THIS IS
*                   IN THE STACK(BIRD IN BUSH), IN WHICH CASE IT
*                   MAY BE USED AS THE GLOBAL LINK REG.
*                 D3(R14) TYPICALLY CONTAINS THE DATA BUFFER WA.
*                 ALL OTHER REGISTERS AND THOSE MARKED 'TYPICALLY'
*                  AND 'USUALLY' MAY BE USED AS TEMPS AS CONVENIENT.
*
*
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R5       EQU      5
R6       EQU      6
R7       EQU      7
SR1,R8   EQU      8
SR2,R9   EQU      9
SR3,R10  EQU      10
SR4,R11  EQU      11
D1,R12   EQU      12
D2,R13   EQU      13
D3,R14   EQU      14
D4,R15   EQU      15
*
         PAGE
OLDCXT   SET      0
         DO       OLDCXT
         REF      SCFCO             *  FILE COUNTER(SINCE INIT)
         REF      SCGCO             *2*GRAN COUNTER(THIS FILE)
         REF      SCPCO             *  PAGE COUNTER(THIS FILE)
         REF      SCRCO             *  RECORD COUNTER(THIS FILE)
         FIN
         REF      SCFLDA            * FORWRD LINK D A
         REF      SCBLDA            * BACK LINK D A
         REF      SCCDA             * CURRENT D A
         REF      SCDCDA            * DEV Q ARGS CDA.
         REF      SCFBUF            * FILE BUFFER POINTER
         REF      SCFEA             * FILE SIDE E.A. ADDR DISP
         REF      SCDBI             * DEV DATA BYTE INDEX
         REF      SCDBC             * DEV BYTE COUNT
         REF      SCDQARGS          * DEV QUEUE ARGUMENTS
         REF      SCGCNT            *GRANULE COUNT
         REF      SCRTRY
         REF      SCFQARGS          * FILE QUEUE ARGUMENTS
         REF      SCTYC             * FILE/DEVICE TYPE OF COMPLETE
         REF      SCBESTDA          SYMBIONT CONTEXT BEST
*                                   ,  DISC ADDRESS
         REF      SCTOFDA           * LAST TOF DISC ADDR.
         REF      SCSVDGI           SYMBIONT CONTEXT SAVED
*                                   , GHOST INFORMATION
         REF      SCBUDA
         REF      SCDALST
         REF      SCDALSZ
         REF      SCDEVTYP          * SYMB CNTXT DEVICE TYPE FLG
         REF      SCBSIZ            * SYMB CNTXT DISP TO BLK SIZ
MLBF     SET      1
         DO       MLBF
         REF      SCXTRAB           * EXTRA BUFFER LIST
         SREF     OS%MLBFI          * MULTI BUF INIT. ROUTINE
         REF      S:SIBTU           *SYMB IMAGE BUFFS TO USE
         FIN      MLBF
         REF      SCBUPPT           *BACKUP POINT
         REF      SCBUPPTS          *  ''     ''    SAVE
         DO       OLDCXT
         REF      SCDQFC            * DEV Q FUN CODE LIST
         REF      SCRCVLST          *  DELETE GRAN RCVR LIST
         FIN
         REF      SCSWIT            * RB SWITCH CNTXT POINT
         REF      M17               * X'1FFFF'
*
BASCBANC EQU      SCDBI+SCDBI+SCDBI+SCDBI   -- SMK 10/1/73 CHNGD
NORMTYC  EQU      Y01               *NORMAL COMPLETION
PGABRTTYC EQU     X'10'             * PAGE ABORT
HUTYC    EQU      2                 *HUNG UP COMPLETION
BUTOG    EQU      Y01               *BACKUP TOGGLE SIGNAL
1STDBI   EQU      4                 * 1ST DATA BYTE INDEX
RESTOREBIT EQU    X'100'            *
         DO1      MLBF
XTRABGETBIT EQU   X'400'            * SC FLAGS
SPILLBIT EQU      X'200'            *
W,WEIRD EQU       X'20000'  * OBSCURE STH CC MOD
EOSB     EQU      X'40'             *END OF SYMBIONT BLOCK RCC
1EOF%FLAG EQU     X'800'            *FLAG FORCES TERM AFTER 1
*                                      FILE IF SET
LIST     EQU      4                 *X'40' BIT IN TB:FLGS IS
*                                     LISTING DEVICE BIT
DELFLAG  EQU      Y008              * RELEASE GRANULES FLAG
         REF      Y008              * =X'00800000'
TYPMSK   EQU      X'FF'             *WIDTH OF SCDEVTYP TYPE FIELD
PAGE     EQU      4                 *CC2 FROM X'40' IN SKIP BYTE IS TOF
*                     (FOR TWO REASONS: POSS NOVFC&VARIABLE VFC CONVENTIONS)
RESSPLPFBIT EQU   X'1000'           * SCDEVTYP SAYS IS RESTORE OR SPOOL
IMRESPFBIT EQU    X'2000'           *               IS IMAGE OR RESTORE
ALGNBIT  EQU      BT31TO0+21    Y001
WEOFBIT  EQU      BT31TO0+23    Y004
CPYBIT   EQU      BT31TO0+22     Y002
NWEOFBT  EQU      NB31TO0+23
NCPYBT   EQU      NB31TO0+22
NALGNBT  EQU      NB31TO0+21
DLCKBIT  EQU      BT31TO0+20     Y0008
NDLCKBT  EQU      NB31TO0+20
M19      EQU      MASKS+19
         REF      MASKS
         PAGE
         REF      C:CSC             * PERF COUNT
         REF      TB:FLGS           * DEV TYPE FLAGS(PARELLELS TYPEMNE)
         REF      SYMX              * SYMBIONT STREAM FLAG TABLE
         REF      QFACT             * QUEUE FOR ACTIVATION
         REF      QFACTP11          * QUEUE FOR ACT(PULL 11)
         REF      SRELBUF           * SYMB RELEASE CORE BUFF
         REF      M24               * =X'00FFFFFF'
         REF      YFF               * =X'FF000000'
         REF      M31               * =X'7FFFFFFF'
         REF      SNDDX             * SYMB NDD INDEX
         REF      REQCB             * REQUEST CORE BUFF
         REF      NEWQ              * END-ACTION QUEUE IO
         REF      RSG               * RELEASE SYMB GRAN
         REF      SSIG              * SYMB SIGNAL CHAR
         REF      SSTAT             * SYMB STATUS
         REF      CHKDA             * CHECK DISC ADDR
         REF      Y01               * =X'01000000'
         REF      Y02               * =X'02000000'
         REF      COPERLG           * COOP ERRLOG INTERFACE
         REF      RELCB             * RELEASE CORE BUFFER
         REF      PULLEXIT          * PULL R0;B *R0
         REF      SRET              * SYMB RETURN POINT
         REF      SAQNSERT          * SYMB ACTIVATE QUE INSERT
         REF      AOFP              * ADD OUTPUT FILE PARTIAL
         REF      Y00FF             * =X'00FF0000'
         REF      GOF               * GET OUTPUT FILE GFC
         REF      SGCQ              * SYM GHO CALL Q SUBR
         REF      SGCBUF            * SYM GHO CALL BUFFER
         REF      SGCRA             SYM GHO COMM REL BUF (ALTERNATE)
         REF      SWTINIT           * RB SWITCH INITIALIZER(RBBAT DIRECTED)
         REF      SWTEND            * RB SWITCH WRAP-UP
         REF      RBLIMS            REM BATCH DCTX LIMITS
         REF      QFP11NCB          QFACT,PULL11,NO COMM BUF
         REF      QFPD4CB           QFACT PULL 11 DECREMENT 4 NO C.B.
         REF      @SGCBUF           P-Q-R ADDER
         REF      XFF               * =X'000000FF'
         SREF     SSSBIT            * RBT HAND SUSP-SWITCH-SYMB BIT
         SREF     RB:FLAG           * REM BAT WORD TAB: (FLAGS)
*
         REF      TERM              TERMINATE SYMBIONT EXIT ROUTINE
         SREF     OCPSEND           * IMAGE ONE BLOCK ENTRY
         SREF     OCPFEA            * IMAGE FILE SIDE E.A.
         REF      SUSP              SUSPEND SYMBIONT EXIT ROUTINE
         REF      BL:OFS            * BAT LIM: OUT FIL SLOTS
         REF      SPOOL             * BUFFER POOL HEAD.
         REF      M:FPPH            * FREE PAGE POOL HEAD.
*
*
*
PRTBIT   EQU      Y2                PARTIAL FILE
         REF      Y2
         PAGE
*SYYNDD-CARD PUNCH/PRINTER/TYPEWRITER SYMBIONT-SELF RELOCATING
*RE-ENTRANT FROM SYMBIONT ACTIVE ROUTINE
*HAVE ASSUMED SYMBIONT CONTEXT BUFFERS START ON EVEN MEMORY LOCATIONS
*(R3)=SYMBIONT SYMTAB INDEX
*(R4)=SYMBIONT BASE ADDRESS
*(SR3)=CONTEXT BLOCK ADDRESS
*(TSTACK)=SYMBIONT EXIT       (BIRD IN BUSH).
*        B        0,R2              ENTRY FROM SACT.
         SPACE    5
         LI,R1    1                 ONE TO CONTEXT BLOCK INDEX
         STB,R1   SSTAT,R3          SET SYMBIONT STATUS ACTIVE
*
*
OS0      EQU      %
         BAL,SR2  OS%REG            CONTEXT BLOCK ADDRESS
         LW,SR1   SCFLDA,R1         DISC FILE ENDED
         BNEZ     OS2
         XW,SR1   SCBLDA,R1         SET BLINK ZERO
         BEZ      OSEND
         LB,R14   SYMX,R3
         CI,R14   4                 WRITE EOF
         BAZ      OSEND
         LW,R8    SCBESTDA,R1
         MTB,-1   R8
         BNEZ     OSEND1A
         LW,R2    SCDBI,R1
         OR,R0    WEOFBIT
         STW,R0   SCDEVTYP,R1
         LI,R0    0                 * EOF= 0 BYTE COUNT
         STW,R2   SCBUPPTS,R1
         B        OSDEA5            * Q THE WEOF
*
*
OSEND    EQU      %
         LI,R8    0
         XW,R8    SCCDA,R1          EMPTY CONTEXT
         BEZ      OS02C
***************************************************
         LW,R8    SCBESTDA,R1       COPIES MEAN NOT DONE
         MTB,-1   R8
         BEZ      OSEND1
OSEND1A  EQU      %
         STW,R8   SCBESTDA,R1
         OR,R0    CPYBIT
         STW,R0   SCDEVTYP,R1
         B        OSDF
*********************************************
OSEND1   EQU      %                 EOF GRAN RELEASE
         CW,R0    DELFLAG
         BANZ     OSEND1C
***************************************************
OSEND1B  EQU      %                 RELEASE WHOLE FILE BY CALLING RBBAT
         LI,R12   X'12'
         LW,R13   SCSVDGI,R1        FILE IS DELETED BY ADDING BACK
         STB,R12  R13               WITH DELETE PRIORITY (X'12)
         STW,R13  SCSVDGI,R1
         BGEZ     %+2
         BAL,R9   *SWTEND
         BAL,R9   OS%AOFP
         B        OSEND2
****************************************************
OSEND1C  EQU      %                 RELEASE RECOVERY STACK
         LW,R8    YFF
         BAL,R9   OS%RSG1
         CW,R8    YFF
         BNE      %-3
****************************************************
OSEND2   EQU      %                 RELEASE SYMBIONT BUFFER
         LSCP
         BAL,R9   OS%RLCB
         B        OS%TERM0          WRITE END OF FILE IF NEEDED
******************************************************
OSEND3   EQU      %                 GO TO SWTEND IF NEEDED
         LW,R9    SCSVDGI,R1
         BGEZ     OS02B
         BAL,R9   *SWTEND
********************************************************
OS02B    EQU      %
         LI,R9    'I'
         STB,R9   SSIG,R3
OS02C    EQU      %
*
*                           *THE DISC FILE CAN BE ENDED
*                                   * BECAUSE WE NEVER HAD ONE
         BAL,SR2  OS%REG            * SETUP REGISTERS
         CI,R0    1EOF%FLAG         * ARE WE AN EOF TERM ON 1 FILE STREAM
         BANZ     TERM              YES, TERMINATE
*                                   NO, CHECK LOCK       & GOF
*                                   *SIGNAL SAYS TO
         CI,D2    'L'               LOCK SYMB.
         BE       TERM              YES, TERMINATE EXIT
         AND,R0   M19
         STW,R0   SCDEVTYP,R1
         DO       SPFL
*
         CI,R0    RESSPLPFBIT       * IT IS RESTORE OR SPOOL
         BANZ     OS11              * YES, SKIP AHEAD
         FIN
         SPACE    3
*
*GET SYMBIONT OUTPUT DISC FILE
*
*                                   ENTERED AT BASE AND
*                 DISK FILE ENDED AND RECOVERY STACK EMPTIED
*                 AND NOT LOCKED AND THUS WE GET A NEW OUTFILE
         SPACE    2
         LB,D1    SNDDX,R3          * DCTX
         SLS,D1   8                 *
         AI,D1    GOF               *  D1=0,SYMTABX,DCTX,GFC 8,8,8,8
         STH,R3   D1                *
         LI,D2    -1                * RECOVERY FLAG(MARKED)
         BAL,D3    OS%SGCQ                COMPUTE SRET
*                                   *BEFORE LOSING R4
*
         EQU      %                 BACK VIA ACTIVE Q
         LB,R1    R2                * BUF #
         LW,D1    SGCBUF+2,R1       * MISC ARGS(PRI,RBID,SYSID 8,8,16)
         LW,SR1   SGCBUF+1,R1       * COPIES,SDA 8,24
         LW,R2    R10
         STW,R8   SCBESTDA,R2
         STW,R12  SCSVDGI,R2        BESTDA PRECEEDS SRET
         LW,R12   SGCBUF+3,R1
         STW,R12  SCGCNT,R2
         STW,R1   SRET,R3           * CLEAR BUF #(IN CASE RCVR)
*
*        R1                         * BUF TO UN-Q
         ANLZ,D1  @SGCBUF           * ADD-EM-UP *
         BAL,R4   SGCRA             * RELEASE ANSWER BUF *
         LSCP                       * RES SYMBIONT CONTEXT POINT
         LSBR                       * RESTORE CLOBBERED SYMB
         LI,D2    1STDBI            *---- TOP OF BUFFER IS
         STW,D2   SCRTRY,R1
         STW,D2   SCBUPPT,R1        *---- FIRST BACKUP OFFSET
         STW,SR1  SCBUPPT+1,R1      *---- FDA IS FIRST BACKUP DA
         LI,R2    NEWQ
         STW,R2   SCSWIT,R1
*                                   * BASE ADDRESS FOR BASE REG
         INT,R5   SCSVDGI,R1        * DID RBBAT SAY SWITCH THIS ONE
         BCR,8    %+2               * NOPE , CONTINUE
         BAL,SR4  *SWTINIT          *YES, THEN SETUP.
*
OSDF     EQU      %
         LI,R12   0
         MTB,-1   R8
         BNEZ     OSDF1
         LC       SYMX,R3
         BCS,1    OSDF1             'KEEP' FLAG
         LW,R12   DELFLAG
OSDF1    EQU      %
         LW,D2    DELFLAG           * MASK FOR ZAP
         STS,D1   SCDEVTYP,R1       * MUST NOT DELETE N-TH COPY
OS09A    EQU      %
         AND,SR1  M24               * SENSE FILE RETURNED
         BEZ      OS%TERM0A
         BAL,R9   OSCLST
         STW,R15  SCBLDA,R1
         STW,R15  SCTOFDA,R1
         STW,R15  SCTOFDA+1,R1
*
         LC       SYMX,R3           * THERE IS A FILE SO
         BCR,8    %+3               * COPY THE SINGLE EOF
         LI,D2    1EOF%FLAG         * TERM FLAG TO CONTEXT
         STS,D2   SCDEVTYP,R1       * IF IT'S SET
OS2      EQU      %
         LI,R9    1STDBI
         STW,R9   SCDBI,R1
         PAGE
*SET UP DISC FILE READ CONTROL BLOCK IN CONTEXT BLOCK
*(SR1)=DISC FILE ADDRESS
*                                   (BIRD IN BUSH.)
*
OS1      EQU      %
         AND,R8   M24
         STW,SR1  SCCDA,R1          FILE DISC ADDRESS TO CONTEXT CUR
*
*
         BAL,R9   OS%RLCB
*        U=R0,R1,R2,R14(D3)  REQCB
OS11     BAL,SR4  REQCB             REQUEST CORE BUFFER FOR FILE DATA   935
         LSCP                       CONTEXT BLOCK ADDRESS
         STW,D3   SCFBUF,R1         CORE BUFFER ADDRESS TO SC
         DO       MLBF
         LW,R0    SCDEVTYP,R1       ***FETCH UP FLAGS
         CI,R0    XTRABGETBIT
*                                   IS IT SPILL,RESTORE OR IMAGE
         BAZ      OS1C              * NONE OF ABOVE
*
*
*        INITIALIZE THE MULTI BUFFER LIST
*
         BAL,SR2  OS%MLBFI          * MULTI BUF INIT
*        I= R1(SCP),SR3(SCP),R4(SBR)
*        O=       THE MULTI BUF LIST IS MADE TO EXIST IN CNTXT
*        U= SR4,D1,D2,D3,D4(R11-R15)
*        NON-VOLATILE : R5-SR3(R5-R10)
*        MAY RESTORE R1 AND R4 FROM SR3.
*
OS1C     EQU      %                 *
         FIN      MLBF
         DO       SPFL
         CI,R0    RESSPLPFBIT       * IT IS RESTORE OR SPOOL
         BANZ     OS1D              * YES, SKIP AHEAD AGAIN
         FIN      SPFL
         PAGE
*SET UP TO READ DISC GRANULE
*
OS12     EQU      %                 *
         LW,SR1   SCCDA,R1          PICK UP NEW CURRENT D A
         BAL,SR4  CHKDA             INSURE FLINK OK
         LSBR
*                 (NOTE WE CAN'T AFFORD TO FAIL CHKDA UNTIL
*                  WE'VE GOT A BUFFER FOR THE ERRMSG).
         PABRT,8  ' 1','FCDA','FILE SIDE CDA BAD'
*
         MTW,1    C:CSC
OS1D     LCI      5                 *NUMBER OF NEWQ ARGS
         LM,R12   SCFQARGS,R1       *
         LH,R9    R15
         AND,R9   DCT%MASK
         REF      DCT%MASK
         OR,R12   R9
         SLS,R13  2                 * WA TO BA
         AND,R13  M24               * AND CLEAN
*
*        ALL REGS VOLATILE EXCEPT R5-SR4(R11)
         LI,R2    NEWQ              * IOQ ENTRY.
         BAL,SR2  OSDEA53           * QUEUE DISC ACCESS
         PABRT    ' 7','FDEV','FILE DEVICE DOWN'
         PAGE
*
*DISC READ END ACTION
*(R6)=BUFFER ADDRESS
*(SR1)=DCB ADDRESS
*(SR3)=CONTEXT BLOCK ADDRESS
*(SR4)=EXIT                         (BIRD IN HAND.)
OSFEA    EQU      %
         LSBR     EA                RESTORE SYMBIONT BASE ADDRESS
         BAL,SR2  OS%REG-EA         *
         SPACE    5
*
         BAL,SR2  OS%UDAP           * UPDATE DA POINTERS
         LI,SR2   4
         STW,SR2  SCRTRY,R1
*                                   * AOK RETURN
TYC%NO%GOOD  SET  1
*
         DO       TYC%NO%GOOD
*
         B        OSFEA4
*
         ELSE
*
         CW,R12   NORMTYC
         BLE      OSFEA4
         BAL,R9   QFACTP11
         PABRT    ' 3','FTYC','BAD FILE TYC'
*
         FIN
         SPACE    5
         DO       SPFL
OSFVEA   EQU      %
         LSBR     EA
         BAL,SR2  OS%REG-EA
         CW,R12   NORMTYC
         BLE      OSFEA52
         PABRT    ' 8','VTYC','BAD FILE VOLUME TYC'
         FIN
         PAGE
*
OS%RSG   EQU      %                 * U=R0,SR1,SR4,D3,D4,R2
*                                   *  (NOTE:BIRD IN BUSH.)
         LC       SYMX,R3
         BCS,2    *R9               LEAVE LIST ALONE FOR OCP
         LW,R8    SCCDA,R1
         CI,R8    1
         BCS,5    *R9
         LW,R0    SCDEVTYP,R1
         CW,R0    DLCKBIT
         BAZ      OS%RSG1
         AND,R0   NDLCKBT
         LW,R14   SCDALST+SCDALSZ-1,R1
         BEZ      OS%RSG1A
         CW,R8    R14
         BNE      *R9
         STW,R0   SCDEVTYP,R1
         B        *R9
OS%RSG1A EQU      %
         STW,R0   SCDEVTYP,R1
OS%RSG1  EQU      %
         LI,R14   SCDALSZ
         AI,R1    SCDALST+SCDALSZ
         AI,R1    -1
         XW,R8    0,R1
         BEZ      %+2
         BDR,R14  %-3
         LW,R14   0,R1
         LSCP
         STW,R14  SCBUDA,R1
         AI,R8    0
         BLEZ     *R9
         CW,R8    SCBUDA,R1
         BE       *R9
         LW,R0    SCDEVTYP,R1
         CW,R0    DELFLAG
         BAZ      *R9
         LW,R11   PRTBIT
         STS,R11  SCSVDGI,R1
         MTW,-1   SCGCNT,R1
         LW,R11   SCBESTDA,R1
         LB,R11   R11
         STB,R11  R14
         STW,R14  SCBESTDA,R1
         STW,R8   SCBUPPTS,R1
OS%RSG2  EQU      %
         BAL,R11  RSG
         LSCP
         AI,R8    0
         BNEZ     *R9
         STW,R9   SCBUPPTS+1,R1
         BAL,R9   QFACTP11
         LW,R8    SCBUPPTS,R1
         LW,R9    SCBUPPTS+1,R1
         B        OS%RSG2
         SPACE    5
*
*SYMBIONT RETURN FROM DATA ERROR
*CONSTRUCT ERROR MESSAGE IN DATA BUFFER FOR TYPE OUT AND SUSPEND
BADDA1   EQU      %
         MTW,-1   SCRTRY,R1
         BLEZ     %+3
         STW,R0   SCBLDA,R1
         B        OS12
*                                   * '...BLK BAD 2'
         PABRT,16 ' 2','BLNK','BAD BLINK DA'
*
BADDA2   EQU      %                 *
         LSCP                       CONTEXT BLOCK ADDRESS
         LW,D3    SCCDA,R1          *---- CDA FOR ERRL W3
         STB,SR4  D3                *---- ERR TYPE TO ERRL W3 B0
         LW,D2    TIME              *---- TIME OF DAY TO ERRL W2
         REF      TIME              *---- TIME OF DAY
         LI,SR4   X'1B03'           *---- NEW ERRL CODE AND COUNT
         LB,R3    *SR3              *---- RESTORE SYMTABX
         LB,D1    SNDDX,R3          *---- DCTX FOR ERRL W1 B3
         STH,SR4  D1                *----  CODE AND COUNT TO W1 B0-1
         LI,R6    R12               *----POINT AT ERRLOG MSG
         BAL,R5   ERRLOG            *---- LOG IT
         REF      ERRLOG            *---- SYSTEM ERR RECORDER
         LI,D1    0                 *---- CLEAR
         STW,D1   SCBESTDA,R1       *---- BEST DISS ADDRESS
         LB,R7    SNDDX,R3
         LI,R1    13                SYYNDD DISC BLOCK BAD
         BAL,R11  OCQUEUE
         REF      OCQUEUE
         LSBR
         BAL,R9   OS%REG            *---- RESTORE REGISTERS
         B        OSEND2
*
         PAGE
*
*SYMBIONT SUCCESSFUL DISC READ RETURN
*
*LP RECORD=132 BYTES MAX.(FORMATTED-1ST BYTE CONTROL,UNFORMATTED 1ST
*BYTE CHARACTER),LP AUTOMATICALLY INCLUDES TRAILING SPACES ON SHORT
*RECORDS.
*TY RECORD=80 BYTES(ONE LINE) ARBITRARY MAX.(FORMATTED-CONTROL BYTES
*MAY BE THRU OUT RECORD),SHORT RECORDS NO PROBLEM
*CP RECORD=120 BYTES FIXED FOR BINARY,80 BYTES FIXED FOR BCD,SHORT
*RECORDS MUST BE ZERO FILLED FOR BINARY,SPACES FILLED FOR BCD
         SPACE    5
OSFEA4   BAL,R9   QFACTP11
         BAL,SR2  OS%RSG            * RELEASE CURR(AFTER LSCP)
         BAL,SR2  OS%REG            * LOAD SPEC REGS
         BNEZ     OSDEA0
*
*        THE BIRD IS NOW IN THE BUSH.
*
         LI,R2    1STDBI+2
         LW,R14   SCFBUF,R1
         LB,R11   *R14,R2
         AND,R11  %+1-SYMPPRTY,R4
         CI,R11   X'88'             X'88' IN FC SAYS DONT BLINK CHK NEXT
         BNE      OS0
         LI,R11   -1
         STW,R11  SCBLDA,R1
         B        OS0
         DO       SPFL
         SPACE    5
OSDVEA   EQU      %
         LSBR     EA
         BAL,SR2  OS%REG-EA
         STW,R12  SCTYC,R1
         CW,R12   NORMTYC
         BLE      OSDEA0
         PABRT    ' 9','VTYC','BAD DEVICE VOLUME TYC'
         FIN
         PAGE
*PUNCH,PRINT,OR TYPE RECORD ON DEVICE END ACTION
*
         SPACE    5
OSDEA    LSBR     EA                LOAD SYMBIONT BASE REG
         BAL,SR2  OS%REG-EA         * AND ALL THE LITBLE REGS.
*
*        CHECK RECORD OUTPUT COMPLETION TYPE
*
         STW,R12  SCTYC,R1          *
         LW,D3    R15               * EA BUF TO EVEN REG.
         LW,D4    BUTOG             * BACKUP TOGGLE BIT
         CS,D3    R0                * IS SAME-SAME
         BE       OSDEAB            * YES-YES
         STS,R14  R0
         AND,R0   NCPYBT
         STW,R0   SCDEVTYP,R1
         LCI      2                 * 2 WORD ENTRY
         LM,D3    SCBUPPTS,R1       *SAVED BACKUP POINT
         STM,D3   SCBUPPT,R1        * DEFINE BACKUP POINT.
OSDEAB   EQU      %                 *
         CW,R12   Y02               * IS NORMAL
         BL       OSDEA0            * NO, ERROR
         LB,D3    R12               * SIMPLIFY TYC
         CI,D3    HUTYC             * RBT OR IRBT HUNG UP.
OSDEAQ1  BE       OSDEAQ3
         CI,D3    PGABRTTYC         * ABORT CURRENT PAGE
*
         DO       TYC%NO%GOOD
*
         BNE      OSDEA0
*
         ELSE
*
         BNE      OSDEA0E
         FIN
         AND,R0   NWEOFBT
         CW,R0    CPYBIT
         BAZ      OSDEAQ2
         LI,R7    SCBESTDA+SCBESTDA+SCBESTDA+SCBESTDA
         MTB,1    *R1,R7
OSDEAQ2  EQU      %
         LW,R8    SCBUPPT+1,R1
         LW,R9    SCBUPPT,R1
OSDBU    EQU      %
         AND,R0   NCPYBT
         STW,R0   SCDEVTYP,R1
         STW,R9   SCDBI,R1
         STW,R9   SCBUPPT,R1
         STW,R8   SCBUPPT+1,R1
         LI,R15   -1
         XW,R15   SCBLDA,R1
         CW,R8    SCCDA,R1
         BE       OSDBUC
         LW,R15   DLCKBIT
         STS,R15  SCDEVTYP,R1
         B        OS1
OSDBUC   EQU      %
         AI,R15   0
         BEZ      OSDEA0
         STW,R15  SCBLDA,R1
*
         DO       TYC%NO%GOOD=0
*
         B        OSDEA0
OSDEA0E  EQU      %
         PABRT    ' 6','DTYC','BAD DEVICE TYC'
         FIN
*
OSDEA0   EQU      %
         BAL,R9   OS%REG
*
*        DEV E A & A O K  SO CHECK SIGNALS
*                                   (AND BIRD IS IN HAND)
*
         CI,D2    'S'               SUSPEND SYMBIONT
         BE       OSMS0               YES,SUSPEND EXIT
         CI,D2    'Q'               * REQUEUE PARTIAL FILE SIGNAL
         BNE      OSDEA0CA            * NO, CHECK 'A'
*                                   YES,
OSDEA0A  EQU      %
         BAL,SR2  OS%AOFP           * PUT THAT FILE BACK
         SREF     MXSTRM
         CI,R3    MXSTRM
         BLE      OSEND2
         LI,R12   'L'               MTB WONT WORK ENTERED
         STB,R12  SSIG,R3           IN DIFFERENT WAYS
         B        OSEND2
OSDEAQ3  EQU      %
         LW,R9    WEOFBIT           IF HANGUP OR DOWN DONT
         STS,R9   SCDEVTYP,R1       WRITE EOF
         B        OSDEA0A
*
OSDEA0CA EQU      %
         CI,D2    'A'               * CHECK FOR 'A'-ALIGN
         BNE      OSDEA0CR          * NOPE, CHECK-'R'
*
         LC       SYMX,R3
         BCR,4    OSDEA00
         OR,R0    ALGNBIT           * REMEMBER
         STW,R0   SCDEVTYP,R1       * FOR LATER.
         MTB,-1   SSIG,R3           MAKE A NON ALPH
         LW,R9    SCTOFDA,R1
         LW,R8    SCTOFDA+1,R1
         BNEZ     OSDBU
OSDBU1STA EQU     %
         LW,R8    SCBESTDA,R1
OSDBU1ST EQU      %
         LI,R9    1STDBI
         B        OSDBU
*
OSDEA0CR EQU      %                 CHECK 'R'
         CI,D2    'R'               IS     'R' RECOVERY REQUESTED
         BNE      OSDEA0CX            NO,CHECK          X
         AND,R0   NALGNBT
         STW,R0   SCDEVTYP,R1
         LC       SYMX,R3
         BCS,2    OSDBU1STA         NO BACKUP LIST FOR OCP
         MTB,1    SSIG,R3           MAKE R NON ALPH
         LW,R8    SCBUDA,R1
         BEZ      OSDBU1STA         NO LIST YET
         BAL,R9   OSCLST
         STW,R8   SCBUDA,R1
         B        OSDBU1ST
OSCLST   EQU      %
         LI,R15   0
         LC       SYMX,R3
         BCS,2    *R9               NO LIST FOR OCP
         AI,R1    SCDALST-1
         LI,R14   SCDALSZ
         STW,R15  *R14,R1
         BDR,R14  %-1
         LSCP
         B        *R9
OSDEA0CX EQU      %                 SYMBIONT WRITE END ACTION
*                                   SHECK 'X'
         CI,D2    'X'               TERMINATE SYMBIONT FILE
         BE       OSEND1B
OSDEA00  EQU      %
*
*        NO SIGNALS    SO PROCESS NEXT ...
*
         DO       SPFL
         CI,R0    IMRESPFBIT
         BANZ     OSDVEA2
         FIN
         LIEA,R2  OCPFEA            DOES END ACTION
         CW,R2    SCFEA,R1          POINT TO OCP
         BNE      %+2               NOPE
         BAL,R14  OCPSEND           YES-SEND BLOCK OR RECORD
         LW,D3    SCFBUF,R1         DATA BUFFER ADDRESS
         LW,R2    SCDBI,R1          DATA BYTE INDEX
         LB,R0    *D3,R2            *
         AI,R2    +1                *
         LB,D1    *D3,R2            *
         SLS,R0   +8                *
         OR,R0    D1                * GATHER BYTE COUNT
         AI,R2    +1                * AND ADVANCE TO RCC.
         LB,D1    *D3,R2            RECORD CONTROL CODE
         CI,D1    X'80'             SPECIAL CODE
         BGE      OSDEA02              *YES, IT IS SPEC SYMB CODE
         CI,D1    X'58'             I/O FUNCTION CODE
*        FC=      4(PRINT OR PUN), 5(PRINT OR PUN)
*                 6(FORMAT PRINT), 7(FORMAT PRINT)
*                 0,1,2,3 (DPD PRINT WITH FORMAT)
         BAZ      OSDEA21              *YES, IT IS
*
OSDEA00A EQU      %
*                                   * FOR RECOVERY
         CI,D1    EOSB              BLOCK INFORMATION END
         BE       OS0               --CHNGD  SMK 10/1/73
*
*CORE BUFFER DATA ERROR-PROBABLY DUE TO BAD DISC READ
*
*                                   * '...BLK BAD 4'
OSDEA0X  EQU      %
         PABRT    ' 4',' RCC','BAD RECORD CONTROL CODE'
OSDEA01  EQU      %
         PABRT    ' 5','OOFB','OUT-OF-BOUNDS(BLOCK)'
         PAGE
OSDEA02  EQU      %
         CI,D1    X'86'             * SPCL IS BANNER
         BL       OSDEA0X
         BE       OSDEA1D           * YEP,
         LI,SR2   -1                *---- NO BLINK CHK IS NEG DA
         STW,SR2  SCBLDA,R1         *----  ... MARKED IN CONTEXT
         CI,D1    X'88'             *---- 88 IS PREFIX BANNER FOR DPD
         BNE      OSDEA2            *---- NOPE MUST NOT BE BANNER
OSDEA1D  EQU      %                 =
*
         STW,R2   SCBUPPTS,R1
         MTW,-2   SCBUPPTS,R1
         LI,D1    3                 *
         LI,R6    SCDQARGS+SCDQARGS+SCDQARGS+SCDQARGS
         STB,R12  *R1,R6
         LW,SR2   SCCDA,1           *---- FETCH CDA FOR BACKUP
         LI,R6    BASCBANC          *
         AI,R2    +1                * ADVANCE TO SK
         LB,D1    *D3,R2            * FETCH
         AI,R2    +1                * ADVANCE TO REP CNT
         LB,D2    *R1,R6            * IN BETWEEN
         BNEZ     OSDEA1A           * YEP CONTINUE
         LB,D2    *D3,R2            * NOPE START
         AND,D1   M3                *(IGNORE FLAGS)
         AW,R2    D1                * POINT AT REAL REC
         AI,R2    -1                * (CORR FOR COUNT)
         MTB,1    SR2               *---- SET 1ST BANNER TIME
         B        OSDEA1B           *
*
OSDEA1A  EQU      %                 *
         AI,R2    +1                * TEMP ADVANCE
         LB,D4    *D3,R2            * TO FETCH SVFC
         AI,R2    -2                * (BACK OFF FOR RITE SK)
         AND,D1   M3                *(IGNORE FLAGS)
         AW,R2    D1                * ADVANCE TO PVFC
         STB,D4   *D3,R2            * SVFC REPLS PVFC
*
OSDEA1B  EQU      %                 *
         AI,D2    -1                * MORE REPS
         BEZ      OSDEA1C           * NOPE CLEAN UP
         STB,D2   *R1,R6            * YEP DOIT
         STW,SR2  SCBUPPTS+1,1      *----CDA TO BCKUP PT SV
         STW,R0   SCDBC,R1          * NEWQ SETUP
         LCI      5                 *
         LM,R12   SCDQARGS,R1       *
         LW,R13   SCFBUF,R1         * WA TO BA
         SLS,R13  +2                *
         AND,R2   M24               *----CLEAN DBI FOR ADD
         AW,R13   R2                * BUFF + DBI :=> REC
         B        OSDEA51           * *=*JOIN UP*=*
OSDEA1C  EQU      %                 *
         STB,D2   R2                *----REP COUNT SAVED IN DBI BY 0
         AW,R2    R0                * ADVANCE TO NEXT REC
         STW,R2   SCDBI,R1          *
         B        OSDEA0            * AND FROM THE TOP
         PAGE
*
*MESSAGE-SUSPEND SYMBIONT END ACTION
*
OSMS0    EQU      %
         CI,R3    MXSTRM
         BG       %+4
         LI,R9    SSSBIT
         LB,R2    SNDDX,R3
         STS,R9   RB:FLAG,R2
         LC       SYMX,R3
         BCS,2    %+2
         BAL,R9   OS%RLCB
         PLW,R11  TSTACK
         BAL,SR2  SUSP              * SET SUSPEND RET ADDR AND
*                                   EXIT TO SUSPEND SYMBIONT
*
*RETURN FROM SUSPEND                (BIRD IN BUSH)
*
         LI,R11   1                 CONTEXT BLOCK INDEX AND STATUS CODE
         STB,R11  SSTAT,R3          SET SYMBIONT STATUS ACTIVE
         LC       SYMX,R3
         BCS,2    OSDEA0
         LW,R11   DLCKBIT
         STS,R11  SCDEVTYP,R1
         LI,R11   -1
         STW,R11  SCBLDA,R1
         B        OS11
         PAGE
*DEVICE END ACTION
*(CONTINUE)
*
OSDEA2   EQU      %
OSDEA21  EQU      %
*
         LI,R6    7
         AND,R6   R12
         LC       SYMX,R3
         BCR,2    %+3
         LI,R6    1
         B        OSDFCN
         BCS,4    %+2
         AI,R6    8
         REF      SYMTRAN
         LB,R6    SYMTRAN,R6
OSDFCN   EQU      %
         LI,R7    SCDQARGS+SCDQARGS+SCDQARGS+SCDQARGS
         STB,R6   *R1,R7
         AI,R2    1                 INCR DATA BYTE INDEX
         LB,R7    *R14,R2
         AND,R7   M3
         AW,R7    R2
         LW,R15   SCDBI,R1
         CI,R6    3
         BNE      OSTOFCK
         LB,R13   *R14,R7
         CI,R13   X'F1'             TOF VCF CHAR
         BE       OSTOFCK1
OSTOFCK  EQU      %
         LC       *D3,R2            * THIS IS TOF
         BCR,PAGE OSDEA3B           * NOPE
OSTOFCK1 EQU      %
         LW,R8    SCDEVTYP,R1
         CW,R8    ALGNBIT
         BAZ      OSDEA3A
         LI,R12   -1
         XW,R12   SCTOFDA,R1
         BEZ      OSDEA3B
         BGZ      %+3
         MTW,1    SCTOFDA,R1
         B        OSDTOF
         STW,R12  SCTOFDA,R1
         LW,R13   SCCDA,R1
         CW,R13   SCTOFDA+1,R1
         BNE      OSDTOF
         LI,R13   X'FFFF'
         CS,R12   SCDBI,R1
         BE       OSDEA3B
OSDTOF   EQU      %
         SW,R8    ALGNBIT
         STW,R8   SCDEVTYP,R1
         B        OSMS0
OSDEA3A  EQU      %
         LW,SR1   SCCDA,R1          * CURR DISC
         STW,R15  SCTOFDA,R1
         STW,SR1  SCTOFDA+1,R1      * DEFINES TOF
OSDEA3B  EQU      %
         STW,R15  SCBUPPTS,R1
         STW,R7   SCDBI,R1
         CW,R7    SCBSIZ,R1
         BGE      OSDEA01             YES,CORE BUFFER ERROR
*                                   * '...BLK BAD 5'
*                                   *NO,
OSDEA5   EQU      %
*
         LW,R3    SCCDA,R1          * SAVE POSS BACKUP
         STW,R3   SCBUPPTS+1,R1     *----CURRENT DA TO BACKUP POINT SAVE
*
         STW,R0   SCDBC,R1          * REC BYTE COUNT
         LCI      5
         LM,R12   SCDQARGS,R1       * NEWQ ARGS
         SCS,R13  -2                ***
         AW,R13   SCFBUF,R1         *** BUF+WORD OFFSET
         SCS,R13  2                 ***  TO BYTE ADDRESS
         AWM,R14  SCDBI,R1          * UPDATE FOR NEXT REC
*
OSDEA51  ANLZ,SR2  OSDEAQ1          *DEV DOWN DO A 'Q'
OSDEA52  LW,R2    SCSWIT,R1         * IOQ OR SITCHER ENTRY POINT
OSDEA53  BAL,SR4  0,R2              * REQUEST IO(NOW OR EVENTUALLY)
         B        QFACTP11          * PULL BIRD AND 'Q' ON ACT
         B        PULLEXIT          * BIRD FROM BUSH AND LEAVE
*
         SPACE    5
         DO       SPFL
OSDVEA2  EQU      %
         LW,R2    SCDBI,R1
         LI,D1    0
         LW,R0    SCBSIZ,R1
         LW,D2    YFF
         STS,D1   SCTYC,R1
         LW,D1    SCBSIZ,R1
         SLS,D1   -1
         CW,D1    SCTYC,R1
         BG       OSDEA5
         STW,D1   R0
         B        OSDEA5
         FIN
*
OS%TERM0A EQU     %
         LC       SYMX,R3
         BCR,8    TERM              THIS SEEMS WEIRD BUT IS RIGHT FOR RP
         LI,R13   1EOF%FLAG
         STS,R13  SCDEVTYP,R1
OS%TERM0 EQU      %                 *
         LW,R0    WEOFBIT
         CW,R0    SCDEVTYP,R1
         BANZ     OSEND3
         LB,R12   SYMX,R3           * REMOTE AND NEEDS EOF
         REF      M3
         CI,R12   4
         BAZ      OSEND3
         LCI      4
         LM,R12   SCDQARGS,R1       * USING ANY FC
         LI,R14   0
         ANLZ,SR2  OSDEA0AL         * FOR DEV DOWN
         BAL,R0   OSDEA52           * SET EA ADDR AND QUE
         LSBR     EA                * AGAIN
         BAL,SR2  OS%REG-EA         * WITH THE REGS
         LB,R12   R12               * CHK TYC
         CI,R12   PGABRTTYC         * FOR BACKUP
OSDEA0AL BNE      OSEND3
         B        OS%TERM0          *
         PAGE
*        UTILITY OUTSYM SUBROUTINES
         SPACE    3
*        L=SR2, OS%REG-EA: SR3 FROM R14 AND
EA       EQU      OS%REG-%          *ODD EA DISP
         LW,SR3   R14               *
         PSW,R11  TSTACK
OS%REG   EQU      %                 *
*                 OS%REG: SETUP R1(SCP),R3,D2,R0
         LSCP                       *
         LB,R3    *SR3              *
         LB,D2    SSIG,R3           *
         LW,R0    SCDEVTYP,R1       *
         LI,R2    TYPMSK            * WIDTH OF DEVICE TYPE
         AND,R2   R0                * SET CC AND FETCH DEV TYP
         B        *SR2              *
*
*        OS AOFP  INTERNAL ADD OUTPUT FILE PARTIAL
*                 L=SR2  , BIRD IN HAND , USES SCTYC TO PRES LINK
*
OS%AOFP  EQU      %                 *
         STW,SR2  SCTYC,R1          * SAVE LINK
         MTW,-1   BL:OFS            * FETCH AN ENTRY
         BGEZ     %+4               * YES, I GOT ONE
         AI,R4    %-2-SYMPPRTY      * NO, WERNT NONE (SET RET)
         MTW,+1   BL:OFS            * (CORRECT IT)
         B        QFP11NCB          * WAIT ON ACTQ FOR SLOT
*
         LI,D1    TYPMSK            *
         AND,D1   SCDEVTYP,R1       * DEVICE TYPE.
         SLS,D1   +8                *
         AI,D1    AOFP              * D1 = 0,0,TYPE,GFC 8,8,8,8
         STH,R3   D1                * D1 = 0,SYMTX,TYPE,GFC 8,8,8,8
         LI,R13   0
         XW,R13   SCBESTDA,R1
         LW,D3    SCSVDGI,R1        * D3 = SAVED GHO INFO 32
         LW,R2    SCGCNT,R1
         BAL,R4   SGCQ                : CALL GHOST VIA QUEUE
         BDR,R4   QFPD4CB
         LSBR                       *RESTORE BASE ADDR
         BAL,SR2  OS%REG            * AND ALL THE REGS
*
         LW,SR2   SCTYC,R1          * RESTORE LINK
         B        *SR2              * AND RETURN
*
*
OS%UDAP  EQU      %                 *OUTSYM : UPDATE DISC ADDRESS POINTERS
*                 L=SR2;I-R1=SCP,R12=TYC;U-R0,R6
*                 OUTPUT: TYC,FLINK,BLINK UPDATED
*                         BLINK CHECKED UNLESS NEGATIVE
*                         RETURN+1  BAD BLINK COMPARE
*                         RETURN+2  AOK OR NEG BLINK
*
         LW,R6    SCFBUF,R1         *ADDR OF BLOCK IN CORE
         STW,R12  SCTYC,R1          *SAVE TYC
         LW,R0    0,R6              NEXT DISC BLOCK ADDRESS
         STW,R0   SCFLDA,R1         SAVE FLINK
         LW,R0    SCCDA,R1          GET CUR
         XW,R0    SCBLDA,R1         SAVE FLINK, GET PREV FOR BLINK CHK
         BLEZ     *SR2
*
*                                   * '...BLK BAD 2'
         LW,R6    SCBSIZ,R1         * LOOK AT BUFFER LAST
         SLS,R6   -2                * WORD FOR BLINK TO
         AW,R6    SCFBUF,R1         * CHECK. (SCFBUF)+(SCBSIZ)-1
         CW,R0    *M24,R6           (FOR S9 REAL EXT ADDR)
         BNE      BADDA1            GO RETRY OR ABORT
         B        *SR2              NORMAL RETURN
*
*
OS%RLCB  EQU      %                 RELEASE SPOOL
         LI,R14   0
         XW,R14   SCFBUF,R1
         BEZ      *R9
         PLW,R11  TSTACK
         B        RELCB
*
*                 SEGREGATED BECAUSE BAL BEATS ANLZ,B BOTH SPEED AND SIZE.
OS%SGCQ  EQU      %                 ::Q FOR GHO GOF::
         STW,D3   SCGCNT,R1
         BAL,R4   SGCQ
         BDR,R4   QFP11NCB          - - -NO COMM BUFS: TRY
*                                       AGAIN AT ACT.- - -
         LW,R2    R10
         LW,D3    SCGCNT,R2
         AI,R1    -SGCBUF           * ADDR TO #
         STB,R1   D3                *   BUF # SAVED IN SRET
         STW,D3   SRET,R3           *   GHO DOES THE Q
*                                   * PTR TO SACT CALL IS IN BUSH.
         B        PULLEXIT          * LEAVE FOR NOW
* SHAMROCK CODE MOVED TO OCPIO FOR B00 RELEASE RJR.11/25/73
         END

