Google
 

Trailing-Edge - PDP-10 Archives - BB-D868D-BM - 4-sources/setspd.mac
There are 33 other files named setspd.mac in the archive. Click here to see a list.
;<4.UTILITIES>SETSPD.MAC.46,  3-Jan-80 15:26:50, EDIT BY R.ACE
;UPDATE COPYRIGHT DATE
; UPD ID= 102, SNARK:<4.UTILITIES>SETSPD.MAC.45,   6-Dec-79 11:05:53 by BLOUNT
;<4.UTILITIES>SETSPD.MAC.45,  6-Dec-79 10:55:56, EDIT BY BLOUNT
;TCO #4.2590 -CHANGE AT QUEDN1+7 TO FIX KS HALT STATUS BLOCK BUG
;<4.UTILITIES>SETSPD.MAC.44,  9-Oct-79 15:26:55, EDIT BY GRANT
;<4.UTILITIES>SETSPD.MAC.43, 25-May-79 13:02:47, EDIT BY MILLER
;FIX QUEBLK. IT WAS COMPUTING # OF PAGES TO DUMP OFF-BY-ONE
;<4.UTILITIES>SETSPD.MAC.42, 11-Apr-79 15:57:49, Edit by LCAMPBELL
; Fix up addressing of SYERR block at QUEDN1
;<4.UTILITIES>SETSPD.MAC.41, 13-Mar-79 08:50:11, EDIT BY KONEN
;UPDATE COPYRIGHT FOR RELEASE 4
;<4.UTILITIES>SETSPD.MAC.40, 13-Mar-79 06:50:04, EDIT BY R.ACE
;TAKE OUT TAPE-MOUNT-DEFAULT COMMAND
;ADD TAPE-RECOGNITION-ERRORS COMMAND
;<4.UTILITIES>SETSPD.MAC.39, 21-Feb-79 11:36:40, EDIT BY MURPHY
;ENABLE/DISABLE WORKING SET PRELOADING - DLM
;<4.UTILITIES>SETSPD.MAC.38, 20-Feb-79 17:43:04, EDIT BY BLOUNT
;CHANGE CLASS-SCHEDULER TO CLASS-SCHEDULING
;<4.UTILITIES>SETSPD.MAC.37, 19-Feb-79 14:22:43, Edit by MCLEAN
;FIX IT SO ECSKED WITH ARGUMENTS GIVES ERROR
;<4.UTILITIES>SETSPD.MAC.36, 19-Feb-79 13:24:27, Edit by MCLEAN
;CORRECT SPELLING OF WITHHELD
;<4.UTILITIES>SETSPD.MAC.35, 24-Jan-79 10:51:08, EDIT BY R.ACE
;MOVE TAPE-RECYCLE-PERIOD TO RIGHT PLACE, UPDATE EDIT#
;<4.UTILITIES>SETSPD.MAC.34, 11-Dec-78 06:52:19, EDIT BY R.ACE
;PUT ERJMP'S AFTER SYERR CALLS
;<4.UTILITIES>SETSPD.MAC.33, 28-Nov-78 08:04:16, EDIT BY R.ACE
;TCO 4.2098 - ADD TAPE-MOUNT-DEFAULT COMMAND
;ADD COMND JSYS ROUTINES FOR PARSING NEW SETSPD COMMANDS
;<ARC-DEC>SETSPD.MAC.3,  3-Oct-78 09:50:04, EDIT BY CALVIN
; Cause GTKEY to eat all of hypenated command name
;<ARC-DEC>SETSPD.MAC.1, 29-Sep-78 15:58:56, EDIT BY CALVIN
; Add ARCHIVE-TAPE-RECYCLE-PERIOD and TAPE-RECYCLE-PERIOD
;<4.UTILITIES>SETSPD.MAC.31, 20-Oct-78 19:16:54, EDIT BY MILLER
;<4.UTILITIES>SETSPD.MAC.30, 20-Oct-78 19:13:31, EDIT BY MILLER
;<4.UTILITIES>SETSPD.MAC.29, 20-Oct-78 19:12:53, EDIT BY MILLER
;TCO 4.2011. ADD BATCH-CLASS COMMAND
;<4.UTILITIES>SETSPD.MAC.28, 19-Oct-78 17:49:03, Edit by MCLEAN
;MAKE SKED JSYS BE SKED%
;<2MCLEAN>SETSPD.MAC.27, 24-Sep-78 21:56:05, Edit by MCLEAN
;<2MCLEAN>SETSPD.MAC.26, 21-Sep-78 21:22:18, Edit by MCLEAN
;<4.UTILITIES>SETSPD.MAC.25, 20-Sep-78 11:35:08, EDIT BY MILLER
;<4.UTILITIES>SETSPD.MAC.24, 19-Sep-78 12:57:51, EDIT BY MILLER
;<4.UTILITIES>SETSPD.MAC.23, 19-Sep-78 12:56:37, EDIT BY MILLER
;MORE OF TCO 4.2011
;<4.UTILITIES>SETSPD.MAC.22, 19-Sep-78 12:12:05, EDIT BY MILLER
;<4.UTILITIES>SETSPD.MAC.21, 19-Sep-78 12:10:50, EDIT BY MILLER
;TCO 4.2011. ADD ENABLE OPTIONS FOR CLASS SCHEDULER
;<4.UTILITIES>SETSPD.MAC.20, 19-Sep-78 11:27:50, EDIT BY MILLER
;<4.UTILITIES>SETSPD.MAC.19, 19-Sep-78 11:25:05, EDIT BY MILLER
;TCO 4.2011 AGAIN. ADD CREATE COMMAND
;<4.UTILITIES>SETSPD.MAC.18, 17-Sep-78 14:05:21, EDIT BY MILLER
;TCO 4.2011. IMPLEMENT "BATCH-BACKGROUND" COMMAND
;<4.UTILITIES>SETSPD.MAC.17, 24-Aug-78 12:07:17, EDIT BY R.ACE
;TCO 4.1993 - ADD COMMAND: ENABLE TAPE-DRIVE-ALLOCATION
;ADDED COMMENTING TO BEGINNING OF MODULE
;<R.ACE.LT>SETSPD.MAC.4, 23-Aug-78 16:44:38, EDIT BY R.ACE
;<R.ACE.LT>SETSPD.MAC.3, 23-Aug-78 13:19:33, EDIT BY R.ACE
;<R.ACE.LT>SETSPD.MAC.2, 23-Aug-78 12:12:30, EDIT BY R.ACE
;<2MCLEAN>SETSPD.MAC.17, 28-Jul-78 15:36:32, Edit by MCLEAN
;<3A.UTILITIES>SETSPD.MAC.16, 26-Jul-78 15:00:29, Edit by MCLEAN
;<4.UTILITIES>SETSPD.MAC.13, 18-Jul-78 14:10:12, EDIT BY MILLER
;CHANGE VERSION NUMBER TO 4
;<4.UTILITIES>SETSPD.MAC.12, 16-May-78 09:23:45, EDIT BY MILLER
;ADD MINOR VERSION TO CONFIG FILE NAME
;<4.UTILITIES>SETSPD.MAC.11,  6-May-78 22:17:11, Edit by MCLEAN
;<3A.UTILITIES>SETSPD.MAC.21,  4-Aug-78 13:13:02, Edit by MCLEAN
;<3A.UTILITIES>SETSPD.MAC.20,  4-Aug-78 13:11:23, Edit by MCLEAN
;<3A.UTILITIES>SETSPD.MAC.19,  3-Aug-78 17:12:20, Edit by MCLEAN
;<3A.UTILITIES>SETSPD.MAC.18, 28-Jul-78 15:33:15, Edit by MCLEAN
;<3A.UTILITIES>SETSPD.MAC.17, 27-Jul-78 14:41:21, EDIT BY MILLER
;INCREMENT EDIT NUMBER
;<3A.UTILITIES>SETSPD.MAC.16, 26-Jul-78 15:00:29, Edit by MCLEAN
;<3A.UTILITIES>SETSPD.MAC.15, 16-May-78 09:21:33, EDIT BY MILLER
;<3A.UTILITIES>SETSPD.MAC.14, 16-May-78 09:19:58, EDIT BY MILLER
;<3A.UTILITIES>SETSPD.MAC.13, 16-May-78 09:17:32, EDIT BY MILLER
;AND CHANGE VERSION TO 3A
;<3A.UTILITIES>SETSPD.MAC.12, 16-May-78 09:16:35, EDIT BY MILLER
;ADD MINOR VERSION TO CONFIG NAME
;<1MCLEAN>SETSPD.MAC.17,  4-May-78 18:31:02, Edit by MCLEAN
;<1MCLEAN>SETSPD.MAC.16,  4-May-78 18:24:33, Edit by MCLEAN
;<1MCLEAN>SETSPD.MAC.15,  4-May-78 17:37:31, Edit by MCLEAN

;<1MCLEAN>SETSPD.MAC.14,  4-May-78 17:22:55, Edit by MCLEAN
;<1MCLEAN>SETSPD.MAC.13,  4-May-78 17:22:03, Edit by MCLEAN
;<1MCLEAN>SETSPD.MAC.12,  4-May-78 16:22:12, Edit by MCLEAN
;<1MCLEAN>SETSPD.MAC.11,  4-May-78 16:16:56, Edit by MCLEAN
;TCO 1880 ADD SLAVE TYPES TO MTALN JSYS
;<4.UTILITIES>SETSPD.MAC.9,  9-Apr-78 13:24:57, EDIT BY MILLER
;MERGE IN CHANGES TO NODE COMMAND FROM 3A SOURCE
;<4.UTILITIES>SETSPD.MAC.8,  7-Apr-78 00:40:43, Edit by MCLEAN
;<3A.UTILITIES>SETSPD.MAC.9,  7-Apr-78 00:15:05, Edit by MCLEAN
;<3A.UTILITIES>SETSPD.MAC.8,  7-Apr-78 00:13:21, Edit by MCLEAN
;<3A.UTILITIES>SETSPD.MAC.7,  7-Apr-78 00:07:24, Edit by MCLEAN
;ADD HSB (HALT STATUS BLOCK) FOR KS10
;<4.UTILITIES>SETSPD.MAC.5,  2-Mar-78 15:04:19, Edit by PORCHER
;<4.UTILITIES>SETSPD.MAC.4, 28-Feb-78 14:35:36, Edit by PORCHER
;<4.UTILITIES>SETSPD.MAC.3, 28-Feb-78 14:25:25, Edit by PORCHER
;ADD "CHANGE" COMMAND FOR ACCOUNTING SHIFT CHANGES
;<4.UTILITIES>SETSPD.MAC.2, 31-Jan-78 00:41:13, Edit by MCLEAN
;MAGTAPE ONLINE ENTRY VECTOR UPDATES
;<4.UTILITIES>SETSPD.MAC.2, 16-Dec-77 14:01:29, EDIT BY MILLER
;<4.UTILITIES>SETSPD.MAC.1, 16-Dec-77 13:56:02, EDIT BY MILLER
;TCO 1879. ADD NODE COMMAND
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1976,1977,1978,1979,1980 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

	SEARCH MONSYM,MACSYM,SERCOD
	.REQUIRE SYS:MACREL,SERCOD
	TITLE SETSPD
	SALL
	.DIRECTIVE FLBLST	;SUPPRESS LENGTHY BINARY EXPANSIONS

; VERSION NUMBER DEFINITIONS

VMAJOR==4		;MAJOR VERSION OF SETSPD
VMINOR==0		;MINOR VERSION NUMBER
VEDIT==20		;EDIT NUMBER
VWHO==0			;GROUP WHO LAST EDITED PROGRAM (0=DEC DEVELOPMENT)

VSTSPD== <VWHO>B2+<VMAJOR>B11+<VMINOR>B17+VEDIT
; THIS PROGRAM IS RUN BY JOB 0 TO PERFORM VARIOUS USER-MODE
; FUNCTIONS THAT AFFECT THE OPERATION OF THE SYSTEM

; DEPENDING UPON THE DESIRED ACTION, THE PROGRAM IS STARTED AT
; ONE OF SEVERAL POSITIONS IN ITS ENTRY VECTOR.

; POS	DESCRIPTION
; ---	--------
;
;  0	CALLED ONCE DURING SYSTEM STARTUP BY RUNDD ROUTINE IN MEXEC.
;	READS FILE "SYSTEM:x-CONFIG.CMD" FOR COMMANDS:
;	  CHANGE - set accounting shift change times
;	  DEFINE - define system-wide logical names
;	  ENABLE/DISABLE account validation
;	  ENABLE/DISABLE directory-parameter setting by non-priv users
;	  ENABLE/DISABLE use of hardware disk optimization feature
;	  ENABLE/DISABLE magtape drive assignment by MTCON
;	  HOST - set ARPANET host number of this CPU
;	  MAGTAPE - logical magtape units (e.g. MTA3:) with
;		actual serial numbers
;	  NODE - set DECNET node name and number for this CPU
;	  PRINTER - load VFU and RAM files and set lowercase attribute
;	  TERMINAL - set auto-baud, nobell, remote, and speed
;		attributes of terminals
;	  TIMEZONE - set time zone for this site
;
;  1	THIS ENTRY IF FUNCTIONALLY EQUIVALENT TO POSITION 0,
;	BUT IT IS NOT USED BY THE MONITOR.
;
;  2 	CONTAINS PROGRAM VERSION NUMBER.
;
;  3	CALLED BY RUNDD ROUTINE IN MEXEC DURING SYSTEM
;	INITIALIZATION AFTER A CRASH TO:
;	1. Copy PS:<SYSTEM>DUMP.EXE to PS:<SYSTEM>DUMP.CPY
;	2. Extract unrecorded SYSERR entries from DUMP.EXE and
;	   log them using the SYERR JSYS
;
;  4	CALLED BY CHKR ROUTINE IN MEXEC WHILE SYSTEM IS RUNNING
;	WHENEVER PHYSIO DETECTS THAT A TAPE DRIVE HAS COME ONLINE
;	AND PHYSIO DIDN'T KNOW ABOUT THE DRIVE AT SYSTEM STARTUP.
;	THE CONFIG FILE IS READ AS IF ENTERED AT ENTRY VECTOR
;	POSITION 0, EXCEPT ONLY THE "MAGTAPE" COMMANDS IN THE
;	FILE ARE PROCESSED; ALL OTHER COMMANDS ARE IGNORED.
SUBTTL SETSPD DATA


CLSBLK:	3			;COUNT
	BLOCK 2			;DATA ARE
MTBLK:	3			;SIZE OF BLOCK
	BLOCK 2			;FOR OTHER ARGS
EOLF:	BLOCK 1
PDLEN=100			;LENGTH OF PUSH-DOWN STACK
PDL:	BLOCK PDLEN		;PUSH-DOWN STACK
FILNAM:	BLOCK ^D28		;NAME OF RAM OR VFU FILE PUT HERE
LINES:	BLOCK 1			;WORD TO HOLD LINES
STRBLK:	BLOCK .MSSLN		;BLOCK FOR STRUCTURE COMMAND
HSBBUF:	BLOCK HS%LEN		;LENGTH OF HSB AND HEADER
ASCTBL:	BLOCK <ASCTBZ==^D100>+1	;ACCOUNTING SHIFT CHANGE TABLE
SPDTBL==10000			;SPEED TABLE
REMTBL==20000			;REMOTE TABLE

	CPYPGS==^D10		;# OF PAGES TO COPY WITH EACH PMAP
	CPYWDS==CPYPGS_PGSFT	;NUMBER OF WORDS TO COPY
	PGSFT==11		;PAGE SHIFT VALUE
PG0PG==30			;PAGE 0 OF DUMP.EXE
	PG0ADR=PG0PG_PGSFT
TMPPG==31			;2 PAGES FOR TEMPORARY MAPPING
	TMPADR=TMPPG_PGSFT
DMPPG==40			;PAGE FOR MAPPING DUMP FILE
	DMPADR==DMPPG_PGSFT
CPYPG==DMPPG+CPYPGS		;PAGE FOR MAPPING COPY FILE
	CPYADR==CPYPG_PGSFT

;THE TEXTI ARG BLOCK

TEXT:	7
FLAGS:	RD%JFN!RD%PUN		;FLAGS
JFN:	0,,377777		;JFN'S
BUFPTR:	-1,,BUFFER		;BUFFER POINTER
COUNT:	SIZE			;SIZE OF BUFFER
	0
	0
BRKMAD:	0			;BREAK MASK ADDRESS
BRKMSK:	0			;MASK 0
	1B0			;SPACE
	0
	0
SIZE==100
SIZEB==SIZE*5		;# OF BYTES IN BUFFER

BUFFER:	BLOCK SIZE		;WORK BUFFER
ATMBFR:	BLOCK SIZE		;COMND JSYS ATOM BUFFER
CSB:	BLOCK 12		;COMND JSYS STATE BLOCK

;PROGRAM ENTRY VECTOR

ENTVEC:	JRST START		;STARTING LOCATION
	JRST START		;REENTER LOCATION
	VSTSPD			;VERSION NUMBER
	JRST START3		;ALTERNATE STARTING LOCATION
	JRST START4		;MTA ONLINE ENTRY VECTOR

ENVLEN==.-ENTVEC		;ENTRY VECTOR LENGTH
;COMMAND TABLES:

;****************************************************************
;
;	WARNING!!!
;
;	THESE TABLES MUST BE KEPT IN ALPHABETICAL ORDER FOR TBLUK
;
;****************************************************************

ALTLVT:	1,,1			;MAGTAPE ONLY
	XWD [ASCIZ /MAGTAPE/],MAGTAP

; ---- NOTE ----
;
; To all implementors of new SETSPD commands: The COMNDI and COMNDX
; routines permit you to parse commands using the COMND JSYS. Refer
; to the TRECER routine for an example of how to parse using COMND.

LEV1TB:	ELEVL1-.-1,,ELEVL1-.-1
	XWD [ASCIZ /ARCHIVE-TAPE-RECYCLE-PERIOD/],ARCHIV
	XWD [ASCIZ /BACKGROUND/],BATBGD
	XWD [ASCIZ /BATCH-CLASS/],BCHCLS
	XWD [ASCIZ /BIAS/],BIAS
	XWD [ASCIZ /CHANGE/],CHANGE
	XWD [ASCIZ /CREATE/],CREATE
	XWD [ASCIZ /DEFINE/],DEFINE
	XWD [ASCIZ /DISABLE/],DISABL
	XWD [ASCIZ /ENABLE/],ENABLE
	XWD [ASCIZ /HOST/],HOST
	XWD [ASCIZ /MAGTAPE/],MAGTAP
	XWD [ASCIZ /NODE/],NODNAM
	XWD [ASCIZ /PRINTER/],LPTLOD
	XWD [ASCIZ /TAPE-RECOGNITION-ERRORS/],TRECER
	XWD [ASCIZ /TAPE-RECYCLE-PERIOD/],TAPRCY
	XWD [ASCIZ /TERMINAL/],TERM
	XWD [ASCIZ /TIMEZONE/],TIMZON
ELEVL1:

;TABLE FOR TERMINAL CHARACTERISTICS

LEV2TB:	ELEVL2-.-1,,ELEVL2-.-1
	XWD [ASCIZ /AUTO-BAUD/],AUTO
	XWD [ASCIZ /NOBELL/],NOBELL
	XWD [ASCIZ /REMOTE/],REMOTE
	XWD [ASCIZ /SPEED/],SPEED
ELEVL2:

; TABLE OF OPTIONS FOR ENABLE COMMANDS

ENAOPT:	ENASIZ-1,,ENASIZ-1
	XWD [ASCIZ/ACCOUNT-VALIDATION/], ENACCT
	XWD [ASCIZ /CLASS-SCHEDULING/],ECSKED
	XWD [ASCIZ/DIRECTORY-PARAMETER-SETTING/], ENADIR
	XWD [ASCIZ/FULL-LATENCY-OPTIMIZATION/], ENAFLO
	XWD [ASCIZ/TAPE-DRIVE-ALLOCATION/], ENATDA
	XWD [ASCIZ/WORKING-SET-PRELOADING/], ENAWSP

	ENASIZ==.-ENAOPT

; TABLE OF OPTIONS FOR DISBLE COMMANDS

DISOPT:	DISSIZ-1,,DISSIZ-1
	XWD [ASCIZ/ACCOUNT-VALIDATION/], DISACT
	XWD [ASCIZ/DIRECTORY-PARAMETER-SETTING/], DISDIR
	XWD [ASCIZ/FULL-LATENCY-OPTIMIZATION/], DISFLO
	XWD [ASCIZ/WORKING-SET-PRELOADING/], DISWSP

	DISSIZ==.-DISOPT

; TABLE OF OPTIONS FOR LOADING PRINTERS

LPTTAB:	LPTBSZ-1,,LPTBSZ-1
	XWD [ASCIZ /LOWERCASE/], .MOSTS
	XWD [ASCIZ /RAM/], .MOLTR
	XWD [ASCIZ /VFU/], .MOLVF

	LPTBSZ==.-LPTTAB

SLAVT:	SLVBSZ-1,,SLVBSZ-1
	XWD [ASCIZ /TU45/],.MTT45	;TU45
	XWD [ASCIZ /TU70/],.MTT70	;TU70
	XWD [ASCIZ /TU71/],.MTT71
	XWD [ASCIZ /TU72/],.MTT72	;TU72
	SLVBSZ==.-SLAVT


;TABLE OF DAYS OF WEEK FOR "CHANGE" COMMAND

DOWTAB:	XWD DOWTBZ-1,DOWTBZ-1
	XWD [ASCIZ /ALL/],<1B0!1B1!1B2!1B3!1B5!1B6>_-^D18
	XWD [ASCIZ /FRIDAY/],<1B4>_-^D18
	XWD [ASCIZ /MONDAY/],<1B0>_-^D18
	XWD [ASCIZ /SATURDAY/],<1B5>_-^D18
	XWD [ASCIZ /SUNDAY/],<1B6>_-^D18
	XWD [ASCIZ /THURSDAY/],<1B3>_-^D18
	XWD [ASCIZ /TUESDAY/],<1B1>_-^D18
	XWD [ASCIZ /WEDNESDAY/],<1B2>_-^D18
	XWD [ASCIZ /WEEKDAYS/],<1B0!1B1!1B2!1B3!1B4>_-^D18
	XWD [ASCIZ /WEEKENDS/],<1B5!1B6>_-^D18

;TABLE FOR TYPE OF CLASS SCHEDULING DESIRED

SKDOPT:	SKDSIZ-1,,SKDSIZ-1
	XWD [ASCIZ /ACCOUNTS/],0
	XWD [ASCIZ /POLICY-PROGRAM/],1
SKDSIZ==.-SKDOPT

;TABLE FOR WINDFALL HANDLING

SKDOP0:	SKDSZ0-1,,SKDSZ0-1
	XWD [ASCIZ /ALLOCATED/],0
	XWD [ASCIZ /WITHHELD/],1
SKDSZ0==.-SKDOP0
DOWTBZ=.-DOWTAB
;DEFINE REGISTERS USED

A==1
B==2
C==3
D==4
T1=1
T2=2
T3=3
T4=4
Q1==5
Q2==6
Q3==7
P1==10
P2==11
P3==12
P4==13
P5==14
P==17

;USEFUL DEFINITIONS

DEFSTR SEBSIZ,0,17,12		;POINTER TO SIZE FIELD IN SYSERR BLOCK
DEFSTR SEBERC,HSBBUF,8,9

	SEBQOU=24		;ADDRESS OF POINTER TO SYSERR QUEUE
	SEBHED==2		;NUMBER OF HEADER WORDS IN SYSERR BLOCK

;DEFINE INTERRUPT SYSTEM TABLES

ADDR:	BLOCK 1
LEVTAB:	ADDR
CHNTAB:	1,,LPTINT

DEFINE EMSG (ETXT) <		;;ERROR-MESSAGE MACRO
	HRROI T1,[ASCIZ/
? SETSPD: ETXT
/]
	PSOUT>

	DEFINE BCONFIG (R)  <
	IFE VMINOR,<ASCIZ /SYSTEM:'R'-CONFIG.CMD/>
	IFG VMINOR,<
	 DEFINE BSP (R1,LETT) <
		IRPC LETT,<
		IFE "A"-"'LETT'"+VMINOR-1,<
			ASCIZ /SYSTEM:'R1'LETT'-CONFIG.CMD/
			STOPI>
		>
		>
	BSP (\VMAJOR,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>
	>

RCONFG:	BCONFIG (\VMAJOR)
SUBTTL SETSPD PROCEDURE

;ENTRY POINTS FOR READING CONFIG.CMD FILE

START4:	TDZA P5,P5		;INDICATE MTA ONLINE ENTRY
START:	SETOM P5		;INDICATE NORMAL ENTRY
	MOVE P,[IOWD PDLEN,PDL]	;SET UP PUSH DOWN LIST
	CALL INIT		;SET UP PSI, CAPABILITIES, ETC.

;NOW FIND THE COMMAND FILE

	MOVX A,GJ%SHT!GJ%OLD!GJ%PHY
	HRROI B,RCONFG		;SYSTEM:X-CONFIG.CMD
	GTJFN			;FIND THE FILE
	 JRST FINISH		;NOT THERE. GO DEFAULT EVERYTHING
	HRLM A,JFN		;STASH THE JFN IN THE TEXTI BLOCK
	MOVE B,[070000,,200000]	;READ ONLY
	OPENF			;GET IT
	 JRST [	MOVEI A,.PRIOU	;THE CTY NO DOUBT
		HRLOI B,.FHSLF	;THIS FORK
		SETZ C,		;NO FLAGS
		ERSTR		;OUTPUT SOMETHING
		 JFCL
		 JFCL
		JRST FINISH]	;AND GO DEFAULT EVERYTHING

;FOUND THE FILE. NOW PROCESS THE COMMANDS


CMND:	CALL PBLANK		;SKIP BLANKS
	 JRST .-1		;NULL LINE
	CAIE B,";"		;A COMMENT?
	CAIN B,"!"		;OR THIS TYPE
	JRST PURGE		;YES. SKIP ALL OF THE LINE
	SKIPN P5		;CHECK FOR MAGTAPE ENTRY
	SKIPA A,[ALTLVT]	;ALTERNATE TABLE
	MOVEI A,LEV1TB		;THE TABLE
	JRST GTKEY		;GO FIND AND DISPATCH ON KEY
; INIT - RESET PROCESS, SET UP SOFTWARE INTERRUPT SYSTEM,
;	 ENABLE CAPABILITIES
; RETURNS +1: ALWAYS

INIT:	RESET			;GET TO A KNOWN STATE
	MOVEI A,.FHSLF		;GET OWN ID
	RPCAP			;READ CAPABILITES
	MOVE C,B
	EPCAP			;ENABLE ALL CAPABILITIES
	MOVE B,[LEVTAB,,CHNTAB]
	SIR			;SET INTERRUPT TABLE ADDRESSES
	EIR			;TURN ON INTERRUPT SYSTEM
	MOVSI B,(1B0)
	AIC			;ENABLE LPT CHANNEL
	RET
;ROUTINE TO PURGE INVALID COMMAND

PURGE1:	HLRZ A,JFN
	BKJFN			;GO BACK ONE
	 JFCL
PURGE:	MOVX A,RD%BEL!RD%JFN	;FIND END OF COMMAND
	MOVEM A,FLAGS
	HRROI A,BUFFER		;WHERE TO PUT IT
	MOVEM A,BUFPTR
	MOVEI A,SIZEB		;SIZE OF BUFFER
	MOVEM A,COUNT		;TO THE ARG BLOCK
	MOVEI A,TEXT		;ARG BLOCK
	TEXTI			;PURGE THE COMMAND
	 JRST FINISH		;FILE SCREWED UP. GO FINISH UP
	MOVX A,RD%BTM		;CHECK FOR TERMINATOR FOUND
	TDNE A,FLAGS		;DID WE
	JRST CMND		;YES. GO TO NEXT COMMAND
	CALL SEEEOF		;SEE IF AT EOF
	 JRST PURGE		;NOT .CONTINUE PURGING
	JRST FINISH		;YES. ALL DONE

SEEEOF:	HLRZ A,JFN		;SEE IF AT EOF
	GTSTS			;GET STATUS
	TXNE B,GS%EOF		;AT EOF?
	AOS 0(P)		;YES
	RET			;RETURN

;ROUTINE TO SKIP BLANKS AND TABS
;WILL RETURN TERMINATING BYTE IN B

PBLANK:	HLRZ A,JFN
	BIN			;GET NEXT BYTE
	CAIN B,.CHLFD		;A LINE FEED?
	RET			;YES. TELL HIM EOL
	JUMPE B,[ CALL SEEEOF	;SEE IF EOF
		  JRST .+1	;NO
		 JRST FINISH]	;YES. BAD FILE
	CAIE B," "		;A BLANK
	CAIN B,"	"	;OR A TAB?
	JRST PBLANK		;YES. SKIP IT
	CAIN B,15		;A CR?
	JRST PBLANK		;YES. SKIP IT
	BKJFN
	 JFCL
	AOS (P)			;SKIP
	RET			;AND DONE
;CODE TO FIND THE NEXT KEY WORD IN THE COMMAND FILE AND DISPATCH
;TO THE ACTION ROUTINE. INPUT IS:
;	A/ ADDRESS OF TABLE


GTKEY:	PUSH P,A		;SAVE ARG
	MOVEI A,SIZEB		;SIZE OF BUFFER
	MOVEM A,COUNT		;TO ARG BLOCK
	HRROI A,BUFFER		;WHERE DATA IS GOING
	MOVEM A,BUFPTR
	MOVX A,RD%JFN!RD%PUN!RD%BEL ;FLAGS
	MOVEM A,FLAGS		;TO THE ARGS
GTKEY1:	MOVEI A,TEXT		;ARG BLOCK
	TEXTI			;READ KEY VALUE
	 JRST FINISH		;FILE IS SCREWED UP. GO FINISH
	MOVX A,RD%BTM		;SEE IF FOUND TERMIANTOR
	TDNN A,FLAGS		;DID WE?
	JRST [	CALL SEEEOF	;NO. AT EOF?
		 JRST PURGE	;NO. SKIP REST OF LINE
		JRST FINISH]	;YES. DONE
	LDB A,BUFPTR		;GET TERMINATOR
	SETZM EOLF		;NOT AN EOL
	CAIN A,.CHLFD		;WAS IT A LINE FEED?
	SETOM EOLF		;YES. REMEMBER THIS
	CAIN A,"-"		; Dash in command name?
	JRST GTKEY1		; Yes, eat the rest of it please

;FOUND KEY WORD. DO DISPATCH

	SETZ B,
	DPB B,BUFPTR		;TIE OFF STRING
	SKIPE EOLF		;AT END OF LINE?
	JRST [	MOVE A,BUFPTR	;YES
		BKJFN		;BACK UP BYTE POINTER
		 JFCL
		LDB C,A
		CAIN C,15	;A CR?
		DPB B,A		;YES. ZAP IT TOO
		JRST .+1]
	POP P,A			;TABLE
	HRROI B,BUFFER		;THE KEY WORD
	TBLUK			;LOOK UP THE ENTRY
	TXNN B,TL%ABR!TL%EXM	;GOT A GOOD MATCH?
	JRST [	SKIPE EOLF	;NO. FOUND EOL YET?
		JRST CMND	;SKIP IT
		JRST PURGE]	;GO PURGE
	HRRZ A,0(A)		;GET DISPACTH ADDRESS
	JRST 0(A)		;GO TO IT
; SUPPORT ROUTINES FOR PARSING USING THE COMND JSYS

; COMNDI - GET REMAINDER OF LINE BEING PARSED INTO "BUFFER"
;	   AND PREPARE COMND STATE BLOCK FOR PARSE
; RETURNS +1: COMMAND LINE NOT SUITABLE FOR PARSING
;	      CALLER SHOULD EXIT TO "PURGE1" ROUTINE
;	  +2: COMMAND LINE READY TO BE PARSED BY COMNDX ROUTINE

COMNDI:	MOVX T1,RD%BEL!RD%JFN	;FIND END OF COMMAND
	MOVEM T1,FLAGS
	HRROI T1,BUFFER		;WHERE TO PUT IT
	MOVEM T1,BUFPTR
	MOVEI T1,SIZEB		;SIZE OF BUFFER
	MOVEM T1,COUNT		;TO THE ARG BLOCK
	MOVEI T1,TEXT		;GET ADDRESS OF ARG BLOCK
	TEXTI			;READ THE REMAINDER OF THE COMMAND
	 RET			;FILE SCREWED UP
	MOVX T1,RD%BTM
	TDNN T1,FLAGS		;LINE-FEED HIT?
	RET			;NO

; SET UP COMND JSYS STATE BLOCK

	MOVX T3,CM%RAI+CM%XIF	;RAISE INPUT, NO INDIRECT FILE
	MOVEM T3,CSB+.CMFLG
	SETZM CSB+.CMIOJ	;SET BAD JFNS TO PREVENT TTY I/O
	HRROI T3,[0]
	MOVEM T3,CSB+.CMRTY	;CTRL/R BUFFER BYTE POINTER
	HRROI T1,BUFFER
	MOVEM T1,CSB+.CMBFP	;BEGINNING OF INPUT
	MOVEM T1,CSB+.CMPTR	;POINTER TO NEXT FIELD TO BE PARSED
	MOVEI T2,SIZEB
	MOVEM T2,CSB+.CMCNT	;SIZE OF AREA AFTER .CMPTR
	MOVEM T2,CSB+.CMINC	;# OF UNPARSED CHARS AFTER .CMPTR
	HRROI T3,ATMBFR
	MOVEM T3,CSB+.CMABP	;POINTER TO ATOM BUFFER
	MOVEI T3,SIZEB
	MOVEM T3,CSB+.CMABC	;SIZE OF ATOM BUFFER (CHARACTERS)
	SETZM CSB+.CMGJB	;GTJFN BUFFER ADDRESS
	RETSKP			;TAKE SUCCESSFUL RETURN


; COMNDX - EXECUTE COMND JSYS TO PARSE COMMAND LINE
;  T1/ ADDRESS OF FUNCTION DESCRIPTOR BLOCK
;  CSB/ COMND JSYS STATE BLOCK SET UP BY COMNDI SUBROUTINE
; RETURNS +1: PARSE FAILED
;	  +2: PARSE SUCCEEDED, T2/ T2 RETURNED BY COMND JSYS
;			       T3/ ADDRESS OF FDB ACTUALLY USED

COMNDX:	MOVE T2,T1		;COPY FBD ADDRESS TO T2 FOR COMND
	MOVEI T1,CSB		;GET ADDRESS OF COMND STATE BLOCK
	COMND			;CALL MONITOR
	 ERJMP R		;JSYS FAILED, MAKE LIKE PARSE ERROR
	TXNE T1,CM%NOP		;PARSE ERROR?
	RET			;YES, RETURN +1, ERROR CODE IN T2
	HRRZS T3		;GET ACTUAL FDB ADDRESS IN T3
	RETSKP
;COMMAND LEVEL ACTION ROUTINES.

;FIRST TERMINAL

TERM:	SKIPE EOLF		;HAVE MORE ARGS?
	JRST CMND		;NO. IGNORE LINE
	CALL PBLANK		;SKIP BLANKS
	 JRST CMND		;FORGET IT

;NOW READ OUT THE LINE NUMBERS

	HLRZ A,JFN		;GET JFN
	MOVEI C,10		;READ NUMNER IN OCTAL
	NIN			;GET THE NUMBER
	 JRST PURGE1		;PURGE LINE
	HRLZM B,LINES		;SAVE FIST LINE NUMBER
	BKJFN			;READ OUT TERMINATOR AGAIN
	 JFCL
	BIN			;GET IT
	CAIN B,"-"		;SPECIFYING A RANGE?
	JRST GTRNGE		;YES. GET RANGE
	HLRS LINES		;EXTEND LINE NUMBER	
	JRST LINKEY		;GO GET THE KEY

GTRNGE:	NIN			;GET SECOND PART
	 JRST PURGE1		;PURGE BAD COMMAND
	HRRM B,LINES		;STASH LAST LINE NUMBER
	; ..
;NOW READ OUT THE KEY WORD

LINKEY:	HLRZ A,JFN
	BKJFN			;GET TERMINATOR
	 JFCL
	BIN			;""
	CAIN B,.CHLFD		;A LINE FEED?
	JRST LNKEY1		;YES. END OF THIS ONE
LNKEY:	CALL PBLANK		;SKIP BLANKS
	 JRST LNKEY1		;NO KEY WORDS
	SETZB P1,P2		;ASSUME IS REMOTE
	MOVEI A,LEV2TB		;KEY WORD
	JRST GTKEY		;GET KEY WORD

LNKEY1:	SETZB P1,P2		;NO KEYWORDS
	SETOM EOLF		;MARK THAT THE EOL WS SEEN
	JRST REMOTE		;GO SET THIS LINE UP

;IF HERE, LINES ARE REMOTE

AUTO:	TXOA P2,MO%AUT		;SET THE AUTO BUAD BIT
REMOTE:	TXO P2,MO%RMT		;SET THE REMOTE BIT
	HRRZ A,LINES		;GET FIRST LINE
	HLRZ B,LINES		;GET LAST LINE
	SUBI B,1(A)		;GET # TO DO
	HRLI A,0(B)		;AN AOBJN WORD
	HLR A,LINES		;FIRST LINE AGAIN
DOLINE:	SKIPN P1		;SETTING SPEED?
	IORM P2,REMTBL(A)	;SAY IT IS REMOTE
	SKIPE P1		;SETTING REMOTE?
	MOVEM P1,SPDTBL(A)	;NO. SET SPEED
	SKIPN SPDTBL(A)		;HAVE A SPEED YET?
	SKIPE EOLF		;NO, IS THIS THE END OF LINE?
	SKIPA			;YES, SET THE SPEED
	JRST REMOT1		;NO. GO ON UNITIL ONE APPEARS
	PUSH P,A		;SAVE LINES
	CALL SPDSET		;GO SET THE SPEED
	POP P,A			;RESTORE AOBJN WORD
REMOT1:	AOBJN A,DOLINE		;GO DO ALL OF THEM
	SKIPE EOLF		;FOUND AN EOF?
	JRST CMND		;YES. GO DO COMMAND
	JRST LNKEY		;NO
; HERE TO SET THE "IGNORE INPUT" (NO BELLS) BIT

NOBELL:	HRRZ D,LINES		;GET LAST LINE NUMBER
	HLRZ B,LINES		;GET FIRST LINE NUMBER
	SUBI B,1(D)		;FORM - NUMBER IN RANGE
	HRLI D,(B)		;FORM AN AOBJN POINTER TO LOOP
	HLR D,LINES		; OVER ALL THE LINES IN THE RANGE

NOBEL1:	MOVEI A,400000(D)	;GET LINE DESIGNATOR
	MOVX B,.MOSIG		;SET "IGNORE INPUT" BIT
	MOVX C,1		;TURN THE BIT ON
	MTOPR			;SET THE LINE TO IGNORE CHARACTERS UNTIL OPENED
	 ERJMP .+1		;IGNORE FAILURE HERE
	AOBJN D,NOBEL1		;LOOP OVER ALL THE LINES IN THE INDICATED RANGE
	JRST LNKEY		;GO GET THE NEXT KEYWORD IN THE COMMAND
;SET LINE SPEEDS

SPEED:	CALL PBLANK		;SKIP BLANKS
	 JRST CMND		;GIVE IT UP
	HLRZ A,JFN		;THE FILE
	MOVEI C,^D10		;GET SPEED IN DECIMAL
	NIN			;GET IT
	 JRST PURGE1		;GIVE UP
	HRRZ P1,B		;SAVE SPEED
	HRLI P1,400000(B)	;IN CASE NO MORE
	BKJFN			;LOOK AT TERMINATOR
	 JFCL
	BIN			;GET IT
	CAIN B,.CHLFD		;A LINE FEED?
	SETOM EOLF		;YES. REMEMBER THIS
	SKIPE EOLF
	JRST REMOTE		;GO DO IT
	CALL PBLANK		;GO FIND OTHER SPEED
	 JRST [	SETOM EOLF	;REMEMBER EOL
		JRST REMOTE]	;GO SET THE SPEED
	MOVEI C,^D10
	NIN			;READ THE BYTE
	 JRST PURGE1		;BLEW IT
	HRRI P1,0(B)		;SAVE OUTPUT SPEED
	BKJFN
	 JFCL
	BIN
	CAIN B,.CHLFD		;A LINE FEED?
	SETOM EOLF		;REMEMBER EOL

	JRST REMOTE		;GO SET SPEEDS
;ROUTINE TO SET SPEED OF A LINE.
;INPUT IS :	A/ LINE NUMBER

SPDSET:	MOVEI A,0(A)		;CLEAN UP ARG
	SKIPE REMTBL(A)		;THIS A REMOTE SETTING?
	JRST SPDST1		;YES. ALWAYS USE FILE SETTING
	MOVEI A,400000(A)	;GET TTY DESIGNATOR
	MOVEI B,.MORSP		;GET SPEED FROM MONITOR
	MTOPR			;GET IT
	ERJMP REMOT2		;?
	TRZ A,400000
	SKIPG C			;GET IT?
SPDST1:	MOVE C,SPDTBL(A)	;NO. USE FILE'S VALUE
	TLZ C,(1B0)		;GET RID OF SIGN BIT
	MOVEI B,.MOSPD		;SPEED SETTING
	IOR B,REMTBL(A)		;ADD IN THE REMOTE AND AUTO BITS (IF ANY)
	TRO A,400000		;TTY DESIGNATOR
	MTOPR			;DO IT
	 ERJMP REMOT2		;IGNORE ERROR
	MOVEI B,.MORNT		;REQ MSG SUPPRESS STATUS FROM
	MTOPR			;MONITOR FOR TTY (A/ TTY#)
	 ERJMP REMOT2		;IGNORE ERROR
	MOVEI B,.MOSNT		;SET MSG SUPPRESS BIT FOR TTY
	MTOPR			;SAME AS BEFORE
	 ERJMP REMOT2		;IGNORE ERROR
REMOT2:	RET			;ALL DONE

;ROUTINE TO APPLY DEFAULT SPEEDS AT EOF

FINISH:	SETZM BRKMAD		;RESET BREAK MASK
	JUMPE P5,QUIT		;QUIT IF MTA ONLINE
	MOVE A,[SIXBIT /TTYJOB/] ;FIRST FIND # OF TTY'S
	SYSGT			;GET IT
	HLLZ P3,B		;MAKE AOBJN POINTER
FIN1:	SKIPE SPDTBL(P3)	;THIS ONE SET YET?
	JRST FIN2		;YES. GO ON
	MOVEI A,0(P3)		;NO. GET LINE #
	MOVE B,[^D300,,^D300]	;DEFAULT SPEED
	MOVEM B,SPDTBL(A)	;STORE IT
	CALL SPDSET		;GO SET THE SPEED
FIN2:	AOBJN P3,FIN1		;DO ALL LINES
	CALL REFILL		;GO LOAD THE CACHE REFILL ALGORITHM
QUIT:	HALTF			;AND DONE
;THIS CODE PROCESSES THE MAGTAPE CONFIGURATION COMMANDS. FORMAT
;OF A COMMAND LINE IS:
;	MAGTAPE "LUN" "SERIAL#" "SLAVE TYPE"

MAGTAP:	SKIPN EOLF		;AT EOL YET?
	CALL PBLANK		;NO. GET TO LUN THEN
	 JRST CMND		;NO MORE STUFF
	HLRZ A,JFN		;GET INPUT
	MOVEI C,10		;GET NUMBER IN OCTAL
	NIN			;GET LUN
	 JRST PURGE1		;BAD LINE
	MOVE P1,B		;SAVE LUN
	CALL PBLANK		;GET TO NEXT VALUE
	 JRST CMND		;BAD LINE. JUST GO SKIP IT
	MOVE D,P1		;RESOTRE LUN
	MOVEI C,12		;GET DECIMAL SERIAL NUMBER
	HLRZ A,JFN		;THE JFN
	NIN			;DO IT
	 JRST PURGE1		;BAD COMMAND
	HRRZ P2,B		;SAVE SERIAL NUMBER
	BKJFN			;LOOK FOR TERMINATOR
	HLRZ A,JFN		;READ A CHARACTER
	BIN			;GET IT
	CAIN B,.CHLFD		;LINEFEED?
	JRST MAGTP1		;YUP END
	CALL PBLANK		;REMOVE BLANKS
	JRST MAGTP1			;END OF COMMAND
	HRROI A,BUFFER		;READ REST
	MOVEM A,BUFPTR
	MOVEI A,SIZEB		;STORE SIZE
	MOVEM A,COUNT
	MOVX A,RD%JFN!RD%BEL!RD%PUN
	MOVEM A,FLAGS
	MOVEI A,TEXT		;FIND ARGUMENT
	TEXTI			;GET STRING
	JRST FINISH		;QUIT END OF FILE
	MOVX A,RD%BTM		;CHECK FOR CORRECT TERMINATION
	TDNN A,FLAGS
	JRST [CALL SEEEOF	;CHECK FOR EOF
		JRST PURGE
		JRST FINISH]	;DONE
	MOVE A,BUFPTR		;GET TERMINATOR
	LDB C,A			;GET TERMINATING CHARACTER
	CAIE C,.CHLFD		;LF?
	JRST MAGTP2
	BKJFN			;BACKUP OVER LF
	 JSERR			;UNEXPECTED ERROR
	MOVEM A,BUFPTR		;SAVE NEW STRING POINTER
MAGTP2:	SETZ A,			;STORE NUL
	DPB A,BUFPTR		;TERMINATE STRING
	MOVEI A,SLAVT		;GET SLAVE TABLE
	HRROI B,BUFFER		;CHECK FOR MATCH
	TBLUK
	TXNN B,TL%EXM!TL%ABR	;CORRECT MATCH?
	JRST [SKIPE EOLF	;NO AT END OFLINE?
		JRST CMND	;YES. GO ON TO NEXT ONE
		JRST PURGE1]	;NOPE PURGE JUNK
	HRL P1,(A)		;GET UNIT TYPE
MAGTP1:	MOVE A,P1		;SET LUN
	MOVE B,P2		;SET SERIAL #
	MTALN			;DO IT
	ERJMP [	JUMPE P5,PURGE1	;NO MESSAGE IF MTA ONLINE
		HRROI A,[ASCIZ /
? SETSPD: Could not set MTA /]
		PSOUT
		MOVEI A,.PRIOU	;TO THE CTY
		EXCH B,D	;GET MTA, SAVE SERIAL #
		MOVEI C,10	;IN OCTAL
		NOUT		;DO IT
		 JFCL
		HRROI A,[ASCIZ / SERIAL # /]
		PSOUT
		MOVEI A,.PRIOU
		MOVE B,D
		MOVEI C,12
		NOUT		;OUPUT THE SERIAL # AS WELL
		 JFCL
		JRST .+1]	;AND DONE
	JRST PURGE1		;GO SYNCH LINE
; TAPE-RECOGINITION-ERRORS COMMAND

TRECER:	CALL COMNDI		;SET UP FOR PARSING WITH COMND JSYS
	 JRST PURGE1		;ERROR
	MOVEI T1,[FLDDB. .CMKEY,,TRETB] ;GET FDB ADDRESS
	CALL COMNDX		;PARSE NEXT KEYWORD
	 JRST [	EMSG <Unknown keyword for TAPE-RECOGNITION-ERRORS>
		JRST CMND]
	HRRZ T4,(T2)		;GET BIT SETTING
	MOVEI T1,.SFTDF		;GET TMON FUNCTION CODE
	TMON			;GET CURRENT MOUNTR CONTROLS
	STOR T4,MT%UUT,T2	;SET OR CLEAR UNLOAD-UNREADABLE-TAPES
	SMON			;RESTORE CONTROL WORD
	JRST CMND		;EXIT TO GET NEXT SETSPD COMMAND

; KEYWORD TABLE FOR TAPE-RECOGNITION-ERRORS

TRETB:	TRETBL,,TRETBL
	XWD [ASCIZ/REGARD-AS-UNLABELED/],0
	XWD [ASCIZ/UNLOAD/],1
TRETBL==.-TRETB-1
; ENABLE COMMAND

DISABL:	TDZA P1,P1		;MARK THAT THIS IS A DISABLE COMMAND
ENABLE:	SETOM P1		;MARK THAT THIS IS AN ENABLE COMMAND
	SKIPE EOLF		;AT END OF COMMAND ?
	JRST CMND		;YES, GO GET NEXT LINE
	CALL PBLANK		;SKIP BLANKS
	 JRST CMND		;PUNT
	HRROI A,BUFFER		;WHERE TO STASH IT
	MOVEM A,BUFPTR		;TO THE ARG BLOCK
	MOVEI A,SIZEB		;THE SIZE OF IT
	MOVEM A,COUNT		;TO THE BLOCK
	MOVX A,RD%JFN!RD%BEL
	MOVEM A,FLAGS		;TO ARG BLOCK
	MOVEI A,BRKMSK		;SET BREAK MASK FOR SPACE ONLY
	MOVEM A,BRKMAD
	MOVEI A,TEXT		;THE ARG BLOCK
	TEXTI			;GET DEFINITION
	 JRST FINISH		;FILE IS SCREWED UP
	SETZM BRKMAD		;RESET FOR NO MASK
	MOVX A,RD%BTM		;SEE IF PROPERLY TERMINATED
	TDNN A,FLAGS		;IS IT?
	JRST [	CALL SEEEOF	;NO. SEE IF EOF THEN
		 JRST PURGE	;NOT. DO MORE PURGING
		JRST FINISH]	;YES. ALL DONE
	MOVE A,BUFPTR		;GET BYTE POINTER
	LDB C,A			;GET TERMINATING CHARACTER
	CAIE C,.CHLFD		;TERMINATED BY A LINE FEED ?
	JRST ENA010		;NO, GO ON
	BKJFN			;YES, BACK UP TO CARRIAGE RETURN
	 JSERR			;UNEXPECTED ERROR
	MOVEM A,BUFPTR		;SAVE NEW POINTER TO TERMINATOR
ENA010:	MOVEI A,.CHNUL		;GET A NULL
	DPB A,BUFPTR		;TERMINATE STRING
	MOVEI A,ENAOPT		;GET ADDRESS OF OPTION TABLE
	SKIPL P1		;IS THIS AN ENABLE COMMAND ?
	MOVEI A,DISOPT		;NO, USE DISABLE OPTION TABLE
	HRROI B,BUFFER		;GET POINTER TO OPTION REQUESTED
	TBLUK			;FIND OPTION IN TABLE
	TXNN B,TL%EXM!TL%ABR	;FOUND A MATCH ?
	JRST [	SKIPE EOLF	;NO, AT END OF LINE ?
		JRST CMND	;YES, GO ON TO NEXT COMMAND
		JRST PURGE1 ]	;NO, IGNORE REMAINDER OF LINE
	HRRZ A,(A)		;GET ADDRESS OF PROCESSING ROUTINE
	CALL (A)		;GO PERFORM INDICATED FUNCTION
	SKIPE EOLF		;AT END OF LINE YET ?
	JRST CMND		;YES, GO ON TO  NEXT COMMAND
	JRST PURGE1		;NO, IGNORE REMAINDER OF LINE
; HERE TO PERMIT CHANGING DIRECTORY PARAMETERS

DISDIR:	TDZA B,B		;TURN OFF THE PARAMETER
ENADIR:	MOVEI B,1		;TURN ON THE OPTION
	MOVEI A,.SFCRD		;GET FUNCTION CODE
	SMON			;TELL THE MONITOR
	RET			;RETURN

; HERE TO ENABLE ACCOUNT VALIDATION

DISACT:	TDZA B,B		;TURN OFF ACCOUNT VALIDATION
ENACCT:	MOVEI B,1		;TURN ON ACCOUNT VALIDATION
	MOVEI A,.SFAVR		;GET THE FUNCTION CODE
	SMON			;TELL THE MONITOR
	RET			;RETURN

; HERE TO ENABLE/DISABLE FULL LATENCY OPTIMIZATION

DISFLO:	TDZA B,B		;TURN OFF FULL LATENCY OPTIMIZATION
ENAFLO:	MOVEI B,1		;TURN ON FULL LATENCY OPTIMIZATION
	MOVEI A,.SFFLO		;GET THE SMON FUNCTION CODE
	SMON			;SET THE DESIRED STATE
	RET			;AND RETURN

; HERE TO ENABLE TAPE-DRIVE-ALLOCATION

ENATDA:	MOVEI B,1		;TURN ON TAPE DRIVE ALLOCATION
	MOVEI A,.SFMTA		;GET SMON SUNCTION CODE
	SMON
	RET

; HERE TO ENABLE/DISABLE WORKING SET PRELOADING

DISWSP:	TDZA B,B
ENAWSP:	MOVEI B,1
	MOVEI A,.SFWSP
	SMON
	RET
;DEFINE A LOGICAL NAME

DEFINE:	SKIPE EOLF		;AT EOL?
	JRST CMND		;YES. GET NEXT COMMAND
	CALL PBLANK		;GO FIND LOGICAL NAME
	 JRST CMND		;NO ARGS
	HRROI A,BUFFER		;WHERE TO STASH IT
	MOVEM A,BUFPTR		;TO THE ARG BLOCK
	MOVEI A,SIZEB		;THE SIZE OF IT
	MOVEM A,COUNT		;TO THE BLOCK
	MOVX A,RD%JFN!RD%PUN!RD%BEL
	MOVEM A,FLAGS		;TO ARG BLOCK
	MOVEI A,TEXT		;THE ARG BLOCK
	TEXTI			;GET DEFINITION
	 JRST FINISH		;FILE IS SCREWED UP
	MOVX A,RD%BTM		;SEE IF PROPERLY TERMINATED
	TDNN A,FLAGS		;IS IT?
	JRST [	CALL SEEEOF	;NO. SEE IF EOF THEN
		 JRST PURGE	;NOT. DO MORE PURGING
		JRST FINISH]	;YES. ALL DONE
	LDB A,BUFPTR		;LOOK AT TERMINATER
	CAIN A,.CHLFD		;A LINE FEED?
	JRST CMND		;YES. NOTHING TO DEFINE THEN
	SETZ A,			;GET RID OF THE TERMINATER
	DPB A,BUFPTR		;TIE IT OFF
	CALL PBLANK		;GET TO DEFINITION
	 JRST CMND		;NOTHING TO DEFINE
	PUSH P,BUFPTR		;SAVE START OF DEFINITION
	MOVX A,RD%JFN!RD%BEL	;GET REST OF COMMAND
	MOVEM A,FLAGS
	MOVEI A,TEXT		;THE BLOCK
	TEXTI			;GOBBLE DOWN THE DEFINITION
	 JRST FINISH		;BAD FILE
	POP P,C			;THE DEFINITION
	MOVX A,RD%BTM		;SEE IF PROPERLY TERMINATED
	TDNN A,FLAGS		;IS IT?
	JRST [	CALL SEEEOF	;NO. SEE IF EOF
		 JRST PURGE	;NOT. ILLEGAL THEN
		JRST FINISH]	;IS. ALL DONE
	HRROI B,BUFFER		;THE LOGICAL NAME
	MOVEI A,.CLNSY		;CREATE A SYSTEM NAME
	CRLNM			;DO IT
	 JRST [	TMSG <
? SETSPD: Failed to define logical name >
		HRROI A,BUFFER	;GET NAME
		PSOUT		;OUTPUT IT
		TMSG < BECAUSE:
>				;AND A REASON
		MOVEI A,.PRIOU	;THE OUTPUT PLACE
		HRLOI B,.FHSLF	;US
		SETZ C,
		ERSTR		;OUTPUT THE MESSAGE
		 JFCL
		 JFCL
		JRST CMND]	;GO DO MORE
	JRST CMND		;GO DO MORE

;SET LOCAL TIME ZONE; IT MUST BE A NUMBER FROM -12 TO 12

TIMZON:	SKIPN EOLF		;GET TO THE ARGUMENT
	CALL PBLANK		; ...
	JRST CMND		;NONE THERE
	HLRZ A,JFN		;NOW READ A NUMBER FOR THE TIMEZONE
	MOVEI C,12		; IN DECIMAL
	NIN
	 JRST PURGE1		;NOT A GOOD ARGUMENT
	MOVM D,B		;CHECK IT FOR RANGE
	CAILE D,^D12		;MUST BE FROM -12 TO 12 DECIMAL
	 JRST [ EMSG <Illegal time zone value>
		JRST PURGE1]	;GO RE-SYNCH LINE
	MOVEI A,.SFTMZ		;SET TIME ZONE
	SMON			;ARGUMENT IN B
	 ERJMP TZERR
	JRST PURGE1		;SUCCESS, ON TO NEXT COMMAND

;ATTEMPT TO SET TIME ZONE FAILED

TZERR:	TMSG <
? SETSPD: Unable to set time zone because:
	>
GENERR:	MOVEI A,.PRIOU		;TYPE OUT MONITOR ERROR
	HRLOI B,.FHSLF		; FOR THIS FORK
	ERSTR
	 JFCL
	 JFCL
	JRST PURGE1		;ON TO NEXT LINE

;SET LOCAL HOST NUMBER OF AN ARPANET SITE

HOST:	SKIPN EOLF		;GET TO THE ARGUMENT
	CALL PBLANK		; ...
	 JRST CMND		;NONE THERE
	HLRZ A,JFN		;READ A NUMBER FOR THE SITE ADDRESS
	MOVEI C,10		; IN OCTAL
	NIN
	 JRST PURGE1		;NOT A GOOD ARGUMENT
	MOVEI A,.SFLHN		;SET LOCAL HOST NUMBER
	SMON
	 ERJMP HSTERR		;FAILED?
	JRST PURGE1		;NO, ON TO NEXT COMMAND

HSTERR: TMSG <
? SETSPD: Unable to set ARPANET site address because:
	>
	JRST GENERR
ARCHIV:	SKIPN EOLF		;GET TO THE ARGUMENT
	CALL PBLANK		; ...
	 JRST CMND		;NONE THERE
	HLRZ A,JFN		;READ A NUMBER OF DAYS
	MOVEI C,^D10		; IN DECIMAL
	NIN
	 JRST PURGE1		;NOT A GOOD ARGUMENT
	MOVEI A,.SFACY		; SET ARCHIVE TAPE RECYCLE PERIOD
	SMON
	 ERJMP ARCERR		;FAILED?
	JRST PURGE1		;NO, ON TO NEXT COMMAND

ARCERR:	TMSG <
? SETSPD: Unable to set archive tape recycle period because:
	>
	JRST GENERR

TAPRCY:	SKIPN EOLF		;GET TO THE ARGUMENT
	CALL PBLANK		; ...
	 JRST CMND		;NONE THERE
	HLRZ A,JFN		;READ A NUMBER OF DAYS
	MOVEI C,^D10		; IN DECIMAL
	NIN
	 JRST PURGE1		;NOT A GOOD ARGUMENT
	MOVEI A,.SFMCY		; SET TAPE RECYCLE PERIOD
	SMON
	 ERJMP TAPERR		;FAILED?
	JRST PURGE1		;NO, ON TO NEXT COMMAND

TAPERR:	TMSG <
? SETSPD: Unable to set tape recycle period because:
	>
	JRST GENERR
;COMMAND TO DECLARE DECNET NODE NAME

NODNAM:	SKIPE EOLF		;AT THE END-OF-COMMAND?
NODNA1:	JRST [	EMSG <Invalid name given for NODE command>
		JRST PURGE1]	;AND DO IT AGAIN
	CALL PBLANK		;SKIP BLANKS
	 JRST NODNA1		;ERROR
	MOVEI A,SIZEB		;SIZE OF BUFFER
	MOVEM A,COUNT
	HRROI A,BUFFER		;WHERE NAME WILL GO
	MOVEM A,BUFPTR		;TO ARG BLOCK
	MOVX A,RD%JFN!RD%PUN!RD%BEL!RD%CRF ;FLAGS
	MOVEM A,FLAGS
	MOVEI A,TEXT		;ARG BLOCK
	TEXTI			;GET NAME
	 JRST FINISH		;FILE IS BAD. GO WRAP UP
	MOVX A,RD%BTM		;SEE IF FOUND TERMINATOR
	TDNN A,FLAGS		;DID WE?
	JRST NODNA1		;NO. ERROR THEN
	LDB A,BUFPTR		;GET TERMINATOR?
	CAIN A,.CHLFD		;EOL?
	SETOM EOLF		;YES. REMEMBER THIS
	MOVEI A,.CHNUL		;GET A NULL
	DPB A,BUFPTR		;ZAP POINTER
	SKIPN EOLF		;AT EOL?
	CALL PBLANK		;SKIP TO NEXT FIELD
	 JRST [	SETZM D		;AT THE END. DON'T SET NUMBER
		JRST NODNA2]
	HLRZ A,JFN		;GET FILE JFN
	MOVEI C,12		;GET DECIMAL NUMBER
	NIN			;""
NODNA3:	 JRST [	EMSG <Illegal node number in NODE command>
		JRST PURGE1]	;SKIP REMAINDER OF COMMAND
	MOVE D,B		;SAVE NUMBER
NODNA2:	MOVEI A,.NDSLN		;WANT TO SET NODE NAME
	MOVEI B,C		;ARG BLOCK
	HRROI C,BUFFER		;WHERE NAME IS
	NODE			;DO IT
	 ERJMP NODNA1		;IF FAILED, GO AWAY
	JUMPE D,PURGE1		;IF NO NUMBER, GO ON
	MOVEI A,.NDSNM		;SET NODE NUMBER
	MOVEI B,D		;WHERE THE NUMBER IS
	NODE			;SET IT
	 ERJMP NODNA3		;BAD!!
	JRST PURGE1		;NAME IS SET
; "CHANGE" COMMAND -- SET ACCOUNTING SHIFT TIMES
;
; COMMAND FORMAT:
;	CHANGE (ACCOUNT SHIFT AT) <TIME> (ON) <DAYS-OF-WEEK>

CHANGE:
	SKIPN EOLF		;END-OF-LINE HERE?
	CALL PBLANK		;NO-- SKIP BLANKS BEFORE TIME
	 JRST CMND		;EOL-- IGNORE COMMAND
	HLRZ A,JFN		;GET JFN OF CONFIG FILE
	MOVX T2,IT%NDA!IT%NTZ	;TIME ONLY, NO ZONES
	IDTNC			;GET TIME IN COMMAND
	 JRST PURGE1		;INVALID TIME, SKIP IT
	BKJFN			;BACK OVER TERMINATOR
	 JFCL
	HRRZ P1,D		;REMEMBER THE TIME
	CALL PBLANK
	 JRST CHANG7		;EOL-- ASSUME ALL DAYS OF WEEK

;LOOP FOR ALL DAYS-OF-WEEK SPECIFIED

CHANG2:
	CALL PBLANK		;SKIP TO NEXT NON-BLANK
	 JRST CHANG8		;EOL-- GO FINISH UP
	HRROI A,BUFFER		;WHERE TO STASH IT
	MOVEM A,BUFPTR		;TO THE ARG BLOCK
	MOVEI A,SIZEB		;THE SIZE OF IT
	MOVEM A,COUNT		;TO THE BLOCK
	MOVX A,RD%JFN!RD%BEL!RD%PUN
	MOVEM A,FLAGS		;TO ARG BLOCK
	MOVEI A,TEXT		;THE ARG BLOCK
	TEXTI			;GET DEFINITION
	 JRST FINISH		;FILE IS SCREWED UP
	MOVX A,RD%BTM		;SEE IF PROPERLY TERMINATED
	TDNN A,FLAGS		;IS IT?
	JRST [	CALL SEEEOF	;NO. SEE IF EOF THEN
		 JRST PURGE	;NOT. DO MORE PURGING
		JRST FINISH]	;YES. ALL DONE
	MOVE A,BUFPTR		;GET BYTE POINTER
	LDB C,A			;GET TERMINATING CHARACTER
	CAIN C,.CHLFD		;TERMINATED BY A LINE FEED ?
	BKJFN			;YES, BACK UP TO CARRIAGE RETURN
	 JFCL
	MOVEM A,BUFPTR		;SAVE NEW POINTER TO TERMINATOR
	MOVEI A,.CHNUL		;GET A NULL
	DPB A,BUFPTR		;TERMINATE STRING
	MOVEI A,DOWTAB		;GET DAY-OF-WEEK NAME TABLE
	HRROI B,BUFFER		;GET POINTER TO OPTION REQUESTED
	TBLUK			;FIND OPTION IN TABLE
	TXNN B,TL%EXM!TL%ABR	;FOUND A MATCH ?
	JRST [	SKIPE EOLF	;NO, AT END OF LINE ?
		JRST CMND	;YES, GO ON TO NEXT COMMAND
		JRST PURGE1 ]	;NO, IGNORE REMAINDER OF LINE
	HRLZ A,(A)		;GET DAY-OF-WEEK BITS FROM TABLE TO LH
	TDO P1,A		;SET SELECTED DAYS

	HLRZ A,JFN		;GET JFN
	BKJFN			;BACK UP TO TERMINATOR
	 JFCL
	CALL PBLANK		;SKIP BLANKS AFTER NAME
	 JRST CHANG8		;EOL-- SET SPECIFIED BITS
	HLRZ A,JFN		;GET JFN
	BIN			;GET NON-BLANK CHARACTER
	CAIE B,","		;LEGAL SEPERATOR?
	 JRST PURGE1		;NO-- EAT UP LINE
	JRST CHANG2		;YES-- LOOP FOR NEXT TERMINATOR

CHANG7:
	TXO P1,1B0!1B1!1B2!1B3!1B4!1B5!1B6 ;ASSUME ALL DAYS OF WEEK
CHANG8:
	MOVEI T1,ASCTBZ		;GET SIZE OF TABLE
	HRRZM T1,ASCTBL		;STORE AS MAX TABLE SIZE
	MOVX T1,.USRAS		;READ ACCOUNTING SHIFTS
	MOVEI T2,ASCTBL		; INTO ASCTBL
	USAGE			; . . .
	 ERCAL [JSERR
		RET]
	HLRZ T1,ASCTBL		;GET CURRENT SIZE OF TABLE
	ADDI T1,1		;BUMP BY ONE
	HRLM T1,ASCTBL		;STORE NEW SIZE
	MOVEM P1,ASCTBL(T1)	;STORE NEW ENTRY
	MOVX T1,.USSAS		;SET ACCOUNTING SHIFTS
	USAGE
	 ERCAL [JSERR
		RET]
	JRST CMND		;DONE WITH CHANGE, DO NEXT COMMAND
; ROUTINE TO LOAD A RAM OR VFU

LPTLOD:	SKIPE EOLF		;AT END-OF-COMMAND ?
	JRST CMND		;YES, GO GET NEXT LINE
	CALL PBLANK		;SKIP BLANKS
	 JRST CMND		;PUNT

; READ LPT UNIT NUMBER FROM FILE

	STKVAR <LODUNI,LODFNC,LODJFN,LODLCP,LPTJFN>
	SETZM LODJFN		;INIT THIS TO ZERO
	SETZM LODLCP		;ASSUME PRINTER IS NOT LOWER CASE
	HLRZ A,JFN		;GET JFN OF FILE TO READ
	MOVEI C,^D8		;USE OCTAL FOR UNIT NUMBER
	NIN			;INPUT THE PRINTER UNIT NUMBER
	 JRST PURGE1		;ERROR, IGNORE REMAINDER OF LINE
	MOVEM B,LODUNI		;SAVE LPT UNIT NUMBER

; SEE IF RAM OR VFU IS TO BE LOADED

LPLD20:	CALL PBLANK		;SKIP BLANKS
	 JRST PURGE1		;NO MORE ARGS, IGNORE REST OF LINE
	MOVEI A,SIZEB		;SIZE OF BUFFER
	MOVEM A,COUNT		;TO ARG BLOCK
	HRROI A,BUFFER		;WHERE DATA IS GOING
	MOVEM A,BUFPTR
	MOVX A,RD%JFN!RD%PUN!RD%BEL ;FLAGS
	MOVEM A,FLAGS		;TO THE ARGS
	MOVEI A,TEXT		;ARG BLOCK
	TEXTI			;READ KEY VALUE
	 JRST FINISH		;FILE IS SCREWED UP. GO FINISH
	MOVX A,RD%BTM		;SEE IF FOUND TERMIANTOR
	TDNN A,FLAGS		;DID WE?
	JRST [	CALL SEEEOF	;NO. AT EOF?
		 JRST PURGE	;NO. SKIP REST OF LINE
		JRST FINISH]	;YES. DONE
	LDB A,BUFPTR		;GET TERMINATOR
	SETZM EOLF		;NOT AN EOL
	CAIN A,.CHLFD		;WAS IT A LINE FEED?
	SETOM EOLF		;YES. REMEMBER THIS
	;..
	;..

	MOVEI A,.CHNUL		;GET A NULL CHARACTER
	DPB A,BUFPTR		;TERMINATE KEYWORD WITH A NULL
	MOVEI A,LPTTAB		;GET ADDRESS OF TABLE OF OPTIONS
	HRROI B,BUFFER		;GET POINTER TO TEXT ARGUMENT IN FILE
	TBLUK			;LOOK FOR OPTION SPECIFIED
	TXNN T2,TL%EXM!TL%ABR	;FOUND A MATCH ?
	JRST [	SKIPE EOLF	;NO, HAS END-OF-LINE BEEN SEEN ?
		JRST CMND	;YES, GO DO NEXT COMMAND
		JRST PURGE1 ]	;NO, IGNORE REMAINDER OF LINE
	HRRZ A,(A)		;GET FUNCTION TO PERFORM
	CAIN A,.MOSTS		;SET STATUS FUNCTION (DECLARE LOWER CASE LPT) ?
	JRST [	SETOM LODLCP	;YES, FLAG THAT PRINTER SHOULD BE LOWER CASE
		JRST LPLD20 ]	;GO GET NEXT ARGUMENT
	MOVEM A,LODFNC		;SAVE DESIRED FUNCTION (MTOPR CODE)

; READ FILENAME TO BE LOADED AND GET A JFN FOR IT

	CALL PBLANK		;SKIP ANY BLANKS
	 JRST PURGE1		;NO MORE DATA
	MOVX T1,GJ%SHT!GJ%FNS!GJ%OLD ;EXISTING FILE, PHYSICAL ONLY
	HLLZ T2,JFN		;GET JFN OF FILE TO READ NAME FROM
	HRRI T2,.NULIO		;NO EDITING OUTPUT JFN
	GTJFN			;GET A JFN FOR FILE TO BE LOADED
	 JRST LODERR		;FAILED
	MOVEM A,LODJFN		;SAVE JFN
	HLRZ A,JFN		;GET JFN FOR COMMAND FILE
	BKJFN			;BACK UP ONE CHARACTER
	 JFCL			;IGNORE ERRORS
	BIN			;GET LAST CHARACTER READ
	CAIN B,.CHLFD		;READ AN END-OF-LINE ?
	SETOM EOLF		;YES, INDICATE EOL SEEN
; OPEN THE PRINTER AND VERIFY THAT NO RAM OR VFU IS NOW LOADED

	HRROI A,FILNAM		;GET POINTER TO WHERE DEVICE STRING GOES
	MOVSI B,600007		;GET LPT DEVICE DESIGNATOR
	HRR B,LODUNI		;GET UNIT NUMBER
	DEVST			;GET DEVICE NAME STRING
	 JRST LODERR		;FAILED 
	MOVEI B,":"		;GET TERMINATOR FOR GTJFN
	IDPB B,A		;TERMINATE DEVICE NAME
	SETZ B,
	IDPB B,A		;TIE IT OFF
	MOVX A,GJ%SHT!GJ%FOU	;SHORT CALL, FOR OUTPUT USE
	HRROI B,FILNAM		;GET POINTER TO DEVICE NAME
	GTJFN			;GET A JFN FOR THE PRINTER
	 JRST ENDLPT		;ALREADY ASSIGNED
	MOVEM A,LPTJFN		;SAVE LPT JFN
	MOVX B,<FLD(7,OF%BSZ)+OF%WR> ;OPEN FOR WRITE
	OPENF			;OPEN THE PRINTER
	 JRST [	EXCH A,LPTJFN	;MUST BE OPEN ALREADY, GET BACK JFN
		RLJFN		;RELEASE THE JFN
		 JFCL		;IGNORE ERRORS HERE
		MOVE A,LPTJFN	;GET BACK ERROR CODE
		CAIE A,OPNX9	;ALREADY OPENED BY SOMEONE?
		JRST LODANY	;NO. LOAD ANYWAY
		JRST ENDLPT ]	;GO ON TO NEXT COMMAND
	MOVEI B,.MOPSI		;GET OFF-LINE INTS
	MOVEI C,P1		;SET UP ARGS IN REGISTERS
	MOVEI P1,3		;3 WORDS
	SETZB P2,P3		;CHANNEL 0, NO FLAGS
	MTOPR			;DO IT
	ERJMP .+1		;IN CASE SOMETHING TERRIBLE HAPPENED
	GDSTS			;GET CURRENT STATUS
	TXZ B,MO%LVU!MO%LCP!MO%EOF ;TURN OFF CONDITION BITS
	JUMPN B,INERR		;IF AN ERROR, PUNT IT
	MOVEI B,14		;IF NO ERROR, ALIGN FORMS
	BOUT			;DO IT
	 ERJMP .+1		;IGNORE FAILURE
INERR:	DMOVE B,[-1,,FILNAM
		5*^D28]		;ARGS
	DMOVEM B,MTBLK+1	;TO ARG BLOCK
	MOVE C,LODFNC		;GET FUNCTION TO PERFORM
	MOVX B,.MORTR		;GET READ-RAM FUNCTION CODE
	CAIE C,.MOLTR		;ARE WE LOADING THE RAM ?
	MOVX B,.MORVF		;NO, GET READ-VFU FUNTION
	MOVEI C,MTBLK		;GET ADDRESS OF BLOCK
	SETZM FILNAM		;MAKE IT LOOK AS IF IT IS NOT LOADED
	MTOPR			;READ FILENAME ALREADY LOADED
	 ERJMP .+1		;UNEXPECTED ERROR. LOAD RAM ANYWAY
	MOVE A,LPTJFN		;GET JFN FOR PRINTER
	CLOSF			;CLOSE THE FILE
FCLOSE:	 JRST [	MOVE A,LPTJFN	;FAILED. GET JFN AGAIN
		TXO A,CZ%ABT	;DO IT NOW WITH ABORT
		CLOSF		;DO IT
		 JFCL		;HAS TO WORK
		JRST .+1]	;ALL DONE
	LDB A,[POINT 7,FILNAM,6] ;GET FIRST BYTE RETURNED
	JUMPN A,ENDLPT		;IF NOT-NULL, GO ON TO NEXT COMMAND

; GET JFN, FUNCTION, AND UNIT # AND LOAD THE RAM OR VFU

LODANY:	MOVE B,LODFNC		;GET FUNCTION TO BE PERFORMED
	MOVE A,LODJFN
	MOVE C,LODUNI		;GET UNIT NUMBER OF PRINTER
	SKIPE LODLCP		;IS THIS PRINTER LOWER CASE ?
	TXO B,MO%LCP		;YES, MARK THAT PRINTER IS LOWER CASE
	LPINI			;LOAD RAM OR VFU
	 ERJMP LODERR		;ERROR - TELL SOMEONE

; HERE TO FINISH UP AND GO DO NEXT COMMAND

ENDLPT:	MOVE P,[IOWD 20,PDL]	;RESET STACK
	SKIPE EOLF		;AT END OF COMMAND YET ?
	JRST CMND		;YES, GO DO NEXT COMMAND
	JRST PURGE1		;NO, IGNORE REST OF LINE
; HERE ON AN ERROR LOADING THE RAM OR VFU

LODERR:	TMSG <
? SETSPD: Could not load the >
	HRROI A,[ASCIZ/VFU/]	;GET TEXT
	MOVE B,LODFNC		;GET FUNCTION BEING PERFORMED
	CAIE B,.MOLVF		;ARE WE LOADING THE VFU ?
	HRROI A,[ASCIZ/RAM/]	;NO, GET RAM TEXT
	PSOUT			;TELL USER WHAT WE ARE LOADING
	TMSG < for PLPT>	;GET UNIT NAME
	MOVEI A,.PRIOU		;GET PRIMARY OUTPUT JFN
	MOVE B,LODUNI		;GET UNIT NUMBER
	MOVEI C,^D8		;GET OCTAL RADIX
	NOUT			;OUTPUT THE UNIT NUMBER
	 JFCL			;IGNORE ERRORS HERE
	TMSG <
>				;END OF MESSAGE
	SKIPE A,LODJFN		;GET JFN FOR FILE TO HAVE BEEN LOADED
	CLOSF			;MAKE SURE IT IS REALLY CLOSED AND RELEASED
	 JFCL			;PROBABLY CLOSED BY MONITOR ALREADY ANYHOW
	JRST ENDLPT		;GO FINISH UP

;LPT OFF-LINE INTERRUPT ROUTINE

LPTINT:	MOVEI A,@FCLOSE		;REDIRECT CODE TO CLOSE AND ABORT DEVICE
	MOVEM A,ADDR		;ZAP THE OLD PC WORD
	DEBRK			;AND GO FINISH UP
;ROUTINES FOR SCHEDULER CONTROLS

;SET BIAS-CONTROL VALUE

BIAS:	SKIPN EOLF		;AT EOL ALREADY?
	CALL PBLANK		;GET LINE
	 JRST CMND		;NO MORE IN LINE
	HLRZ A,JFN		;GET JFN
	MOVEI C,^D10		;PARSE IN DECIMAL
	NIN			;GET VALUE
	 ERJMP [JSERR		;BAD
		JRST PURGE1]	;GIVE UP
	MOVE T4,T2		;COPY NUMBER
	MOVEI T1,.SKSBC		;SET BIAS CONTROL
	MOVEI T2,T3		;ARG BLOCK
	MOVEI T3,2		;LENGTH OF BLOCK
	SKED%			;SET IT
	 ERJMP [EMSG <Invalid value for bias control setting>
		JRST PURGE1]
	JRST PURGE1		;ALL SET

;SET BATCH BACKGROUND

BATBGD:	MOVEI T1,.SKBBG		;GET PROPER FUNCTION
	SETZM T2		;NO ARGS
	SKED%			;SET IT
	ERCAL [	EMSG <Could not set BATCH-BACKGROUND>
		RET]
	JRST PURGE1		;AND DONE
;SCHEDULER CONTROLS COMMANDS CONTINUED

;CREATE A CLASS. WILL DO NOTHING IF CLASS SCHEDULER NOW ON.

CREATE:	MOVX T1,.SKRCV		;READ CLASS PARAMETERS
	MOVEI T2,T3
	MOVEI T3,2
	SKED%			;READ OUT CLASS PARAMETERS
	ERJMP [	JSERR
		JRST PURGE1]	;ERROR OF SOME SORT
	TXNN T4,SK%STP		;NOW ON?
	JRST PURGE1		;YES. GO AWAY QUIETLY THEN

;CLASS SCHEDULING NOW OFF. SET THE CLASS SHARE

	SKIPE EOLF		;AT THE END OF THE COMMAND?
	JRST CMND		;YES
	CALL PBLANK		;SKIP BLANKS
	 JRST CMND		;NO MORE IN THE COMMAND

	HLRZ A,JFN		;GET JFN OF FILE
	MOVEI C,^D10		;IN DECIMAL
	NIN			;READ THE CLASS
	 JRST [	JSERR
		JRST PURGE1]	;ERROR
	MOVEM T2,CLSBLK+1	;SAVE CLASS
	CALL PBLANK		;GET TO PERCENTAGE
	 JRST [	EMSG <Could not set class share; percentage not given>
		JRST CMND]	;DONE
	HLRZ A,JFN		;GET JFN AGAIN
	FLIN			;GET FLOATING-POINT NUMBER
	 ERJMP [EMSG <Could not CREATE class. Floating point number invalid>
		JRST PURGE1]	;AND GIVE UP
	MOVEM T2,CLSBLK+2	;SAVE %
	MOVEI T2,CLSBLK
	MOVEI T1,.SKSCS		;PROPER FUNCTION
	SKED%			;DO IT
	ERJMP [	TMSG <
? SETSPD: Could not CREATE class: >
		JSERR
		JRST PURGE1]	;DONE
	JRST PURGE1		;AND DONE
;MORE SCHEDULER COMMANDS

;ENABLE CLASS-SCHEDULING. GOT TO HERE FROM ENABLE COMMAND

ECSKED:	ILDB T1,BUFPTR		;CHECK FOR NO LINE
	CAIN T1,12
	JRST ECERR1		;NO ARGUMENTS
	MOVEI T1,.SKRCV		;READ CLASS VALUES
	MOVEI T2,T3
	MOVEI T3,2
	SKED%			;READ VALUES
	ERJMP PURGE1
	TXNN T4,SK%STP		;NOW ON?
	JRST PURGE1		;YES. SKIP IT THEN

;CLASS SCHEDULER NOW OFF.

	CALL SETNXT		;SET UP NEXT COMMAND
	 JRST [	JUMPE A,PURGE	;IF NOT EOF, DONE
		JRST FINISH]	;SCREWED UP FILE
	MOVEI A,SKDOPT		;GET TABLE ADDRESS
	HRROI B,BUFFER		;THE COMMAND
	TBLUK			;LOOK IT UP
	TXNN B,TL%EXM!TL%ABR	;GOT A MATCH?
ECERR1:	JRST [	EMSG <Invalid keyword for scheduling type>
		JRST PURGE1]	;DONE
	HRRZ A,0(A)		;GET VALUE
	MOVX T4,SK%ACT		;ASSUME BY ACCOUNT
	SKIPE A			;IS IT?
	TXZ T4,SK%ACT		;NO
	CALL SETNXT		;GET NEXT KEYWORD
	 JRST SETNOW		;NO MORE. DO COMMAND THEN
	MOVEI A,SKDOP0		;NEXT SET
	HRROI B,BUFFER
	TBLUK			;LOOK IT UP
	TXNN B,TL%EXM!TL%ABR	;GOT A MATCH?
	JRST [	EMSG <Invalid windfall option>
		JRST PURGE1]
	HRRZ A,0(A)		;GET VALUE
	SKIPE A			;WANT TO WITHHOLD?
	TXO T4,SK%WDF		;YES
SETNOW:	MOVEI T1,.SKICS
	MOVEI T2,T3
	MOVEI T3,2		;COUNT
	SKED%			;START UP CLASS SCHEDULER
	ERJMP [JSERR		;ERROR
		JRST PURGE1]
	JRST PURGE1		;DONE
;SCHEDULER CONTROL ROUTINES CONTINUED

;LOCAL ROUTINE TO GET NEXT KEYWORD. PRESERVES T4

SETNXT:	SKIPN EOLF		;NOW AT THE END
	CALL PBLANK		;SKIP BLANKS
SETNX0:	 JRST [	SETZM A
		RET]
	HRROI A,BUFFER		;BUFFER ADDRESS
	MOVEM A,BUFPTR		;SAVE IT
	MOVEI A,SIZEB		;THE SIZE
	MOVEM A,COUNT
	MOVX A,RD%JFN!RD%PUN!RD%BEL
	MOVEM A,FLAGS
	MOVEI A,TEXT		;ARG BLOCK
	TEXTI			;GET KEYWORD
SETNX1:	 JRST [	SETOM A		;BAD FILE
		RET]
	MOVX A,RD%BTM		;SEE IF GOOD BREAK
	TDNN A,FLAGS		;IS IT?
	JRST [	CALL SEEEOF	;EOF?
		 JRST SETNX0	;NO
		JRST SETNX1]	;YES
	MOVE A,BUFPTR		;GET FINAL POINTER
	LDB C,A			;GET TERMINATOR
	CAIE C,.CHLFD		;LF?
	JRST SETNX2		;NO
	BKJFN
	 JFCL
	MOVEM A,BUFPTR		;FLUSH IT
SETNX2:	MOVEI A,.CHNUL		;GET A NULL
	DPB A,BUFPTR		;ZAP TERMINTOR
	RETSKP			;AND DONE
;MORE CLASS SCHEDULING COMMANDS

;SET BATCH CLASS

BCHCLS:	SKIPN EOLF		;AT THE END YET?
	CALL PBLANK		;SKIP OVER BLANKS
	 JRST CMND		;NO MORE ARGS
	HLRZ A,JFN		;GET FILE JFN
	MOVEI T3,^D10		;READ IN A NUMBER
	NIN			;DO IT
	 ERJMP [JSERR		;ERROR OF SOME SORT
		JRST PURGE1]	;AND DONE
	MOVE T4,T2		;COPY VALUE
	MOVEI T3,2		;ARG BLOCK
	MOVEI T1,.SKBCS		;SET BATCH CLASS
	MOVEI T2,T3		;POINT TO ARG BLOCK
	SKED%			;DO IT
	 ERJMP [EMSG <Could not set BATCH-CLASS>
		JSERR
		JRST PURGE1]	;ERROR
	JRST PURGE1		;AND DONE
;ENTRY POINT FOR PROCESSING CRASH DUMPS

START3:	MOVE P,[IOWD PDLEN,PDL]	;SET UP PUSH DOWN LIST
	CALL INIT		;SET UP PSI, CAPABILITIES, ETC.
	CALL QUEBLK
	HALTF


; QUEBLK - COPY DUMP.EXE TO DUMP.CPY AND LOG ANY UNLOGGED SYSERR
;	   BLOCKS THAT WERE FOUND IN THE DUMP FILE
; RETURNS +1: ALWAYS

QUEBLK:	MOVE T1,[SIXBIT /DBUGSW/] ;CHECK ON STATE OF SYSTEM
	SYSGT			;READ DBUGSW
	SKIPE T2		;FOUND IT?
	CAIGE T1,2		;YES. IS IT STAND-ALONE?
	SKIPA			;NO. DO THE DUMP
	RET			;YES. DON'T DO ANYTHING
	TRVAR <QUEJFN,QUEFRK,QUEPGS>
	SETZ T1,		;GET A FORK TO LOAD DUMP.EXE INTO
	CFORK
	 RET			;COULD NOT GET A FORK, SO JUST EXIT
	MOVEM T1,QUEFRK		;SAVE FORK HANDLE
	MOVX T1,GJ%OLD!GJ%SHT	;GET A JFN FOR <SYSTEM>DUMP.EXE
	HRROI T2,[ASCIZ/PS:<SYSTEM>DUMP.EXE/]
	GTJFN
	 JRST QUEKFK		;NO DUMP FILE, NOTHING TO DO
	MOVEM T1,QUEJFN		;SAVE JFN
	MOVE T2,[440000,,OF%RD!OF%WR!OF%THW]
	OPENF			;OPEN THE FILE FOR READ/WRITE THAWED
	 JRST [	MOVE T1,QUEJFN	;FAILED, CLEAN UP
		RLJFN
		 JFCL
		JRST QUEKFK]
	HRLI T1,.FBPRT		;SET THE PROTECTION OF DUMP.EXE TO 770000
	MOVEI T2,-1		;RIGHT HALF PROTECTION BITS
	MOVEI T3,770000		;MUCHO PROTECTION
	CHFDB			;THIS FILE MUST BE PROTECTED FOR SECURITY
	 ERJMP .+1
	HRLZ T1,QUEJFN		;NOW MAP IN DIR PAGE
	MOVE T2,[.FHSLF,,PG0PG]
	MOVX T3,PM%RD!PM%WT	;READ AND WRITE
	PMAP
	HRRZ T1,PG0ADR		;GET LENGTH OF DIRECTORY BLOCK
	HRRZ T2,PG0ADR-2(T1)	;GET STARTING FILE PAGE # OF LAST GROUP
	HLRZ T3,PG0ADR-1(T1)	;GET HALFWORD CONTAINING REPEAT COUNT
	LSH T3,-9		;RIGHT JUSTIFY REPEAT COUNT
	ADDI T2,1(T3)		;COMPUTE # OF FILE PAGES TO MAP
	MOVEM T2,QUEPGS		;SAVE NUMBER FOR CPYDMP
	HRRZ T1,PG0ADR		;GET LENGTH OF HEADER BLOCK OF DIR
	HLRZ T2,PG0ADR(T1)	;GET CODE OF NEXT BLOCK
	CAIE T2,1775		;ENTRY VECTOR?
	JRST QUEDON		;NO, GIVE UP
	HRRZ T2,PG0ADR(T1)	;GET LENGTH
	CAIGE T2,4		;CORRECT LENGTH?
	JRST QUEDON		;NO, GIVE UP
	SKIPE PG0ADR+3(T1)	;ALREADY LOOKED AT THIS DUMP?
	JRST QUEDON		;YES, GIVE UP
	SETOM PG0ADR+3(T1)	;NO, MARK THAT WE HAVE NOW SEEN IT
	SETO T1,		;AND UNMAP THE PAGE
	MOVE T2,[.FHSLF,,PG0PG]
	SETZ T3,
	PMAP
	HRRZ T1,QUEJFN		;GET JFN OF ORIGINAL DUMP FILE
	MOVE T2,QUEPGS		;GET HIGHEST PAGE NUMBER TO COPY
	CALL CPYDMP		;GO COPY THE DUMP FILE
	HRRZ T1,QUEJFN		;CLOSE THE JFN
	TXO T1,1B0		;BUT KEEP THE JFN
	CLOSF
	 JFCL
	HRLZ T1,QUEFRK		;NOW MAP DUMP.EXE INTO FORK
	HRR T1,QUEJFN
	GET
	SETZM QUEJFN		;JFN HAS BEEN RELEASED
;THE COPY IS EITHER DONE OR HAS BEEN DELETED BECAUSE SYSTEM IS
;STAND-ALONE. PROCEED WITH QUEUEING UP THE SYSERR BLOCKS

DMPDON:	HRLZ T1,QUEFRK		;NOW MAP IN PAGE 0
	MOVE T2,[.FHSLF,,PG0PG]
	MOVX T3,PM%RD
	PMAP
	SKIPG P1,PG0ADR+SEBQOU	;IS THERE ANYTHING IN THE QUEUE?
	JRST QUEDN1		;NO, GO MARK THAT THIS DUMP IS DN1E
QUELOP:	MOVEI P2,0(P1)		;GET ADDRESS OF NEXT BLOCK
	ANDI P2,777		;GET LOW ORDER BITS ONLY
	MOVEI T1,0(P1)		;NOW MAP IN THE PAGE WITH THE BLOCK
	LSH T1,-PGSFT
	HRL T1,QUEFRK
	MOVE T2,[.FHSLF,,TMPPG]
	MOVX T3,PM%RD+PM%CNT+2	;GET 2 PAGES IN CASE BLK CROSSES PAGE
	PMAP
	MOVEI T1,TMPADR(P2)	;GET ADDRESS OF START OF BLOCK
	LOAD T2,SEBSIZ,(T1)	;GET SIZE OF BLOCK
	ADDI T1,SEBHED		;DONT STORE HEADER
	SUBI T2,SEBHED
	SYERR			;PUT THIS BLOCK INTO ERROR LOG
	 ERJMP .+1		;IGNORE ERRORS
	HRRZ P1,TMPADR(P2)	;GET ADDRESS OF NEXT BLOCK
	JUMPN P1,QUELOP		;IF ONE THERE, GO PROCESS IT
QUEDN1:	MOVE T1,[SIXBIT /APRID/] ;GET APRID OF PROCESSOR
	SYSGT			;TO DETERMINE KS10
	CAIG T1,^D4096		;IF GT 4096. THEN KS12
	JRST QUEDON		;NO -- DON'T NEED HSB
	MOVEI T1,SEC%HS		;SET UP LOGGING CODE
	STOR T1,SEBERC
	DMOVE T1,PG0ADR		;GET FIRST TWO WORDS OF DUMP (PHYSICAL 0,1
	DMOVEM T1,HS%COD+4+HSBBUF	;STORE IN BUFFER
	MOVE T1,[-HS%HSZ,,HS%HDZ]	;POINTER TO BUFFER
	MOVEM T1,HS%PTR+4+HSBBUF	;BUFFER 
	MOVE T1,[PG0ADR+HSBADR,,HSBBUF+4+HS%HDZ] ;MOVE TO BUFFER
	BLT T1,HSBBUF+4+HS%HSZ	;BLT LOW CORE DATA
	MOVEI T1,HSBBUF		;SYSERR OUTPUT BUFFER
	MOVEI T2,HS%LEN
	SYERR			;OUTPUT ERROR
	 ERJMP .+1		;IGNORE ERRORS
QUEDON:	SETO T1,		;FIRST UNMAP PAGES
	MOVE T2,[.FHSLF,,PG0PG]	;DO PAGE 0
	SETZ T3,
	PMAP
	MOVE T2,[.FHSLF,,TMPPG]	;AND TEMP PAGES
	MOVX T3,PM%CNT+2
	PMAP
	HRRZ T1,QUEJFN		;SEE IF THERE IS A JFN STILL AROUND
	JUMPE T1,QUEKFK
	CLOSF			;YES, CLOSE IT
	 JFCL
QUEKFK:	MOVE T1,QUEFRK		;NOW KILL THE FORK
	KFORK
	RET			;ALL DONE
;CPYDMP - ROUTINE TO COPY <SYSTEM>DUMP.EXE TO <SYSTEM>DUMP.CPY
;
;ACCEPTS IN T1/	JFN OF ORIGINAL DUMP FILE
;	    T2/	# OF FILE PAGES TO COPY
;		CALL CPYDMP
;RETURNS: +1 ALWAYS



CPYDMP:	STKVAR <DMPJFN,DMPCNT,CPYJFN,CPYSIZ>
	MOVEM T1,DMPJFN		;SAVE JFN OF ORIGINAL DUMP FILE
	MOVEM T2,DMPCNT		;SAVE # OF FILE PAGES TO COPY
	IMULI T2,1000		;COMPUTE # OF WORDS TO BE COPIED
	SUBI T2,1		;COMPUTE # OF LAST WORD IN COPY FILE
	MOVEM T2,CPYSIZ		;SAVE # OF WORDS IN FILE
	MOVX T1,GJ%FOU!GJ%SHT	;GET A JFN TO MAKE THE COPY
	HRROI T2,[ASCIZ /PS:<SYSTEM>DUMP.CPY;P770000/]
	GTJFN			;GET IT
DMPERR:	 JRST [	HRROI T1,[ASCIZ /
? SETSPD: Failed to copy dump file because:
/]
		PSOUT
		MOVEI T1,.PRIOU	;THE DESTINATION
		HRLOI T2,.FHSLF	;US
		ERSTR		;OUTPUT THE ERROR
		 JFCL
		 JFCL
		CALL UMPPGS	;UNMAP DUMP PAGES
		RET]		;RETURN
	MOVEM T1,CPYJFN		;SAVE JFN OF DUMP.CPY
	MOVE T2,[440000,,OF%RD+OF%WR]
	OPENF			;OPEN THE COPY FILE
	 JRST DMPERR		;FAILED
	HRLI T1,.FBBYV		;CHANGE PROPER WORD
	MOVX T2,FB%RET		;SET THE RETENTION COUNT
	SETZ T3,		; TO INFINITY
	CHFDB			;DO IT
	ERJMP .+1		;IGNORE ANY ERRORS
	HRROI T1,[ASCIZ /
COPYING PREVIOUS SYSTEM DUMP TO:
/]
	PSOUT
	MOVEI T1,.PRIOU
	MOVE T2,CPYJFN		;GET JFN OF DUMP.CPY FILE
	SETZ T3,		;USE DEFAULT
	JFNS			;OUTPUT THE THE FILE NAME
	; ..
	; ..

; SET UP TO COPY THE FILE

	SETZM T4		;START WITH FILE PAGE 0
CPYD10:	MOVE T1,DMPCNT		;GET # OF PAGES TO COPY
	JUMPLE T1,CPYD20	;IF DONE, GO UNMAP THE PAGES
	SUBI T1,CPYPGS		;COMPUTE # OF PAGES LEFT TO COPY
	MOVEM T1,DMPCNT		;SAVE NEW # OF PAGES TO COPY
	HRL T1,DMPJFN		;GET JFN OF ORIGINAL DUMP FILE
	HRR T1,T4		;GET FILE PAGE NUMBER
	MOVE T2,[.FHSLF,,DMPPG]	;THIS FORK, FIRST PAGE TO MAP DUMP FILE
	MOVEI T3,CPYPGS		;GET # OF PAGES TO MAP
	SKIPGE DMPCNT		;NEED TO MAP LESS THAN THIS MANY ?
	ADD T3,DMPCNT		;YES, COMPUTE # REMAINING TO BE MAPPED
	TXO T3,PM%RD+PM%WR+PM%PLD+PM%CNT
	PMAP			;MAP THE PAGES FROM THE ORIGINAL FILE
	 ERJMP DMPERR		;JUST IN CASE
	HRL T1,CPYJFN		;GET JFN OF COPY FILE
	HRR T1,T4		;GET FILE PAGE NUMBER
	MOVE T2,[.FHSLF,,CPYPG]	;THIS FORK, FIRST PAGE OF COPY FILE DATA
	TXZ T3,PM%PLD		;NO PRE-LOADING
	PMAP			;MAP THE COPY FILE
	 ERJMP DMPERR		;JUST IN CASE
	MOVE T1,[DMPADR,,CPYADR] ;SET UP TO COPY DATA
	BLT T1,CPYADR+CPYWDS-1	;COPY DATA
	ERJMP DMPERR		;IN CASE DISK IS FULL.
	ADDI T4,CPYPGS		;COMPUTE ADDRESS OF NEXT FILE PAGE
	JRST CPYD10		;LOOP OVER ALL PAGES TO COPY

; HERE WHEN COPY IS COMPLETE

CPYD20:	CALL UMPPGS		;UNMAP DUMP PAGES
	HRRZ T1,CPYJFN		;GET JFN OF NEW FILE
	HRLI T1,.FBSIZ		;GET OFFSET TO EOF POINTER
	SETOM T2		;CHANGE ALL BITS IN THE WORD
	MOVE T3,CPYSIZ		;GET # OF LAST WORD IN FILE
	CHFDB			;SET THE EOF POINTER
	HRRZ T1,CPYJFN		;GET JFN OF COPY FILE
	CLOSF			;CLOSE NEW FILE
	 JRST DMPERR		;FAILED, REPORT ERROR
	RET			;RETURN
;COPY DUMP CONTINUED....

;ROUTINE TO UNMAP DUMP PAGES ON NORMAL COMPLETION OR ERROR

UMPPGS:	SETOM T1		;UNMAP THE PAGES
	MOVE T2,[.FHSLF,,DMPPG]	;PAGES MAPPED TO ORIGINAL FILE
	MOVE T3,[PM%CNT+CPYPGS]	;NUMBER OF PAGES TO UNMAP
	PMAP			;UNMAP THE PAGES
	MOVE T2,[.FHSLF,,CPYPG]	;PAGES MAPPED TO COPY FILE
	PMAP			;UNMAP THE PAGES
	RET			;AND DONE
; CACHE REFILL ALGORITHM RAM LOADING INSTRUCTIONS
; *** CURRENTLY PERFORMS NO FUNCTION ***

REFILL:	JFCL			;TURN ON USER IOT
	 RET			;FAILED
	BLKO APR,0
	BLKO APR,100004
	BLKO APR,200010
	BLKO APR,300014
	BLKO APR,400020
	BLKO APR,500024
	BLKO APR,600030
	BLKO APR,700034
	BLKO APR,300040
	BLKO APR,100044
	BLKO APR,200050
	BLKO APR,300054
	BLKO APR,200060
	BLKO APR,100064
	BLKO APR,200070
	BLKO APR,300074
	BLKO APR,700100
	BLKO APR,100104
	BLKO APR,200110
	BLKO APR,700114
	BLKO APR,100120
	BLKO APR,100124
	BLKO APR,200130
	BLKO APR,700134
	BLKO APR,600140
	BLKO APR,500144
	BLKO APR,600150
	BLKO APR,700154
	BLKO APR,500160
	BLKO APR,500164
	BLKO APR,600170
	BLKO APR,700174
	BLKO APR,000200
	BLKO APR,300204
	BLKO APR,200210
	BLKO APR,300214
	BLKO APR,000220
	BLKO APR,200224
	BLKO APR,200230
	BLKO APR,300234
	BLKO APR,000240
	BLKO APR,100244
	BLKO APR,200250
	BLKO APR,300254
	BLKO APR,400260
	BLKO APR,500264
	BLKO APR,600270
	BLKO APR,700274
	BLKO APR,000300
	BLKO APR,700304
	BLKO APR,700310
	BLKO APR,700314
	BLKO APR,000320
	BLKO APR,000324
	BLKO APR,000330
	BLKO APR,700334
	BLKO APR,400340
	BLKO APR,600344
	BLKO APR,600350
	BLKO APR,600354
	BLKO APR,400360
	BLKO APR,400364
	BLKO APR,600370
	BLKO APR,400374
	BLKO APR,300400
	BLKO APR,100404
	BLKO APR,300410
	BLKO APR,300414
	BLKO APR,100420
	BLKO APR,100424
	BLKO APR,100430
	BLKO APR,300434
	BLKO APR,000440
	BLKO APR,700444
	BLKO APR,700450
	BLKO APR,700454
	BLKO APR,000460
	BLKO APR,000464
	BLKO APR,000470
	BLKO APR,700474
	BLKO APR,000500
	BLKO APR,100504
	BLKO APR,200510
	BLKO APR,300514
	BLKO APR,400520
	BLKO APR,500524
	BLKO APR,600530
	BLKO APR,700534
	BLKO APR,400540
	BLKO APR,500544
	BLKO APR,500550
	BLKO APR,700554
	BLKO APR,400560
	BLKO APR,500564
	BLKO APR,400570
	BLKO APR,700574
	BLKO APR,000600
	BLKO APR,100604
	BLKO APR,200610
	BLKO APR,200614
	BLKO APR,000620
	BLKO APR,100624
	BLKO APR,200630
	BLKO APR,100634
	BLKO APR,000640
	BLKO APR,500644
	BLKO APR,600650
	BLKO APR,600654
	BLKO APR,000660
	BLKO APR,500664
	BLKO APR,600670
	BLKO APR,000674
	BLKO APR,400700
	BLKO APR,500704
	BLKO APR,600710
	BLKO APR,500714
	BLKO APR,400720
	BLKO APR,500724
	BLKO APR,600730
	BLKO APR,400734
	BLKO APR,000740
	BLKO APR,100744
	BLKO APR,200750
	BLKO APR,300754
	BLKO APR,400760
	BLKO APR,500764
	BLKO APR,600770
	BLKO APR,700774
	RET			;AND DONE
	END <ENVLEN,,ENTVEC>