Google
 

Trailing-Edge - PDP-10 Archives - BB-H138A-BM - 3a-sources/setspd.mac
There are 33 other files named setspd.mac in the archive. Click here to see a list.
;<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
;<3A.UTILITIES>SETSPD.MAC.10,  7-Apr-78 00:41:18, 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
;<3A.UTILITIES>SETSPD.MAC.6, 28-Feb-78 15:45:42, EDIT BY MILLER
;FIX NODNAM TO CHECK FOR EOL
;<3A.UTILITIES>SETSPD.MAC.5, 24-Feb-78 09:54:01, EDIT BY MILLER
;<3A.UTILITIES>SETSPD.MAC.4, 24-Feb-78 09:45:50, EDIT BY MILLER
;<3A.UTILITIES>SETSPD.MAC.3, 24-Feb-78 09:45:11, EDIT BY MILLER
;ADD NODE NUMBER TO NODE COMMAND
;<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
;<3-UTILITIES>SETSPD.MAC.16,  8-Nov-77 10:51:06, EDIT BY KIRSCHEN
;MORE COPYRIGHT UPDATING...
;<3-UTILITIES>SETSPD.MAC.15,  3-Nov-77 09:07:50, EDIT BY KIRSCHEN
;RECOVER IF BOUT TO ALIGN LPT FORMS FAILS
;<3-UTILITIES>SETSPD.MAC.14, 26-Oct-77 11:48:16, EDIT BY KIRSCHEN
;UPDATE COPYRIGHT FOR RELEASE 3
;<3-UTILITIES>SETSPD.MAC.13, 12-Oct-77 18:57:55, EDIT BY HURLEY
;ADDED THE COMMANDS TO ENABLE/DISABLE FULL LATENCY OPTIMIZATION
;<3-UTILITIES>SETSPD.MAC.12, 16-Aug-77 16:17:50, EDIT BY HURLEY
;<3-UTILITIES>SETSPD.MAC.11, 16-Aug-77 11:17:22, EDIT BY HURLEY
;ADD THE TERMINAL AUTO COMMAND
;<3-UTILITIES>SETSPD.MAC.10, 11-Aug-77 17:05:15, EDIT BY HURLEY
;MAKE SETSPD LOOKUP X-CONFIG WHERE X IS THE RELEASE NUMBER
;<3-UTILITIES>SETSPD.MAC.9, 11-Aug-77 09:21:45, EDIT BY HURLEY
;MAKE SETSPD LOOK ON SYSTEM: FOR CONFIG.CMD
;<3-UTILITIES>SETSPD.MAC.8,  3-Aug-77 00:05:43, EDIT BY CROSSLAND
;RESTORE HOST COMMAND
;<3-UTILITIES>SETSPD.MAC.7, 27-Jul-77 11:55:15, EDIT BY HURLEY
;<3-UTILITIES>SETSPD.MAC.6, 26-Jun-77 12:41:01, EDIT BY MILLER
;UNMAP DUMP PAGES AFTER ERROR
;<3-UTILITIES>SETSPD.MAC.5, 23-Jun-77 13:20:46, Edit by MACK
;TCO 1822 - DISABLE/ENABLE ACCOUNT VALIDATION
;<3-UTILITIES>SETSPD.MAC.4, 23-Jun-77 12:27:01, EDIT BY MILLER
;TCO 1686 AGGAIN. ADD ERJMP'S
;<3-UTILITIES>SETSPD.MAC.3, 23-Jun-77 11:35:38, EDIT BY KIRSCHEN
;TCO 1716 - ADD ENABLE/DISABLE DIRECTORY-PARAMETER-SETTING COMMANDS
;	ALSO REMOVE STRUCTURE COMMAND, NO LONGER APPLICABLE
;<3-UTILITIES>SETSPD.MAC.2, 25-May-77 13:53:35, EDIT BY KIRSCHEN
;TCO 1807 - ADD NOBELL OPTION TO THE TERMINAL COMMAND (SEE ALSO TCO 1802)
;<3-UTILITIES>SETSPD.MAC.1, 17-Jan-77 11:55:09, Edit by LCAMPBELL
;TCO 1714 - Fix LODANY to type error message if LPINI fails.
;<2-UTILITIES>SETSPD.MAC.14, 27-Dec-76 17:07:56, EDIT BY HURLEY
;<2-UTILITIES>SETSPD.MAC.13, 22-Dec-76 13:42:19, EDIT BY HURLEY
;<2-UTILITIES>SETSPD.MAC.12, 22-Dec-76 10:17:55, EDIT BY KIRSCHEN
;<2-UTILITIES>SETSPD.MAC.11, 20-Dec-76 12:19:25, EDIT BY KIRSCHEN
;TCO 1686 - MAKE SETSPD COPY DUMPS GREATER THAN 256 K
;<2-UTILITIES>SETSPD.MAC.10, 23-Nov-76 10:31:18, Edit by MACK
;<2-UTILITIES>SETSPD.MAC.9, 19-Nov-76 09:33:17, Edit by MACK
;TCO 1666 - MORE TIMEZONE EDITS
;<2-UTILITIES>SETSPD.MAC.8, 18-Nov-76 20:26:22, EDIT BY MILLER
;DISABLE CACHE REFILL CODE
;<2-UTILITIES>SETSPD.MAC.7, 16-Nov-76 11:32:27, Edit by MACK
;TCO 1666 - ADDED FUNCTIONS TO SET TIME ZONE AND ARPANET SITE ADDRESS
;<2-UTILITIES>SETSPD.MAC.4,  4-Nov-76 15:08:10, EDIT BY HURLEY
;TCO 1604- ADD CODE TO RESET TTY NO MSG BITS IN F.E.
;<2-UTILITIES>SETSPD.MAC.3, 25-Oct-76 17:27:57, EDIT BY HURLEY
;TAKE OUT CALL TO QUEBLK DURING NORMAL RUNNING OF SETSPD
;<2-UTILITIES>SETSPD.MAC.2, 21-Oct-76 14:56:33, Edit by MACK
;TCO 1615 - ADD ALTERNATE SETSPD ENTRY, START1:
;<2-UTILITIES>SETSPD.MAC.1,  2-Aug-76 14:12:05, EDIT BY KIRSCHEN
;TCO 1468 - ADD STRUCTURE COMMAND
;<1B-UTILITIES>SETSPD.MAC.8,  9-Jul-76 09:40:18, EDIT BY HURLEY
;INCREASED VERSION NUMBER FOR RELEASE 1B
;<1B-UTILITIES>SETSPD.MAC.7, 23-Jun-76 18:33:29, EDIT BY HURLEY
;<1B-UTILITIES>SETSPD.MAC.6, 16-Jun-76 16:26:47, EDIT BY MILLER
;TCO 1437. ADD SETSPD: TO ALL ERROR MESSAGES
;<1B-UTILITIES>SETSPD.MAC.5, 16-Jun-76 16:20:16, EDIT BY MILLER
;<1B-UTILITIES>SETSPD.MAC.4, 16-Jun-76 16:17:15, EDIT BY MILLER
;TCO 1435. IMPROVE ERROR MESSAGE FROM BAD DEFINE COMMAND
;<1B-UTILITIES>SETSPD.MAC.3, 16-Jun-76 16:04:45, EDIT BY MILLER
;TCO 1433. IMPROVE ERROR MESSAGE FOR RAM OR VFU LOAD ERROR
;<1B-UTILITIES>SETSPD.MAC.2, 23-MAY-76 10:58:55, EDIT BY HALL
;<1B-UTILITIES>SETSPD.MAC.1, 22-MAY-76 11:40:05, EDIT BY MILLER
;<1A-UTILITIES>SETSPD.MAC.69,  6-MAY-76 11:03:02, EDIT BY HURLEY
;<1A-UTILITIES>SETSPD.MAC.68,  6-MAY-76 10:45:25, EDIT BY HURLEY
;<1A-UTILITIES>SETSPD.MAC.65, 12-APR-76 10:46:11, EDIT BY MILLER
;TCO 1167 AGAIN. FIX OFF-LINE INTERRUPT
;<1A-UTILITIES>SETSPD.MAC.64,  8-APR-76 11:51:17, EDIT BY HURLEY
;TCO 1244 - ADD .DIRECT .XTABM FOR MACRO 50 ASSEMBLIES
;<1A-UTILITIES>SETSPD.MAC.63,  1-APR-76 18:37:26, EDIT BY HURLEY
;TCO # 1205 - SET PROTECTION OF <SYSTEM>DUMP.EXE TO 770000
;<1A-UTILITIES>SETSPD.MAC.62, 31-MAR-76 09:43:47, EDIT BY HURLEY
;TCO # 1227 - ADD TOPS-20 ENTRY VECTOR AND VERSION NUMBER
;<V-SOURCES>SETSPD.MAC.61, 27-MAR-76 12:22:23, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.60, 27-MAR-76 12:02:14, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.59, 27-MAR-76 12:01:37, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.58, 27-MAR-76 09:07:22, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.57, 27-MAR-76 09:05:33, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.56, 23-MAR-76 15:05:31, EDIT BY HURLEY
;TCO 1205 - MAKE PROTECTION OF DUMP.EXE BE 770000
;<V-SOURCES>SETSPD.MAC.55, 16-MAR-76 14:51:06, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.54, 15-MAR-76 14:12:49, EDIT BY MILLER
;TCO 1015. FIX UP CHFDB
;<V-SOURCES>SETSPD.MAC.53, 15-MAR-76 09:45:25, EDIT BY KIRSCHEN
;<V-SOURCES>SETSPD.MAC.52, 12-MAR-76 10:21:14, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.51, 12-MAR-76 10:13:48, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.50, 12-MAR-76 09:30:06, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.49, 11-MAR-76 19:29:33, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.48, 11-MAR-76 19:26:43, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.47, 11-MAR-76 19:25:48, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.46, 11-MAR-76 19:20:29, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.45, 11-MAR-76 19:16:49, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.44, 11-MAR-76 19:09:30, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.43, 11-MAR-76 12:37:59, EDIT BY KIRSCHEN
;<V-SOURCES>SETSPD.MAC.42, 11-MAR-76 09:22:07, EDIT BY KIRSCHEN
;<V-SOURCES>SETSPD.MAC.41, 10-MAR-76 21:35:51, EDIT BY KIRSCHEN
;<V-SOURCES>SETSPD.MAC.40,  9-MAR-76 13:24:00, EDIT BY KIRSCHEN
;<V-SOURCES>SETSPD.MAC.39,  9-MAR-76 13:23:16, EDIT BY KIRSCHEN
;TCO 1169 - CREATE DUMP.CPY FILES WITH PROTECTION 770000.
;<V-SOURCES>SETSPD.MAC.38,  9-MAR-76 09:53:58, EDIT BY KIRSCHEN
;TCO 1167 - ADD "PRINTER" COMMANDS TO INITIALIZE PRINTERS
;<V-SOURCES>SETSPD.MAC.37,  9-FEB-76 15:35:59, EDIT BY MILLER
;<V-SOURCES>SETSPD.MAC.37,  9-FEB-76 15:00:02, EDIT BY MILLER
;MCO 1066. LOAD CACHE REFILL ALGORITHM
;<V-SOURCES>SETSPD.MAC.36,  6-FEB-76 14:16:17, EDIT BY MILLER
;MORE EDITS FOR MCO 15
;<V-SOURCES>SETSPD.MAC.35, 21-JAN-76 12:13:58, EDIT BY MILLER
;MCO # 15. SET RETENTION COUNT OF DUMP.CPY AND CHECK DBUGSW
;<V-SOURCES>SETSPD.MAC.34, 12-JAN-76 10:25:44, EDIT BY MILLER

	TITLE SETSPD



;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 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

	SEARCH MONSYM,MACSYM,SERCOD
	.REQUIRE SYS:MACREL,SERCOD
	SALL
	IFNDEF .PSECT,<
	.DIRECT .XTABM>

; VERSION NUMBER DEFINITIONS

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

VSTSPD== <VWHO>B2+<VMAJOR>B11+<VMINOR>B17+VEDIT

;THIS ROUTINE IS RUN BY THE MONITOR AT SYSTEM START UP AND SETS
;VARIOUS PARAMETERS ABOUT THE SYSTEM. PRESENTLY IT WILL SET:
;	1. LINE SPEEDS AND REMOTE CHARACTERSITICS
;
;	2. SYSTEM LOGICAL NAMES
;
;	3. READ THE PREVIOUS DUMP AND QUEUE UP ANY SYSERR BLOCKS
;		THAT DID NOT GET QUEUED UP BEFORE THE CRASH
;
;	4. SET MAGTAPE LOGICAL TO PHYSICAL CORRESPONDENCE
;
;	5. LOAD RAM AND VFU FILES FOR LINEPRINTERS
;
;	6. ENABLE DIRECTORY-PARAMETER-SETTING
;
;	7. SET LOCAL TIME ZONE
;
;	8. SET THIS SITE'S ARPANET ADDRESS
;
;	9. ENABLE ACCOUNT-VALIDATION

;LOCAL STORAGE

MTBLK:	3			;SIZE OF BLOCK
	BLOCK 2			;FOR OTHER ARGS
EOLF:	BLOCK 1
PDL:	BLOCK 20		;THE PDL
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
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:	4
FLAGS:	RD%JFN!RD%PUN		;FLAGS
JFN:	0,,377777		;JFN'S
BUFPTR:	-1,,BUFFER		;BUFFER POINTER
COUNT:	SIZE			;SIZE OF BUFFER
SIZE==100
SIZEB==SIZE*5		;# OF BYTES IN BUFFER

BUFFER:	BLOCK SIZE		;WORK BUFFER

	RELOC 1000-140		;ALL THE REST IS PURE

;PROGRAM ENTRY VECTOR

ENTVEC:	JRST START		;STARTING LOCATION
	JRST START		;REENTER LOCATION
	VSTSPD			;VERSION NUMBER
	JRST START1		;ALTERNATE STARTING LOCATION

ENVLEN==.-ENTVEC		;ENTRY VECTOR LENGTH

;COMMAND TABLES:

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

LEV1TB:	ELEVL1-.-1,,ELEVL1-.-1
	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 /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/DIRECTORY-PARAMETER-SETTING/], ENADIR
	XWD [ASCIZ/FULL-LATENCY-OPTIMIZATION/], ENAFLO

	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

	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
;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

OPDEF CALL [PUSHJ P,]
OPDEF RET [POPJ P,]

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

	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 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)
;THE CODE

START:	RESET			;GET TO A KNOWN STATE
	MOVEI A,.FHSLF		;GET OWN ID
	RPCAP			;READ CAPABILITES
	MOVE C,B		;ENABLE ALL CAPABILITIES
	EPCAP			;DO IT
	MOVE P,[IOWD 20,PDL]	;SET UP PUSH DOWN LIST
	MOVE B,[LEVTAB,,CHNTAB]	;DEFINE INT SYSTEM
	SIR
	MOVSI B,(1B0)		;ENABLE LPT CHANNEL
	AIC
	EIR			;TURN ON INTS

;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
	MOVEI A,LEV1TB		;THE TABLE
	JRST GTKEY		;GO FIND AND DISPATCH ON KEY

;ALTERNATE SETSPD ENTRY

START1:	RESET			;GET TO A KNOWN STATE
	MOVEI A,.FHSLF		;GET OWN ID
	RPCAP			;READ CAPABILITIES
	MOVE C,B		;ENABLE ALL CAPABILITIES
	EPCAP			;DO IT
	MOVE P,[IOWD 20,PDL]	;SET UP PUSH DOWN LIST
	MOVE B,[LEVTAB,,CHNTAB]	;DEFINE INT SYSTEM
	SIR
	MOVSI B,(1B0)		;ENABLE LPT CHANNEL
	AIC
	EIR			;TURN ON INTERRUPTS
	CALL QUEBLK
	HALTF
;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
	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

;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
;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:	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
	HALTF			;AND DONE
;THIS CODE PROCESSES THE MAGTAPE CONFIGURATION COMMANDS. FORMAT
;OF A COMMAND LINE IS:
;	MAGTAPE "LUN" "SERIAL#" "SLAVE"

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 [	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
; 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,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
	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


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
;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 [ TMSG <
? setspd: 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
;COMMAND TO DECLARE DECNET NODE NAME

NODNAM:	SKIPE EOLF		;AT THE END-OF-COMMAND?
NODNA1:	JRST [	TMSG <
?SETSPD: 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 OCTAL NUMBER
	NIN			;""
NODNA3:	 JRST [	TMSG <
?SETSPD: 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
; 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
;ROUTINE TO PULL ANY UNQUEUED SYSERR BLOCKS OUT OF THE CRASH DUMP
;  AND QUEUE THEM UP TO SYSERR

QUEBLK:
;	SAVEP
	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
	ADD T2,T3		;COMPUTE # OF FILE PAGES TO MAP
	MOVEM T2,QUEPGS		;SAVE PAGE NUMBER
	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