         DEF      REQDC:            FOR XDELTA SYMBOL
REQDC:   EQU      %
*
*
*M*      REQDC    SOME SYMBIONT DISC AND CORE ALLOCATION ROUTINES
*
*
*P*      NAME:    REQDC
*P*
*P*      PURPOSE: LOCATION OF SYMBIONT GET DISC, GET BUFFER, AND
*P*               RELEASE BUFFER ROUTINES
*P*
*P*      DESCRIPTION:
*P*               REQDC CONTAINS THREE SYMBIONT ROUTINES AS
*P*               DESCRIBED BELOW:
*P*
*P*               1)  REQDC - REQUEST DISC GRANULE
*P*                   REQDC IS CALLED BY THE INPUT SYMBIONT
*P*                   TO GET A DISC GRANULE.  IF THE GRANULE
*P*                   IS AVAILABLE THE ROUTINE RETURNS.  OTHERWISE
*P*                   IT QUEUES THE SYMBIONT FOR DISC
*P*
*P*               2)  REQCB - REQUEST CORE BUFFER
*P*                   REQCB IS CALLED BY EITHER THE INPUT OR
*P*                   OUTPUT SYMBIONT TO GET AN SPOOL.  IF THE
*P*                   PAGE STEALING CELLS SAY THAT NONE CAN BE
*P*                   HAD THE SYMBIONT IS QUEUED FOR CORE.  IF THERE
*P*                   IS A SPARRE HALF PAGE ON THE SPOOL CHAIN, IT
*P*                   IS GIVEN TO THE SYMBIONT.  OTHERWISE REQCB
*P*                   TRIES TO STEAL A PAGE VIA T:STLPP.  IF THIS
*P*                   FAILS THE SYMBIONT IS QUEUED FOR CORE.  IF
*P*                   IT SUCCEEDS HE IS GIVEN HALF THE PAGE AND
*P*                   THE OTHER HALF IS PUT ON THE SPOOL CHAIN.
*P*
*P*               3)  RELCB - RELEASE CORE BUFFER
*P*                   RELCB IS CALLED BY EITHER SYMBIONT TO RELEASE
*P*                   A BUFFER OBTAINED THROUGH REQCB.  THE SPOOL
*P*                   CHAIN IS CHECKED FOR THE OTHER HALF OF THIS
*P*                   PAGE AND IF IT IS PRESENT THE WHOLE PAGE IS
*P*                   RELEASED TO THE SYSTEM VIA T:RSPPEA.  IF THE
*P*                   OTHER HALF IS NOT FOUND THE HALF PAGE IS
*P*                   CHAINED TO THE SPOOL CHAIN.  IN ANY CASE THE
*P*                   EXIT TO THE SYMBIONT IS MADE VIA QUEUE FOR
*P*                   ACTIVATION TO ASSURE ORDERLY SHARING OR SPOOLS.
*P*
*P*      REFERENCE:
*P*               THESE ROUTINES ARE USED BY INSYM AND OUTSYM. THE
*P*               PAGE STEALER IS IN MM (T:STLPP,T:RSPP).  THE
*P*               QUEUEING ROUTINES FOR SYMBIONTS AR IN SYMSUBR.
*
*
         SYSTEM   UTS
*
*
         DEF      RELCB             RELEASE SYMBIONT CORE BUFFER
         DEF      REQCB             REQUEST SYMBIONT CORE BUFFER
         DEF      REQDC             REQUEST SYMBIONT DISC GRANULE
         DEF      SRELBUF           ALTERNATE ENTRY TO RELEASE
*,*                                 SYMBIONT CORE BUFFER
*
*
         REF      SPOOL             I/O:  HEAD OF SYMBIONT FREE BUFFER
*,*                                 CHAIN.  UPDATED AS BUFFS ARE
*,*                                 REMOVED AND REPLACED
         REF      S:STLC            INPUT:  IF NEGATIVE THE SWAPPER
*,*                                 NEEDS SYMBIONT PAGES AND SYMBIONTS
*,*                                 MUST WAIT FOR THEM
         REF      ENBSR4            CALLED:  TO ENABLE AND B *11
         REF      REG               CALLED:  TO SET UP REGISTERS FOR
*,*                                 INSYM AND EXIT TO HIM
         REF      GSG               CALLED:  TO GET SYMBIONT GRANULES
         REF      T:STLPP           CALLED:  TO STEAL PAGES TO MAKE
*,*                                 INTO SYMBIONT BUFFERS
         REF      T:RSPPEA          CALLED:  TO RELEASE WHOLE PAGES
*,*                                 WHEN BOTH SYMBIONT BUFFERS ARE
*,*                                 RELEASED
         REF      QFACTP11          CALLED:  TO QUE THE SYMBIONT CALLER
*,*                                 FOR ACTIVATION AND EXIT (R11 EXIT
*,*                                 IN TSTACK) - ON UNQUE SYMBIONT IS
*,*                                 RE-ENTERED *9
         REF      QFGP11            CALLED:  TO QUE THE SYMBIONT CALLER
*,*                                 FOR A GRANULE AND EXIT (R11 EXIT
*,*                                 IN TSTACK) - ON UNQUE SYMBIONT IS
*,*                                 RE-ENTERED *9
         REF      QFCBP11           CALLED:  TO QUE THE SYMBIONT CALLER
*,*                                 FOR A CORE BUFFER AND EXIT (R11 EXIT
*,*                                 IN TSTACK) - ON UNQUE SYMBIONT IS
*,*                                 RE-ENTERED *9
         PAGE
*                 SYMBOLIC REGISTER DEFINITIONS.
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
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
*
*
*F*      NAME:    REQDC
*F*
*F*      PURPOSE: GETS SYMBIONT GRANULES FOR THE INPUT SYMBIONT
*F*
*
*
*SYMBIONT DISC GRANULE REQUEST NOT AT END ACTION
*(R3)=SYMBIONT INDEX
*(SR3)=SYMBIONT CONTEXT BLOCK ADDRESS
*                 SR2               SYMBIONT RETURN ADD+1
*        BAL,SR2  REQDB
*(TSTACK)=SYMBIONT EXIT
SYMDQ    EQU      0                 DISC GRANULE QUEUE INDEX
REQDC    EQU      %
         BAL,11   GSG               GET SYM GRAN
         AI,SR1   0
         BNEZ     REG               OK-RELOAD REGISTERS
*                                   EXIT ON 9
BACKUP   RES      0
         AI,9     -1                BACKUP TO RE ISSUE
         B        QFGP11            Q FOR GRANULE-PULL 11
         PAGE
*
*
*F*      NAME:    REQCB
*F*
*F*      PURPOSE: GETS 256 WORD BUFFERS FOR THE SYMBIONTS
*F*
*
*
*SYMBIONT CORE BUFFER REQUEST NOT AT END ACTION
*(R3)=SYMBIONT INDEX
*(SR3)=SYMBIONT CONTEXT BLOCK ADDRESS
*(SR4)=SYMBIONT RETURN ADDRESS+1
*(TSTACK)=SYMBIONT EXIT
*        BAL,SR4  REQCB
SYMCQ    EQU      1                 CORE BUFFER QUEUE INDEX
REQCB    RES      0
GET      DISABLE
         LW,14    S:STLC
         BLZ      QFC
         LW,14    SPOOL
         BEZ      NOPG
         LW,0     *14
         STW,0    SPOOL
         B        ENBSR4
NOPG     EQU      %
         PUSH     11
         BAL,11   T:STLPP
         PULL     11
         AI,3     0
         BLEZ     QFC
         LI,14    0
         STW,14   *3
         STW,3    SPOOL
         AI,3     X'100'
         LW,14    3
         B        ENX
QFC      EQU      %
         ENABLE
         LB,3     *10
         LW,9     11
         AI,9     -1
         B        QFCBP11
*
         PAGE
CHKFREE  LW,15    =((1**15)-1)**9   * BIG9 ADDR PAGE# MASK
CHKIT    CS,14    0
         BE       CHKGIT
         LW,1     0
         LW,0     *0                NEXT
         BNEZ     CHKIT
         B        0,3               NONE
CHKGIT   RES      0
         LW,2     *0
         STW,2    0,1
         B        1,3               MATCH
         PAGE
*
*
*F*      NAME:    RELCB (SRELBUF)
*F*
*F*      PURPOSE: FREE 256 WORD BUFFERS FOR THE SYMBIONTS
*F*
*
*
*SYMBIONT CORE BUFFER RELEASE AT END ACTION
*(R3)=SYMBIONT INDEX
*(SR2)=SYMBIONT RETURN ADDRESS
*(SR3)=SYMBIONT CONTEXT BLOCK ADDRESS
*(SR4)=SYMBIONT EXIT
*(D3)=CORE BUFFER ADDRESS
*                 PHYSICAL  BUFFER  RELEASE /GET
RELCB    RES      0
         PUSH     11                SAVE QRA
         BAL,11   SRELBUF           RELEASE BUFF
         B        QFACTP11
SRELBUF  RES      0
REL      DISABLE
         LI,1     SPOOL
         LW,0     SPOOL
         BEZ      NOREL             NONE TO LINK
         BAL,3    CHKFREE
         B        NOREL
         PUSH     11
         BAL,11   T:RSPPEA
         PULL     11
         B        ENX
NOREL    XW,14    SPOOL
         STW,14   *SPOOL
ENX      ENABLE
         LW,4     *10
         LW,1     10
         LB,3     *10
         B        *11               RETURN TO SYM
REQDCSZ  EQU      %-REQDC
         END

