	.TITLE	LOGON2 OVERLAY FOR MULTIACCESS
/
/COPYRIGHT (C) 1976
/DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
/ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
/THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
/SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
/VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
/EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
/THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
/SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
/
/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
/WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
/MITMENT BY DIGITAL EQUIPMENT CORPORATION.
/
/DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
/OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
	.EJECT
/
/ EDIT #8	M. HEBENSTREIT		APRIL 5, 1976
/ 009	06-APR-76 (RCHM)	COUNT DOUWN THE NULLIFIED CLOCK	/(009)
/				QUE REQUESTS.			/(009)
/ 010	13-APR-76 (SCR)		INCREMENT MA.NUS		/(010)
/ 011	14-APR-76 (MJH)		FIX-ASSIGN STUFF		/(011)
/ 012	16-APR-76 (MJH)		BATCH HANDLING			/(011)
/ 013	18-MAY-76 (MJH)		FIX-REQ HANDLER TIMING GLITCH	/(013)
/ 014	24-MAY-76 (SCR)		ADJUST ATL SCAN
/ 015	2-JUNE-76 (SCR)		SET WORD BT.USR WITH OUR #
/ 016	15-JUL-76 (RCHM)	CHANGE DEFAULT STATE OF U.SSM	/(016)
/				TO -1 INSTEAD OF 0.		/(016)
/								/(017)
/ 017	30-JUL-76 (EAG)		INSERT FLAG BITS SO THAT BATCH	/(017)
/				WILL IGNORE LOGIN DIALOGUE	/(017)
/				MESSAGES.			/(017)
/								/(017)
/ THIS FILE IS THE SECOND HALF OF THE LOGIN PROCESSOR FOR MULTIACCESS.
/ THE FUNCTION OF THIS OVERLAY IS TO CHECK THE USERS INPUT FOR
/ DISK TYPE UNIT AND UFD , INITIALIZE THE UFD, AND SETUP THE LUN SPACE.
/
/ ASSEMBLY PARAMETERS:
/	MA.NLU IS THE NUMBER OF VIRTUAL LUNS IN A USERS LUN SPACE
/	MTUNIT IS THE CODE FOR UNIT TYPE IN MARK TIME REQUESTS
/	MTNUMU IS THE NUMBER OF UNITS TO MARK TIME FOR
/
	.IFUND	MA.NLU
MA.NLU=31
	.ENDC
	.IFUND	MTUNIT
MTUNIT=2		
	.ENDC
	.IFUND	MTNUMU
MTNUMU=72			/MARK TIME FOR 60 DECIMAL SECONDS
	.ENDC
	.TITLE	MACROS
	.DEFIN	.RTL3
	LAC	(400020
	ISA
	.ENDM
/
/ MACRO TO DEFINE OFFSETS INTO THE USER CONTEXT AREA.
/
	.DEFIN UCAOFF
U.JSW=0				/OFFSET TO JOB STATUS WORD.
U.MAEV=1			/OFFSET TO EVENT VARIABLE
U.MAMTE=2			/OFFSET TO MARK TIME EVENT VARIABLE.
U.OEV=3				/OFFSET TO OVERLAY EVENT VARIABLE.
U.DSK=4				/OFFSET TO DISK NAME
U.DUN=5				/OFFSET TO DISK UNIT NUMBER
U.UFD=6				/OFFSET TO UFD NAME.
U.CTSK=7			/OFFSET TO CURRENT TASK NAME
U.PSC=11			/OFFSET TO PARTITION SELECTION CRITERIA.
U.ULOF=14			/OFFSET TO USER NUMBER AND LUN OFFSET.
U.TTYN=15			/OFFSET TO USER TERMINAL NUMBER.
U.TB=16				/OFFSET TO USER TERMINAL BUFFER.
U.CPB=62			/OFFSET TO MULTI-ACCESS CPB.
U.SSM=74			/SECONDS SINCE MIDNIGHT INTO STATE 11
				/ OR 12 (HUNG ON PARTITION)
U.TW=75				/TOTAL TIME IN SECONDS SPENT IN STATE 11
				/ OR 12.
U.OVID=76			/OVERLAY IDENTIFIER (LAST OVERLAY CALLED)
U.CKS=77			/CHECKSUM OF INPUT BUFFER FOR TIMED READ.
U.LEN=100			/LENGTH OF UCA.
	.DEFIN UCAOFF
	.ENDM
	.ENDM
	.TITLE	EQUATES AND GLOBALS
/
/ EQUATES
/
SCR=230322			/SCR IN SIXBT
TT=242400			/TT IN SIXBT
RSX=222330			/RSX IN SIXBIT
BD=020400			/BD IN SIXBT			(012)
ATL=244				/ATL LISTHEAD			(013)
.INH=705522			/INHIBIT INTERRUPTS		(013)
.ENB=705521			/ENABLE INTERRUPTS		(013
LUTP1=142			/BASE OF LUT
AFTP1=144			/BASE OF AFT
LUNUFD=304			/BASE OF LUN-UFD TABLE
RKDISK=302			/HIGHEST UNIT OF ALL RKS
RPDISK=303			/HIGHEST UNIT OF ALL RPS
DSIZE=137			/HIGHEST PLATTER OF ALL RFS
SYSDSK=301			/HINF CODE FOR SYSTEM DISK
TTYS=205			/NUMBER OF TERMINALS ON SYSTEM	(012)
ECLA=641000			/CLEAR AC WITH EAE
SHAL=660000			/SHIFT AC0 INTO LINK BEFORE EAE
IDX=ISZ				/INCREMENT BUT TRY NOT TO SKIP
X10=10				/AUTOINCREMENT REGISTERS
X11=11
X12=12
CLKQ=246			/CLOCK QUEUE LISTHEAD
C.FP=0				/OFFSET TO CLKQ FORWARD POINTER
C.TI=2				/OFFSET TO CLKQ TYPE INDICATOR
C.MD=3				/OFFSET TO CLKQ MODE INDICATOR
C.PE=4				/OFFSET TO CLKQ EV
C.SP=5				/OFFSET TO CLKQ PBDL POINTER	/(009)
PDVL=252			/PDVL LISTHEAD
D.FP=0				/OFFSET TO PDVL FORWARD POINTER
D.N1=2				/OFFSET TO PDVL NAME
D.UN=5				/OFFSET TO PDVL UNIT
MA.ELU=225			/END OF USERS LUNS
P.TP=7				/OFFSET TO TRANSFER PENDING CTR	/(009)
				/IN THE PBDL.			/(009)
	UCAOFF
	.EJECT
/
/ GLOBALS
/
	.GLOBL	TDVTYP		/TYPE A MESSAGE SUBROUTINE
	.GLOBL	BT.USR		/(015) LOGGON USER MASK
	.GLOBL	LOGON2		/ENTRY POINT OF THIS OVERLAY
	.GLOBL	MA.NUS		/NUMBER OF LOGGON USERS		/(010)
	.TITLE	OVERLAY INITIALIZATION AND UCA SETUP
/
/ OVERLAY INITIALIZATION
/
LOGON2	0
	DAC	UCADDR		/SAVE UCA ADDRESS
	AAC	U.MAMTE		/SAVE ADDR OF MARK TIME EV
	DAC	MTEVAD
/
	LAC	(LOGON2		/CALCULATE XR ADJUSTMENT
	AND	(70000
	DAC	MXRADJ		/SAVE INVERSE OF XR ADJUSTMENT
	TCA
	DAC	XRADJ		/SAVE XR ADJUSTMENT
/
/ INIT DEFAULT USER DISK UNIT AND UFD
/
	JMS	UCASET		/PREPARE TO ACCESS UCA
	LAC	U.TTYN,X	/GET USERS TERMINAL NUMBER
	DAC	TERMNL		/SAVE IT
	LAC*	(SYSDSK		/GET HINF CODE OF SYSTEM DISK
	DAC	DEVICE		/SAVE DEFAULT DISK TYPE
	SAD	(2		/RF?
	LAC	RFNAME		/YES
	SAD	(3		/NO -- RP?
	LAC	RPNAME		/YES
	SAD	(24		/NO -- RK?
	LAC	RKNAME		/YES
	DAC	U.DSK,X		/SAVE DEFAULT DISK NAME
	.EJECT
	DAC	SDKNAM		/SAVE NAME OF SYSTEM DISK
	DZM	U.DUN,X		/CLEAR DEFAULT UNIT NUMBER
	LAC	(SCR		/GET 'SCR' IN SIXBT
	DAC	U.UFD,X		/SAVE DEFAULT UFD NAME
	.EJECT
/
/ NULLIFY ANY MARK TIME REQUESTS ASSOCIATED WITH THE MT EV
/
	LAC* MTEVAD	/ FETCH MARK TIME EVENT VARIABLE.	/(009)
	SZA		/ HAS IT EXPIRED?			/(009)
	JMP ENDCQ1	/ YES, BYPASS ALL CLOCK QUEUE PROCESSING/(009)
	LAC	(CLKQ		/GET HEADER ADDRESS OF CLOCK Q
	JMS	SETXR		/PREPARE TO ACCESS
	.RTL3			/RAISE TO API LEVEL 3
NXTCQN	LAC	C.FP,X		/GET FORWARD POINTER TO NODE
	SAD	(CLKQ		/END OF LIST?
	JMP	ENDCQ		/YES -- NO MT REQUEST WAS PENDING
	JMS	SETXR		/NO -- PREPARE TO ACCESS NODE
	LAC	C.TI,X		/GET TYPE OF NODE
	SAD	(5		/IS IT A MARK TIME?
	SKP
	JMP	NXTCQN		/NO -- CHECK NEXT NODE
	LAC	C.PE,X		/YES -- CORRECT EVENT VARIABLE?
	SAD	MTEVAD
	SKP
	JMP	NXTCQN		/NO -- CHECK NEXT NODE
	LAC	(6		/YES -- NULLIFY REQUEST!
	DAC	C.TI,X
	LAC C.SP,X	/ FETCH PBDL NODE ADDRESS.		/(009)
	JMS SETXR	/ SET UP TO ACCESS THE PBDL.		/(009)
	LAC P.TP,X	/ FETCH THE TRANSFER PENDING COUNT	/(009)
	AAC -1		/ AND DECREMENT IT BY			/(009)
	DAC P.TP,X	/ ONE.					/(009)
ENDCQ	DBK			/DROP BACK TO API LEVEL 7
				/EITHER THE SINGLE NODE WAS NULLIFIED
				/OR NO REQUEST WAS PENDING.
	.TITLE	USER TYPE-IN SYNTAX ANALYSER
/
/ PREPARE TO GET A DISK, UNIT, AND UFD
/
	JMS	UCASET		/SETUP XR TO ACCESS UCA
ENDCQ1	LAC	UCADDR		/GET UCA ADDRESS		/(009)
	JMS	IFAC		/INIT FETCH A CHAR
	JMS	FAC		/GET A CHAR
	JMS	TERM		/IS IT A TERM?
	JMP	CHUNIT		/YES -- HEAD FOR UFD LOOKUP IN MFD
				/NO --
/
/ LOOK FOR A UFD
/
	SAD	(74		/IS IT A <?
	JMP	UFDNM		/YES -- GO LOOK FOR A UFD NAME
/
/ LOOK FOR A DISK NAME
/
	SAD	(122		/NO -- R?
	SKP
	JMP	SYNERR		/NO -- ERROR
	JMS	FAC		/YES -- GET NEXT CHARACTER
	JMS	TERM		/LINE TERMINATOR?
	JMP	SYNERR		/YES -- ERROR
	PAL			/SAVE CHAR IN LR
	SAD	(106		/NO -- F?
	JMP	RFDEV		/YES
	SAD	(120		/NO -- P?
	JMP	RPDEV		/YES
	SAD	(113		/NO -- K?
	SKP			/YES
	JMP	SYNERR		/NO -- ERROR
RKDEV	LAC	(24		/GET RK DEVICE CODE
	SKP
RPDEV	LAC	(3		/GET RP DEVICE CODE
	SKP
RFDEV	LAC	(2		/GET RF DEVICE CODE
	DAC	DEVICE		/SAVE THE DEFAULT DEVICE TYPE
	PLA			/GET CHAR BACK
	AND	(77		/MAKE THE F,K, OR P INTO SIXBT
				/MAKE THE DISK NAME IN SIXBT
	ALS!SHAL  6		/SHIFT F,R,OR K INTO 2ND POSITION
	TAD	(220000		/PUT AN R IN 1ST POSITION
	DAC	U.DSK,X		/SAVE DISK NAME
/
/ GOT THE DISK -- LOOK FOR A UNIT
/
	JMS	FAC		/GET NEXT CHAR
	JMS	TERM		/TERMINALTOR?
	JMP	CHUNIT		/YES -- HEAD FOR UFD LOOK UP IN MFD
	SAD	(40		/NO -- SPACE?
	JMP	IGNORE		/YES -- GO LOOK FOR ANY OTHER DATA
	SAD	(74		/NO -- <?
	JMP	UFDNM		/YES -- GO GET UFD
	PAL			/NO -- SAVE CHAR IN LR
	AAC	-60		/IS IT AN OCTAL DIGIT?
	SPA
	JMP	SYNERR		/NO -- ERROR
	PLA
	AAC	-70
	SMA
	JMP	SYNERR		/NO -- ERROR
	PLA			/YES
	AND	(7		/SAVE DIGIT (I.E. UNIT NUMBER)
	DAC	U.DUN,X
/
IGNORE	JMS	FAC		/GET A CHAR
	JMS	TERM		/LINE TERMINATOR?
	JMP	CHUNIT		/YES -- HEAD FOR UFD LOOKUP IN MFD
	SAD	(40		/NO -- SPACE?
	JMP	IGNORE		/YES -- GET NEXT CHAR
	SAD	(74		/NO -- <?
	JMP	UFDNM		/YES -- GO GET UFD NAME
	JMP	SYNERR		/NO -- ERROR
	.EJECT
/
/ GET A UFD NAME
/
UFDNM	JMS	ALPHNO		/GET AN ALPHA-NUMERIC CHAR IN SIXBT
	ALS!SHAL  14		/SHIFT CHAR TO 1ST POSITION
	DAC	UFDNAM		/SAVE
	JMS	ALPHNO		/GET ANOTHER CHAR
	ALS!SHAL   6		/SHIFT TO 2ND POSITION
	TAD	UFDNAM		/ENTER INTO NAME
	DAC	UFDNAM		/SAVE NAME
	JMS	ALPHNO		/GET LAST CHAR
	TAD	UFDNAM		/ENTER INTO UFDNAME
	DAC	UFDNAM		/SAVE COMPLETE UFD NAME
	JMS	FAC		/GET NEXT CHAR
	SAD	(76		/WAS IT >?
	SKP
	JMP	SYNERR		/NO -- ERROR
RDNXT	JMS	FAC		/YES -- LOOK FOR A LINE TERM
	JMS	TERM		/IS CHAR A TERM?
	SKP
	JMP	RDNXT		/NO -- GO READ NEXT CHAR
	LAC	UFDNAM		/YES -- SAVE UFD NAME IN UCA
	DAC	U.UFD,X
	.TITLE	UFD CREAION
/
/ CHECK FOR DISK UNIT LEGALITY AS PRELIM TO DISK ACCESS
/
CHUNIT	LAC	U.DSK,X		/GET DISK NAME
	SAD	RFNAME		/IS IT THE RF?
	JMP	RFUCHK		/YES
	SAD	RPNAME		/NO -- RP?
	JMP	RPUCHK		/YES
	LAC*	(RKDISK		/NO -- MUST BE RK
	JMP	TEST1		/GET HIGHEST AVAIL UNIT FOR DISK TYPE
RFUCHK	LAC*	(DSIZE		/ARE THER ANY RFS?
	SPA
	JMP	UNITER		/NO -- ERROR
	CLA			/CLEAR AC SINCE UNIT 0 IS HIGHEST FOR RF
	JMP	TEST1
RPUCHK	LAC*	(RPDISK		/GET HIGHEST RP UNIT
TEST1	SPA			/IS SUCH A DISK PRESENT AT ALL?
	JMP	UNITER		/NO -- ERROR
	TCA
	TAD	U.DUN,X		/YES -- IS SPECIFIED DISK UNIT LEGAL?
	SMA!SZA
	JMP	UNITER		/NO -- ERROR
/
/ CREATE UFD ON THE DISK IF NOT ALREADY PRESENT
/
	LAC	U.DUN,X		/SAVE UNIT NUMBER
	DAC	UNIT
	LAC	U.UFD,X		/GET UFD NAME 
	JMS	CRCHK		/PREPARE LINE FOR ANY MESSAGES
	JMS	MFD		/MAKE A UFD ON USER SPECIFIED DISK
	.TITLE	LUN ASSIGNMENT
/
/ SCAN THE PDVL FOR THE NODES NEEDED FOR REASSIGN
/
/ LOOK FOR USERS TERMINAL IN PDVL
/
	JMS	UCASET		/SET UP TO ACCESS UFD
	LAC	U.TTYN,X	/GET TERMINAL NUMBER
	SAD*	(TTYS		/DOES UNIT NUMBER INDICATE BATCH? (012)
	JMP	LK4BD0		/YES -- GO SCAN PDVL FOR BD0 INSTEAD OF A TT
	DAC	UNIT		/NO -- SAVE THE TTY UNIT NUMBER
	LAC	(TT		/GET DEVICE NAME
	JMS	PDVLSC		/SCAN PDVL FOR DEVICE AND UNIT
	DAC	LUN12		/SAVE THE PDVL NODE ADDR
	JMP	MRSCAN		/NOW GO SCAN FOR DISK HANDLERS	(012)
/
/ TERMINAL NUMBER INDICATES BATCH SO LOOK UP BD NOT A TTY IN PDVL
/
LK4BD0	DZM	UNIT		/CEAR BATCH'S UNIT NUMBER	(012)
	LAC	(BD		/PREPARE TO LOOK FOR BD0	(012)
	JMS	PDVLSC		/SCAN THE PDVL FOR BD0		(012)
	DAC	LUN12		/SAVE PDVL NODE ADDR OF BD0	(012)
/
/ LOOK FOR SYSTEM DISK FILES HANDLER IN PDVL
/
MRSCAN	LAC	SDKNAM		/GET NAME OF SYSTEM DISK	(012)
	DZM	UNIT		/CLREA UNIT NUMBER
	JMS	PDVLSC		/SCAN PDVL FOR THE SYSTEM DISK
	DAC	LUN10		/SAVE THE NODE ADDRESS
/
/ LOOK FOR USERS DISK IN PDVL
/
	JMS	UCASET		/PREPARE TO ACCESS UCA
	LAC	U.DUN,X		/GET USERS DISK UNIT NUMBER
	DAC	UNIT		/SAVE
	LAC	U.DSK,X		/GET USERS DISK NAME
	JMS	PDVLSC		/SCAN PDVL FOR DEVICE AND UNIT
	DAC	LUN15		/SAVE NODE ADDRESS
	.EJECT
/
/ INSURE DISK HANDLERS ARE PROPERLY INITIALIZED IN CORE		(011)
/ TTY HANDLER IS SURE TO BE OK SINCE ITS IN EXEC		(011)
/
	LAC	SDKNAM		/INIT SYSTEM DISK FILES HANDLER	(011)
	JMS	FIXIT		/IF ITS NOT OK ALREADY		(011)
	JMS	UCASET		/PREPARE TO ACCESS UCA		(011)
	LAC	U.DSK,X		/GET NAME OF USERS DISK		(011)
	SAD	SDKNAM		/SAME AS SYSDSK?		(011)
	JMP	ASSIGN		/YES -- ASSIGN LUNS		(011)
	JMS	FIXIT		/NO -- INIT THIS DISK		(011)
/
/ PREPARE TO ASSIGN THE USERS LUNS
/
ASSIGN	JMS	UCASET		/PREPARE TO ACCESS UCA
	LAW	-1000		/GET THE LUN FOR THIS USER
	AND	U.ULOF,X	/BITS 0-8 HAVE LUN OFFSET
	SWHA			/GET OFFSET INTO LOW AC BITS
	AAC	-2		/GET AUTOINC ADJUSTED OFFSET
	PAL			/SAVE IN LR FOR USE TO ACCESS TABLES
	TAD*	(LUTP1		/PREPARE TO ACCESS LUT
	DAC*	(X10		/USE X10 AS A POINTER TO LUT
	PLA			/GET BACK AUTOINC ADJUSTED OFFSET
	TAD*	(AFTP1		/PREPARE TO ACCESS ATTACH FLAG TABLE
	DAC*	(X11		/USE X11 AS A POINTER TO AFT
	PLA			/GET BACK THE OFFSET
	TAD*	(LUNUFD		/PREPARE TO ACCESS LUNUFD TABLE
	DAC*	(X12		/USE X12 AS A POINTER TO LUN-UFD
	.EJECT
/
/ NOW ASSIGN THE USERS VIRTUAL LUNS
/
/	ASGTT ASSIGNS A LUN TO USERS TTY
/	ASGUDK ASSIGNS A LUN TO USERS DISK AND UNF
/
/
	JMS	UCASET		/SETUP XR TO ACCESS UCA		(011)
	JMS	ASGUDK		/ASSIGN VITUAL LUN 2
	JMS	ASGUDK		/3
	JMS	ASGTT		/4
	JMS	ASGUDK		/5
	JMS	ASGUDK		/6
	JMS	ASGUDK		/7
	JMS	ASGUDK		/8
	JMS	ASGUDK		/9
	LAC	LUN10		/ASSIGN VITUAL LUN 10 TO
	DAC*	X10		/SYSDISK UFD: 'RSX'
	DZM*	X11
	LAC	(RSX
	DAC*	X12
	JMS	ASGUDK		/11
	JMS	ASGTT		/12
	JMS	ASGTT		/13
	JMS	ASGUDK		/14
	JMS	ASGUDK		/15
	JMS	ASGTT		/16
	JMS	ASGUDK		/17
	JMS	ASGUDK		/18
	JMS	ASGUDK		/19
	JMS	ASGTT		/20
	JMS	ASGTT		/21
	JMS	ASGUDK		/22
	JMS	ASGUDK		/23
	JMS	ASGUDK		/24
	JMS	ASGUDK		/25
/
/ PREPARE TO EXIT FORM THIS OVERLAY -- USER IS LOGGED ON
/
	CLA!CMA		/ INITIALIZE U.SSM SO THAT BATCH WON'T	/(016)
	DAC U.SSM,X	/ GET CONFUSED.				/(016)
	LAC	ONAM		/ENTER OVERLAY NAME INTO UCA
	DAC	U.OVID,X
	LAC	U.TTYN,X	/(015) TTY #
	TAD	(CLQ!LRS!1	/(015) MAKE SHIFT TO EXECUTE LATER
	DAC	LOGXX		/(015)
	CLA!IAC			/SET OVERLAY EV
	DAC	U.OEV,X
LOGXX	XX			/(015) SHIFT 1 FROM AC TO MQ
	LAC*	BT.USR		/(015) LOGIN USERS WORD
	OMQ			/(015) IOR  MQ TO AC
	DAC*	BT.USR		/(015) DONE WITH WORD
	LAC	(6		/SET USERS JOB STATUS TO 6 (PROMPT HIM)
	DAC	U.JSW,X
	ISZ*	MA.NUS		/INCREMENT # OF LOGGON USERS	/(010)
	NOP			/JUST IN CASE			/(010)
	JMP*	LOGON2
	.TITLE	ERROR HANDLERS
/
/ ERROR PROCESSOR -- NON-FATAL ERRORS
/
DKNERR	LAC	(MSGDKN		/DISK INIT ERROR		(011)
	SKP			/				(011)
SYNERR	LAC	(MSGSYN		/SYNTAX ERROR
	SKP
UNITER	LAC	(MSGUNT		/NONEXISTANT UNIT
	JMS	CRCHK		/PREPARE LINE FOR MESSAGES
	JMS	TYPE		/PRINT MESSAGE
	LAC	(PROMPT		/PROMPT THE USER TO RETYPE INPUT
	JMS	TYPE
	JMS	UCASET		/SETUP XR TO ACCESS UCA
	LAC	UCADDR		/GET UCA ADDRESS
	AAC	U.MAEV		/GET ADDR OF GENERAL EV
	DAC	READ+1		/SAVE IN READ CPB
	AAC	U.MAMTE-U.MAEV	/GET ADDR OF MT EV
	DAC	MARK+1		/SAVE IN MARK CPB
	AAC	U.TB-U.MAMTE	/GET ADDR OF INPUT BUFFER
	DAC	READ+4		/SAVE IN READ CPB
	LAC*	(MA.ELU		/GET TTY I/O LUN
	IAC
	TAD	U.TTYN,X
	DAC	READ+2		/SAVE IN READ CPB
	CAL	READ		/READ USERS INPUT
	CAL	MARK		/MARK TIME 
	JMS	UCASET		/SETUP TO ACCESS UCA
	CLA!IAC			/SET JOB STATUS TO 1
	DAC	U.JSW,X
	LAC	(2		/SET OVERLAY EV
EXIT	DAC	U.OEV,X
	LAC	ONAM		/SET OVERLAY NAME
	DAC	U.OVID,X
	JMP*	LOGON2		/RETURN
/
/ ERROR PROCESSOR -- FATAL ERROR
/
SYSERR	LAC	(MSGPDV		/CAN'T FIND PDVL NODE
	SKP
UFDERR	LAC	(MSGUFD		/UFD CREATION ERROR
	JMS	TYPE		/PRINT MESSAGE
	JMS	UCASET		/PREPARE TO ACCESS UCA
	LAW	-1		/SIGNAL OFF PROCESSOR
	JMP	EXIT		/CLEAN UP  TO EXIT
	.TITLE	SUBROUTINES
/
/ SUBROUTINE ASGUDK -- ASSIGN USERS DISK AND UFD
/
ASGUDK	0
	LAC	LUN15		/GET ADDR OF PDVL NODE OF USER DISK
	DAC*	X10		/ENTER IN LUT (ASSIGN)
	DZM*	X11		/DEVICE IS NOT ATTACHED
	LAC	U.UFD,X		/END TER UFD NAME INTO LUN UFD
	DAC*	X12
	JMP*	ASGUDK
/
/ SUBROUTINE ASGTT -- ASSIGN USERS TERMINAL
/
ASGTT	0
	LAC	LUN12		/GET PDVL NODE ADDR OF USERS TERMINAL
	DAC*	X10		/SAVE IN LUT (ASSIGN)
	DZM*	X11		/DEVICE IS NOT ATTACHED
	DZM*	X12		/NO UFD NAME FOR TTYS
	JMP*	ASGTT
/
/ SUBROUTINE UCASET -- SETUP XR TO ACCESS UCA
/
UCASET	0
	LAC	UCADDR		/GET ADDR OF UCA
	JMS	SETXR		/POINT XR AT UCA
	JMP*	UCASET
/
/ SUBROUTINE FIXIT -- INIT A FILES HANDLER IF NOT ALREADY INIT'D (011)
/								(011)
/ ENTER WITH AC SET TO DISK NAME (E.G. 222000 FOR RP)		(011)
/								(011)
/ ON RETURN ALL REGISTERS ARE MODIFIED				(011)
/								(011)
FIXIT	0							/(011)
	AAC	56		/ADD A . TO DISK NAME		(011)
	DAC	DKNAM1		/SAVE NAME IN REQUEST CPB	(011)
	DAC	DKNAM2		/SAVE IN FIX CPB		(011)
	DAC	DKNAM3		/SAVE IN UNFIX CPB		(011)
	CAL	FIX		/FIX THE HANDLER IN CORE	(011)
	LAC	EV		/WAS FIX SUCCESSFUL?		(011)
	SAD	(-202		/WAS TASK ACTIVE?		(011)
	JMP*	FIXIT		/YES -- RETURN			(011)
	SAD	(-207		/NO -- ALREADY FIXED ? (???)	(011)
	JMP	FIXIT2		/YES -- PROCEED			(013)
	SPA			/NO -- WAS FIX OK?		(011)
	JMP	DKNERR		/NO -- ERROR			(011)
FIXIT2	.INH			/LOCK UP SYSTEM FOR A SEARCH CYCLE/(014)
FIXIT3	LAC*	(ATL		/ADDR OF FIRST NODE IN ATL	/(014)
FIXIT4	DAC	FIXTMP		/SAVE NODE ADDR			/(014)
	SAD	(ATL		/ALL THRU THE LIST?		/(014)
	JMP	FIXIT1		/YES, FIX COMPLETED		/(014)
	IAC			/SETUP X12 TO ACCESS ATL NAME	/(013)
	DAC*	(X12		/				/(013)
	LAC*	X12		/GET 1ST PART OF NAME		/(013)
	SAD	DKNAM2		/DOES IT MATCH NAME IN FIX CPB?	/(013)
	SKP			/				/(013)
	JMP	FIXIT5		/NO -- PREP TO CHECK NEXT NODE	/(014)
	LAC*	X12		/YES -- CHECK 2ND PART OF NAME	/(013)
	SAD	DKNAM2+1	/				/(013)
	JMP	FIXIT6		/STILL THERE, GO WAIT 		/(014)
FIXIT5	LAC*	FIXTMP		/FORWARD POINTER FROM NODE	/(014)
	.ENB			/LET SYSTEM BACK IN AFTER DAC	/(014)
	DAC	FIXTM2		/REMEMBER PRESENT LINKUP	/(014)
/
/  NOW SYSTEM BACK IN IF ANYONE OF GREATER INPORTANCE IS WAITING /(014)
/
	.INH			/NOW IT'S OURS AGAIN		/(014)
	LAC*	FIXTMP		/DID POINTERS MOVE IN OUR ABSENCE /(014)
	SAD	FIXTM2		/SKIP IF SOMETHING CHANGED	/(014)
	JMP	FIXIT4		/ALL OK, JUST KEEP CHECKING	/(014)
	JMP	FIXIT3		/SOMETHING MOVED, RESTART AT TOP! /(014)
/
FIXIT6	.ENB			/SYSTEM BACK IN			/(014)
	CAL	(5		/WAIT FOR A SIGN. EVENT		/(014)
	JMP	FIXIT2		/SO SCAN AGAIN			/(014)
FIXIT1	.ENB			/SYSTEM BACK IN			/(014)
	CAL	REQ		/YES -- REQUEST HANDLER INIT	(011)
	CAL	UNFIX		/UNFIX HANDLER			(011)
	JMP*	FIXIT		/RETURN				(011)
/
FIXTMP	0			/TEMP STORE FOR ATL FP		/(013)
FIXTM2	0			/SAVE POINTER CONTENTS		/(014)
	.EJECT
/
/ SUBROUTINE TERM -- FIND OUT IF CHAR IN AC IS A TERMINATOR
/
TERM	0
	SAD	(15		/IS CHAR A CR?
	SKP			/YES
	SAD	(175		/NO -- ALTMODE?
	SKP			/YES
	IDX	TERM		/NO -- RETURN AT JMS+2
	JMP*	TERM		/RETURN
/
/ PDVLSC -- SCAN PDVL FOR NAME IN AC AND UNIT IN UNIT
/
PDVLSC	0
	DAC	PDVLT		/SAVE DEVICE NAME
	LAC	(PDVL		/PREPARE TO SCAN
	JMS	SETXR
PDVL1	LAC	D.FP,X		/GET PTR TO NEXT NODE
	SAD	(PDVL		/END OF LIST?
	JMP	SYSERR		/YES -- ERROR MISSING PDVL NODE
	JMS	SETXR		/NO -- PREPARE TO ACCESS NODE
	LAC	D.N1,X		/GET 1ST HALF OF NAME
	SAD	PDVLT		/MATCH?
	SKP
	JMP	PDVL1		/NO -- CHECK NEXT NODE
	LAC	D.UN,X		/YES -- DOES 7UNIT MATCH?
	SAD	UNIT
	SKP
	JMP	PDVL1		/NO -- CHECK NEXT NDOE
	PXA			/YES -- GET NODE ADDR
	TAD	MXRADJ
	JMP*	PDVLSC		/RETURN
/
PDVLT	0			/TEMP STORAGE FOR DEVICE NAME
	.EJECT
/
/SUBROUTINE ALPHNO -- GET A CHAR FROM LINE BUFFER
/	CHECK TO SEE IF ITS ALPHA-NUMERIC. IF NOT, ERROR.
/	IS SO, MAKE IT SIXBT, SAVE IN TEMP AND RETURN
/	WITH SIXBT CHAR IN AC.
/
ALPHNO	0
	JMS	FAC		/GET A CHAR
	JMS	TERM		/IS IT A TERM?
	JMP	SYNERR		/YES -- ERROR
	PAL			/NO -- SAVE IN LR
	AAC	-60		/IS IT NUMERIC
	SPA
	JMP	ALPH1		/NO -- CHECK ALPHA
	AAC	-13
	SMA
	JMP	ALPH1		/NO -- CHECK ALPHA
ALPH2	PLA			/YES -- GET CHAR
	AND	(77		/MAKE IT SIXBT
	DAC	TEMP		/SAVE
	JMP*	ALPHNO		/RETURN
/
ALPH1	PLA			/GET CHAR
	AAC	-101		/IS IT IN ALPHABET?
	SPA
	JMP	SYNERR		/NO -- ERROR
	AAC	-32
	SMA
	JMP	SYNERR		/NO -- ERROR
	JMP	ALPH2		/YES -- MAKE INTO SIXBT
	.TITLE	MFD MANIPULATION SUBROUTINES
/ 
/ SUBROUTINE MFD -- MAKE SURE AN MFD ENTRY EXISTS FOR A UFD AND THAT
/                   THE UFD IS PROPERLY INITIALIZED.
/
/ ENTER WITH AC CONTAINING SIXBT NAME OF UFD AND 
/ UNIT CONTAINING THE UNIT NUMBER AND
/ DEVICE CONTAINING THE DEVICE CODE.
/
/ RETURN AT JMS+1 UNLESS AN ERROR IS DETECTED
/
/ ALL REGISTERS ARE MODIFIED
/
MFD	0
	DAC	MFDNAM		/SAVE THE NAME OF THE UFD
	JMS	MFDSCN		/SCAN THE MFD FOR THE UFD
	JMP	MFDFND		/RETURN HERE IF FOUND
MFD1	CLA			/RETURN HERE IF NOT -- LOOK FOR FREE ENTRY
	JMS	MFDSCN		/WAS A FREE MFD ENTRY FOUND?
	SKP
	JMP	MFD2		/NO -- GO CREATE ONE
	DAC	MFDT0		/YES -- SAVE MFD BLK WITH FREE ENTRY
	LAW	-1		/SET STATING UFD BLK TO -1 FOR FREE ENT
	DAC	1,X
	LAC	MFDT0		/GET THE MFD BLK NO.
	JMP	MFDFND		/GO ENTER NEW UFD
MFD2	JMS	MFDNEW		/ALLOCATE A BLK AND INIT BUFFER
	DAC	MFDT1		/SAVE NO. OF NEW BLOCK
	LAC	MFDT0		/GET NO. OF LAST MFD BLK
	DAC	BUFF+376	/ENTER NO. AS BACK PTR FOR NEW MFD BLK
	LAC	MFDT1		/WRITE OUT NEW MFD BLK
	JMS	MFDPUT
	LAC	MFDT0		/GET NO. OF OLD MFD BLK
	JMS	MFDGET		/READ IT INTO BUFFER
	LAC	MFDT1		/SET UP FWD PTR
	DAC	BUFF+377
	JMS	MFDPUT		/WRITE OUT OLD, MODIFIED MFD BLK
	LAC	(BUFF		/SET XR TO POINT AT BUFFER
	JMS	SETXR
	LAW	-1		/SET -1 INTO UFD ST. BLK
	DAC	1,X
	LAC	MFDT1		/GET BLK OF MFD WITH FREE ENTRY
MFDFND	DAC	MFDT0		/SAVE BLK NO. OF MFD BLK
	LAC	1,X		/IS UFD ST. BLK DEFINED?
	SAD	(-1
	SKP
	JMP*	MFD		/YES -- RETURN
	PXA			/NO -- SAVE XR
	DAC	MFDT1
	JMS	MFDNEW		/ALLO A BLK AND INIT BUFFER
	DAC	MFDT2		/SAVE NEW UFD BLK NO.
	JMS	MFDPUT		/WRITE OUT NEW UFD BLK
	LAC	MFDT0		/GET MFD BLK
	JMS	MFDGET
	LAC	MFDT1		/RESTORE XR
	PAX
	LAC	MFDNAM		/ENTER NAME OF UFD INTO MFD
	DAC	0,X
	LAC	MFDT2		/ENTER START OF UFD INTO MFD
	DAC	1,X
	LAC	(400010		/ENTER PC AND NO. WDS / UFD ENTRY
	DAC	2,X
	LAC	MFDT0		/WRITE OUT MODIFIED MFD BLK
	JMS	MFDPUT
	LAC	MFDNAM		/PREPARE TO PRINT THE UFD NAME
	LMQ
	LAC	(UFDBUF+2	/SETUP X10 AS PTR TO BUFFER
	DAC*	(X10
	JMS	SIXASC		/ENTER 1ST UFD CHAR
	JMS	SIXASC		/ENTER 2ND
	JMS	SIXASC		/ENTER 3RD
	JMS*	TDVTYP		/TYPE THE LINE: <UFD> UFD CREATED
	LAC	TERMNL
	LAC	(UFDBUF
	LAC	(3
	JMP*	MFD		/RETURN
/
MFDT0	0
MFDT1	0
MFDT2	0
MFDNAM	0
	.EJECT
/
/ SUBROUTINE MFDSCN -- SCAN MFD FOR A UFD NAME
/
/ ENTER WITH AC CONTAINING UFD NAME AND
/ UNIT CONTAINING UNIT NUMBER AND
/ DEVICE CONTAINING DEVICE CODE
/
/ RETURN AT JMS+1 IF FOUND WITH AC=MFD BLK NO. AND XR POINTING
/ AT ENTRY (XR IS CORRECTED)
/ RETURN AT JMS+2 IF NOT FOUND WITH AC=LAST MFD BLK
/
/ ALL REGISTERS ARE MODIFIED
/
MFDSCN	0
	DAC	MFDST1		/SAVE UFD NAME
	LAC	DEVICE		/IS DEVICE THE RP?
	SAD	(3
	JMP	MFDS1		/YES
	LAC	(1777		/NO -- RK OR RF , GET MFD ST. BLK
	SKP
MFDS1	LAC	(47040
MFDS4	DAC	MFDST2		/SAVE MFD BLK NO.
	JMS	MFDGET		/READ IN MFD BLK
	LAC	(BUFF		/INIT PTR TO BUFFER
	DAC	MFDST0
MFDS2	LAC*	MFDST0		/GET THIS UFD NAME
	SAD	MFDST1		/DOES IT MATCH THE ONE WANTED?
	JMP	MFDS5		/YES
	LAC	MFDST0		/NO -- END OF MFD BLK?
	SAD	(BUFF+370
	JMP	MFDS3		/YES
	AAC	4		/NO -- PREPARE TO EXAMINE NEXT ENTRY
	DAC	MFDST0
	JMP	MFDS2		/GO LOOK AT NEXT MFD ENTRY
MFDS3	LAC	BUFF+377	/GET NO. OF NEXT MFD BLK
	SAD	(-1		/END OF MFD?
	SKP
	JMP	MFDS4		/NO -- PREPARE TO READIN NEXT BLK
	IDX	MFDSCN		/YES -- PREPARE TO RET. AT JMS+2
MFDS6	LAC	MFDST2		/GET MFD BLK INTO AC
	JMP*	MFDSCN		/RETURN
MFDS5	LAC	MFDST0		/GET THE POINTER TO MFD ENTRY
	JMS	SETXR		/ADJUST XR
	JMP	MFDS6		/PREPARE TO RETURN AT JMS+1
/
MFDST0	0
MFDST1	0
MFDST2	0
	.EJECT
/
/ SUBROUTINE MFDNEW -- ALLOCATE A BLK AND INIT BUFFER
/
/ ENTER WITH DEVICE AND UNIT SET UP
/
/ RETURN AT JMS+1 WITH AC CONTAING BLK NO.
/
/ ALL REGISTERS ARE MODIFIED
/
MFDNEW	0
	LAC	DEVICE		/SET UP DEVICE AND UNIT NO.
	DAC	ALLO+4
	LAC	UNIT
	CLL
	ALS	17
	DAC	ACTA+1
	CAL	ALLO		/ALLOCATE A DISK BLOCK
	CAL	WAIT
	LAC	EV		/WHERE THERE ANY ERROR?
	SPA
	JMP	UFDERR		/YES
	LAC	ACTA+2		/NO -- DETERMINE BLK NO.
	LMQ
	LAC	ACTA+1
	AND	(7777
	LRSS	10
	LAC	(BUFF-1		/INIT BUFFER
	DAC*	(X10
	LAW	-376		/INIT COUNTER
	DAC	MFDTMP
	DZM*	X10		/ZERO WDS 0-376
	ISZ	MFDTMP
	JMP	.-2
	LAW	-1		/SET -1 INTO BLK PTRS
	DAC	BUFF+376
	DAC	BUFF+377
	LACQ			/GET BLK NO. INTO AC
	JMP*	MFDNEW		/RETURN
/
MFDTMP	0
	.EJECT
/
/ SUBROUTINE CONVRT -- CONVERT BLK NO. INTO PLATTER AND ADDR
/
/ ENTER WITH BLK NO. IN AC
/
/ RETURN AT JMS+1 UNCOND.
/
/ AC IS MODIFIED
/
CONVRT	0
	LMQ			/PUT BLK INTO MQ
	CLL
	LLSS!ECLA  10
	DAC	GPCTA+0		/ENTER PLATTER INTO CTA
	LACQ
	DAC	GPCTA+1		/ENTER ADDR INTO CTA
	LAC	UNIT		/ENTER UNIT NO.
	CLL
	ALS	17
	TAD	GPCTA+0
	DAC	GPCTA+0
	JMP*	CONVRT		/RETURN
/
/ SUBROUTINE MFDGET -- GET A DISK BLOCK
/
/ ENTER WITH BLK NO IN AC
/
/ RETURN AT JMS+1 WITH AC UNCHANGED
/
/ ALL OHTER REG. ARE MOD
/
MFDGET	0
	DAC	MFDTMP		/SAVE AC
	JMS	CONVRT		/CONVERT BLK NO INTO PLATTER + ADDR
	LAC	DEVICE		/ENTER DEVICE INOT CPB
	DAC	GET+4
	CAL	GET		/GET THE DISK BLK
	CAL	WAIT
	LAC	EV		/ANY ERROR?
	SPA
	JMP	UFDERR		/YES
	LAC	MFDTMP		/NO -- RESTORE AC
	JMP*	MFDGET
/
/ SUBROUTINE MFDPUT -- WRITE OUT A DISK BLK
/
/ ENTER WITH BLK NO. IN AC
/
/ RETURN AT JMS+1 WITH AC UNCHANGED
/
/ ALL OTHER REG ARE MOD.
/
MFDPUT	0
	DAC	MFDTMP		/SAVE AC
	JMS	CONVRT		/ENTER PLATTER AND ADDR INTO CTA
	LAC	DEVICE		/SET UP DEVICE CODE
	DAC	PUT+4
	CAL	PUT		/WRITE OUT BLK
	CAL	WAIT
	LAC	EV		/ANY ERROR?
	SPA
	JMP	UFDERR		/YES
	LAC	MFDTMP		/NO -- RESTORE AC
	JMP*	MFDPUT		/RETURN
/
/ SUBROUTINE SIXASC -- SHIFT A SIXBT CHAR FROM MQ, MAKE IT ASCII AND
/	ENTER INTO IMAGE ASCII BUFFER
/
SIXASC	0
	CLA			/REMOVE JUNK FROM AC
	LLS	6		/SHIFT IN CHAR
	AAC	-40		/MAKE CHAR INTO ASCII
	SPA
	AAC	100
	AAC	40
	DAC*	X10
	JMP*	SIXASC
/
UFDBUF	413000			/IMAGE IOPS UFD NAME BUFFER	/(017)
	0			/	NOTE:  THIS MESSAGE	/(017)
	74			/<		IGNORED BY	/(017)
	XX			/U		BATCH.		/(017)
	XX			/F
	XX			/D
	76			/>
	40			/SPACE
	125			/U
	106			/F
	104			/D
	40			/SPACE
	103			/C
	122			/R
	105			/E
	101			/A
	124			/T
	105			/E
	104			/D
	15			/CR
	12			/LF
	0			/NULL
	.TITLE	MORE SUBROUTINES
/
/ SUBROUTINE SETXR -- ADJUST THE XR
/
SETXR	0
	TAD	XRADJ
	PAX
	JMP*	SETXR
/
/ SUBROUTINE TYPE -- TYPE A MESSAGE TO USER TERMINAL
/
/	ENTER WITH MESSAGE ADDR IN AC
/	ON RETURN ALL REGISTERS MODIFIED
/
TYPE	0
	DAC	TYPMSG		/SAVE  MESSAGE ADDR
	JMS*	TDVTYP		/TYPE THE MESSAGE
	LAC	TERMNL
	LAC	TYPMSG
	LAC	(2		/IOPS ASCII ONLY MESSAGES
	JMP*	TYPE		/RETURN
/
TYPMSG	0			/TEMP STORE FOR MESSAGE ADDR
/
/ SUBROUTINE CRCHK -- CHECK INPUT LINE FOR ALTMODE TERM, IF ITS J
/	THERE PRINT A CARRIAGE RETURN.
/
CRCHK	0
	DAC	CRTMP		/SAVE THE AC FOR RESTORATION!
CRCHK1	JMS	FAC		/GET A CHAR
	JMS	TERM		/LINE TERM?
	SKP
	JMP	CRCHK1		/NO -- GO GET ANOTHER CHAR
	SAD	(15		/YES -- A CARRIAGE RETURN?
	JMP	CRCHK2		/YES -- RESTORE AC AND RETURN
	LAC	(MSGCR		/NO -- RETURN CARRIAGE
	JMS	TYPE
CRCHK2	LAC	CRTMP		/RESTORE AC
	JMP*	CRCHK		/RETURN
/
CRTMP	0			/AC BUFFER
	.EJECT
/
/  FETCH A CHARACTER SUBROUTINES FOR TDV
/
/  'IFAC'
/
/  THIS ROUTINE IS CALLED WITH THE UCA ADDRESS IN THE AC
/  TO INITIALIZE THE BUFFER UNPACK
/
/  'FAC'
/
/  THIS ROUTINE IS CALLED TO FETCH EACH CHARACTER
/  CHARACTER IS RETURNED IN THE AC RIGHT JUSTIFIED, LINK=0.
/
/  MODIFIED REGISTERS, AC, LINK.
/
/  ANY CALLS MADE BEYOND THE TERMINATORS <CR> AND <ALT>
/  WILL AGAIN RETURN THE TERMINATOR.
/
IDX=ISZ			/NO ISZ GENERATED SKIPS HERE
/
IFAC	0
	AAC	U.TB+2	/ADDRESS OF FIRST DATA WORD
	DAC	FETCHP	/FETCH POINTER, INDIRECT SINCE <32K
	LAC	(FETCH1	/POINTER TO ACTION TO GET FIRST OF 5
	DAC	FETCHX	/DISPATCHER
	JMP*	IFAC
/
FAC	0
	LAC*	FETCHP	/FIRST STEP OF ALL FETCHES
	JMP*	FETCHX	/GO TO APPROPRIATE ACTION
FETCHX	XX
	AND	(177	/STRIP TO 7 BITS
	SAD	(15	/CHECK FOR TERMINATOR
	JMP	FETCHE	/SET UP TO RETURN TERMINATOR FOREVER
	SAD	(175	/ALT IS OTHER TERMINATOR
	JMP	FETCHE
FETCHY	CLL		/LINK CLEAR IN CASE USER SHIFTS
	JMP*	FAC	/RETURN CHAR IN AC
/
FETCHL	JMS	FETCHX	/END OF FIFTH, LEAVE POINTER FOR FIRST
/
FETCH1	SWHA		/CHAR 1, SHIFT DOWN 11 PLACES
	RTR		/CHAR POSITIONED
	JMS	FETCHX	/LEAVE POINTER TO SECOND ACTION
/
FETCH2	RTR		/MOVE SECOND CHAR DOWN 4
	RTR
	JMS	FETCHX	/LEAVING POINTER TO THIRD ACTION
/
FETCH3	RAR		/MOVE TOP HALF DOWN TO TOUCH BOTTOM
	IDX	FETCHP	/MOVE DATA POINTER TO NEXT
	XOR*	FETCHP	/DOUBLE XOR MERGE
	AND	(7	/KEEP ONLY THESE 3 BITS ORIG. AC
	XOR*	FETCHP	/OTHER FIFTEEN BITS FROM FETCHP
	RTL		/CHAR UP TO FINAL PLACE
	RTL
	JMS	FETCHX	/LEAVING POINTER FOR FOURTH
/
FETCH4	RAL
	SWHA
	JMS	FETCHX	/LEAVING FIFTH POINTER
/
FETCH5	RAR
	IDX	FETCHP	/MOVE TO NEXT ASCII PAIR
	JMP	FETCHL	/BACK TO TOP TO KEEP GOING
/
/
FETCHE	DAC	FETCHP	/SAVE TERMINATOR
	LAC	(FETCHZ	/VECTOR TO FETCH TERMINATOR
	DAC	FETCHX
FETCHZ	LAC	FETCHP	/POINTER NO LONGER POINTER, BUT TERMI.
	JMP	FETCHY	/USER EXPECTS LINK CLEARED
/
FETCHP	(764000		/IMMEDIATE <ALT> IF UNINIT'ED
/
/
	.TITLE	VARIABLES,MESSAGES, AND CPBS
/
/ VARIABLES
/
MXRADJ	0			/INVERSE OF XR ADJUSTMENT
XRADJ	0			/XR ADJUSTMENT
MTEVAD	0			/MARKTIME EVENT VARIABLE ADDR
SDKNAM	0			/NAME OF SYSTEM DISK IN SIXBT
RKNAME	.SIXBT	"RK@"		/NAME OF RK
RPNAME	.SIXBT	"RP@"		/NAME OF RP
RFNAME	.SIXBT	"RF@"		/NAME OF RF
UCADDR	0			/UCA ADDRESS
UFDNAM	0			/NAME OF USERS UFD IN SIXBT
TEMP	0			/TEMP STOREAGE
LUN12	0			/PDVL NODE ADDR OF USERS TT
LUN15	0			/PDVL NODE ADDR OF USERS DISK
LUN10	0			/PDVL NODE ADDR OF SYSTEM DISK
ONAM	.SIXBT	"ON2"		/OVERLAY NAME
DEVICE	0			/HINF OF USERS DISK
UNIT	0			/USERS DISK UNIT NUMBER
EV	0			/GENERAL EV
TERMNL	0			/USERS TERMINAL NUMBER
	.EJECT
/
/ CPBS
/
MARK	13			/MARK TIME
	XX			/EVENT VARIABLE ADDR
	MTNUMU			/NUMBER OF MARK TIME UNITS
	MTUNIT			/MARK TIME UNITS (1 MINUTE)
/
READ	2600			/READ
	XX			/EVENT VARIABLE ADDR
	XX			/LUN
	2			/MODE: IOPS ASCII
	XX			/MESSAGE BUFFER
	U.CPB-U.TB		/MAX BUFFER SIZE
/
ALLO	11500			/ALLOCATE
	EV			/EVENT VARIABLE ADDR
	1			/LUN (DK)
	ACTA			/CONTROL TABLE ADDR
	XX			/DEVICE CODE
ACTA	400			/NUMBER OF WORDS TO ALLOCATE
	XX			/SET WITH UNIT AND PLATTER
	XX			/SET WITH DISK ADDRESS
/
WAIT	20			/WAIT FOR EV
	EV			/EVENT VARIABLE ADDRESS
/
GET	13000			/GET A DISK BLOCK
	EV			/EVENT VARIABLE ADDR
	1			//LUN
	GPCTA			/GET/PUT CONTROL TABLE ADDR
	XX			/DEVICE HINF CODE
/
PUT	13100			/PUT A DISK BLOCK
	EV			/EVENT VARIABLE ADDR
	1			/LUN
	GPCTA			/ADDR OF GET/PUT CONTROL TABLE
	XX			/DEVICE HINF CODE
/
GPCTA	XX			/DISK PLATERR AND UNIT
	XX			/DISK ADDR
	BUFF			/BUFFER ADDR
	400			/NUMBER OF WDS TO TRANSFER
/
REQ	1			/REQUEST A HANDLER		(011)
	0			/EVENT VARIABLE (NONE)		(011)
DKNAM1	XX			/HANDLER NAME (1ST 1/2)		(011)
	.SIXBT	"..."		/HANDLER NAME (2ND 1/2)		(011)
	0			/PRIORITY			(011)
/
FIX	15			/FIX A TASK			(011)
	EV			/EVENT VARIABLE			(011)
DKNAM2	XX			/HANDLER NAME (1ST 1/2)		(011)
	.SIXBT	"..."		/HANDLER NAME (2ND 1/2)		(011)
/
UNFIX	16			/UNFIX A TASK			(011)
	0			/EVENT VARIABLE			(011)
DKNAM3	XX			/HANDLER NAME (1ST 1/2)		(011)
	.SIXBT	"..."		/HANDLER NAME (2ND 1/2)		(011)
	.EJECT
/
/ MESSAGES
/
MSGDKN	MSGCR-MSGDKN*400+400002		/ THIS MESSAGE IGNORED	/(017)
	0				/ BY BATCH.		/(017)
	.ASCII "CAN'T INITIALIZE DISK FILES HANDLER"<15>	/(011)
MSGCR	MSGSYN-MSGCR/2*1000
	0
	.ASCII " "<15>
MSGSYN	MSGUNT-MSGSYN*400+400002	/ THIS MESSAGE IGNORED	/(017)
	0				/ BY BATCH.		/(017)
	.ASCII "SYNTAX ERROR"<15>
MSGUNT	PROMPT-MSGUNT*400+400002	/ THIS MESSAGE IGNORED	/(017)
	0				/ BY BATCH.		/(017)
	.ASCII "NONEXISTANT UNIT NUMBER"<15>
PROMPT	MSGPDV-PROMPT*400+400002	/ THIS MESSAGE IGNORED	/(017)
	0				/ BY BATCH.		/(017)
	.ASCII "RETYPE>"<175>
MSGPDV	MSGUFD-MSGPDV/2*1000
	0
	.ASCII "SYSTEM ERROR -- MISSING PDVL NODE"<15>
MSGUFD	BUFF-MSGUFD/2*1000
	0
	.ASCII "UFD CREATION ERROR"<15>
BUFF	.BLOCK	400
	.END
