         SYSTEM SIG7
         SYSTEM BPM
START    EQU      $
         M:TYPE   (MESS,IDMESS)
         REF      M:UC
         M:READ   M:UC,(SIZE,3),(BUF,BUF),(BTD,0),(WAIT)
         LI,D1    0
         LI,R3    0
NX       LB,R7    BUF,R3
         CI,R7    ' '
         BE       DONE
         CI,R7    X'15'
         BE       DONE
         CI,R7    X'0D'
         BE       DONE
         CLM,R7   DIGITS
         BOL      CKHX
         AI,R7    -'0'
         B        SHFT
CKHX     CLM,R7   HEX
         BOL      INVALID
         AI,R7    -'A'+X'A'
SHFT     SLS,D1   4
         AW,D1    R7
         AI,R3    1
         CI,R3    3
         BL       NX
DONE     CI,D1    3
         BLE      INVALID
         CI,D1    SMUIS
         REF      SMUIS
         BLE      ONLINE
BATCH    LI,R6    LPART
         REF      LPART
         M:SYS
         CI,SR1   QUEUE
         BNE      NOTMON
         REF      QUEUE
         CH,D1    PLH:SID,R6
         BE       $+3
         BDR,R6   $-2
         B        NOTFOUND
         LB,D2    PLB:USR,R6
         REF      PLH:SID
         REF      PLB:USR
         MTW,0    MPATCH+699
         BNE      INUSE
         M:XCON   EXIT
         STW,D2   MPATCH+699
         REF      MPATCH
BWAIT    M:WAIT   50
         CW,D2    MPATCH+699
         BNE      EXIT
         CB,D2    PLB:USR,R6
         BNE      EXIT
         B        BWAIT
*
ONLINE   LI,R6    LNOL-1
         REF      LNOL,LB:UN
         M:SYS
         CI,SR1   QUEUE
         BNE      NOTMON
         BE       $+3
         BDR,R6   $-2
         B        NOTFOUND
         MTW,0    MPATCH+699
         BNE      INUSE
         M:XCON   EXIT
         STW,D1   MPATCH+699
OWAIT    M:WAIT   50
         CW,D1    MPATCH+699
         BNE      EXIT
         CB,D1    LB:UN,R6
         BNE      EXIT
         B        OWAIT
BUF      RES      2
IDMESS   TEXTC    'SYSID TO HOLD? '
         BOUND    8
DIGITS   DATA     '0','9'
HEX      DATA     'A','F'
EXIT     M:XCON   0
         LI,0     0
         STW,0    MPATCH+699
         M:EXIT
NOTFOUND EQU      $
INVALID  M:TYPE   (MESS,IVMES)
         M:EXIT
IVMES    TEXTC    'NO SUCH USER ONLINE OR BATCH'
NOTMON   M:TYPE   (MESS,MONMES)
         M:EXIT
MONMES   TEXTC    'RELOAD PROGRAM WITH CORRECT MONSTK'
         M:EXIT
INUSE    M:TYPE   (MESS,IUMES)
         M:EXIT
IUMES    TEXTC    'HOLD IS LIMITED TO ONE USER AND IS ALREADY IN USE'
         END      START
