# 
#  MTREKD, the universe manager task, is automatically subtasked
#  by the first person to run MTREK, the player task.
#  So as not to penalize the first player by taking quotas and money,
#  and so that MTREKD doesn't abort abnormally when the first
#  player logs off,
#  MTREKD is run as a detached process with no accounting.
#  Thus MTREK must be installed with DETACH and ACNT privileges so
#  that anyone can start MTREKD.
# 
#  Note that MTREKD stops itself aout 30 seconds after everyone
#  quits playing.
# 
#
#  THIS SUBROUTINE STARTS UP THE MTREK DRIVER ROUTINE, MTREKD.
#
SUBROUTINE RUNMTR
PARAMETER JPI_$PRIB = '309'X
INTEGER*2 ITMLST(8), ICODE, BUFLEN
INTEGER*4 BUFADR, RETADR, BASPRI
EQUIVALENCE (ITMLST(1), BUFLEN), (ITMLST(2), ICODE),
            (ITMLST(3), BUFADR), (ITMLST(5), RETADR)
DATA ITMLST /8*0/
 
BUFLEN = 4
ICODE = JPI_$PRIB
BUFADR = %LOC(BASPRI)
RETADR = 0
#
# GET BASE PRIORITY OF MTREK
#
CALL SYS$GETJPI( , , , ITMLST, , , )
#
#  SUBTASK MTREKD WITH SAME BASE PRIORITY AS MTREK AND RUNNING AS A
#  DETACHED PROCESS UNDER UIC [1,4] WITH NO ACCOUNTING.
#
CALL SYS$CREPRC( , 'SYS$SYSTEM:MTREKD',
                 , , , , , 'MTREKD', %VAL(BASPRI), %VAL('10004'X),
                 , %VAL(8))
RETURN
END
