/ 
/ 
/                   FIRST PRINTING, FEBRUARY 1974
/ 
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO 
/ CHANGE WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED
/ AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPON-
/ SIBILITY FOR ANY ERRORS THAT MAY APPEAR IN THIS
/ DOCUMENT.
/ 
/ THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FUR-
/ NISHED TO THE PURCHASER UNDER A LICENSE FOR USE ON
/ A SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH
/ INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR 
/ USE IN SUCH SYSTEM, EXCEPT AS MAY OTHERWISE BE PRO-
/ VIDED IN WRITING BY DIGITAL.
/ 
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/ FOR THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIP-
/ MENT THAT IS NOT SUPPLIED BY DIGITAL.
/ 
/ COPYRIGHT (C) 1974, BY DIGITAL EQUIPMENT CORPORATION
/ 
/ 
        .EJECT
/ EDIT #11
/
/ COPYRIGHT 1970,1971 DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/
/ MCR FUNCTION -- REQUEST	14 APR 71	R. MCLEAN
/
/ TASK NAME  "...REQ"   TO REQUEST A TASK WITH OPTIONAL
/ RUN PRIORITY SPECIFICATION.
/
/ THE FIRST LINE OF THE COMMAND INPUT FOR ANY MCR
/ FUNCTION IS READ BY THE RESIDENT MCR TASK ("...MCR").
/ FOR THE "REQUEST" FUNCTION, THERE IS ONLY ONE LINE OF
/ COMMAND INPUT, AND IT'S SYNTAX IS AS FOLLOWS:
/
/	SYNTAX = 'REQ'$<NBC><BREAK CHARACTER><TASK NAME>
/		(<BREAK CHAR><PRIORITY>/NUL)(<CR>/<AM>)
/	<BREAK CHAR> = " "/","
/	<TASK NAME> = 1-6 ALPHANUMERIC CHARACTERS
/	<PRIORITY> = <DV>
/	<DV> = DECIMAL VALUE 1-512
/	<CR> = CAR RTN
/	<AM> = ALTMODE
/	<NBC> = NON BREAK CHARACTER
/	$ -- " ANY NUMBER OF "INCLUDING ZERO ""
/	NUL -- " THE EMPTY SET"
/
/	THE RESIDENT MCR READS A LINE, FETCHES THE
/	FIRST THREE CHARACTERS TO FORM THE MCR FUNCTION TASK
/	NAME ("...REQ"), FLUSHES CHARACTERS THRU THE FIRST
/	BREAK CHARACTER, REQUESTS "...REQ", AND EXITS
/	THE TASK "...REQ " PROCESSES THE REMAINDER OF THE LINE
/	AND IF THE REQUEST IS VALID, ISSUES AN APPROPRIATE " REQUEST"
/	DIRECTIVE.
/
/	IF THE COMMAND INPUT LINE IS TERMINATED BY A CAR RTN,
/	THE RESIDENT MCR TASK IS REQUESTED, AND THE FUNCTION TASK
/	EXITS.
/
/	IF THE COMMAND INPUT LINE IS TERMINATED BY AN ALTMODE, THE
/	FUNCTION TASK EXITS WITHOUT REQUESTING "...MCR". A ^C TYPEIN
/	IS THEN NECESSARY TO RE-ESTABLISH MCR DIALOGUE.
 .TITLE *** MCR FUNCTION 'REQUEST'
/
MCRRI=171
FAC=174
X10=10
/
REQ	LAW	-7	/SET UP TO FETCH TASK NAME AND STORE
	DAC	CNT	/SIX CHARACTERS (ZERO RIGHT FILL) IN
	LAC	(REQCPB+1)	/REQUEST CAL PARAMETER BLOCK
	DAC*	(X10)
	DZM	SVBKCH	/CLEAR  ALTMODE CAR RTN TEST
/
REQN1	JMS*	(FAC)	/FETCH A CHARACTER
	SAD	(054)	/ IS IT A COMMA?
	JMP	REQN2	/YES -- ZERO REMAINING CHARACTERS
	SAD	(040)	/NO -- BLANK?
	JMP	REQN2	/YES -- ZERO REMAINING CHARACTERS
	SAD	(015)	/NO -- CAR RTN?
	JMP	ENDCRA	/YES-- END OF REQUEST
	SAD	(175)	/NO -- ALTMODE?
	JMP	ENDCRA	/YES-- END OF REQUEST
	DAC*	X10	/NO -- STORE CHARACTER
	ISZ	CNT	/LAST CHARACTER OF TASK NAME?
	JMP	REQN1	/NO -- GET NEXT CHARACTER
ERR1	JMS	TYPE	/PRINT MESSAGE FOR SYNTAX ERROR
	MES2
	JMP	EXT2	/EXIT AND CALL MCR
REQN2	DZM*	X10	/FILL REMAINING CHARACTERS WITH ZERO
	ISZ	CNT
	JMP	REQN2
/
	LAC	REQCPB+4	/FORM FIRST HALF OF TASK NAME
	DZM	REQCPB+4	/CLEAR PRIORITY TO ZERO
	LRS	6
	LAC	REQCPB+3
	LRS	6
	LAC	REQCPB+2
	SNA		/IS THIS A NULL NAME?
	JMP	ERR1	/YES EXIT WITH ERROR
	LLS	14
	DAC	REQCPB+2	/STORE FIRST HALF OF WORD IN REQCPB
	LAC	REQCPB+7	/FORM SECOND HALF OF TASK NAME
	LRS	6
	LAC	REQCPB+6
	LRS	6
	LAC	REQCPB+5
	LLS	14
	DAC	REQCPB+3
	DZM	B1	/CLEAR COUNTER
	LAW	-4	/PRIORITY CHECK
	DAC	CNT	/MAX OF 512
	LAC	SVBKCH	/WAS CR OR ALTMODE ALREADY PICKED UP
	SZA		/SKIP IF NO ALTMODE OR CAR RTN HAS BEEN FOUND
	JMP	EXT1	/EXIT NO PRIORITY REQUESTED
REQPRI	JMS*	(FAC)	/GET NEXT CHARACTER
	JMS	CMP	/SEE IF LEGAL NUMBER
	60
	71
	JMP	ALTCR	/NOT LEGAL NUMBER CHECK TO SEE IF ALTMODE OR CAR RET
	AND	(17)	/MAKE DECIMAL
	DAC	B2
	LAC	B1	/MULTIPLY B1 BY 10 THEN ADD
	RCL		/NEW DIGIT TO IT
	RTL
	TAD	B1
	TAD	B1
	TAD	B2
	DAC	B1
	ISZ	CNT	/SKIP IF FINISHED
	JMP	REQPRI
	JMP	ERR1	/ERROR TOO MANY NUMBERS
ALTCR	SAD	(175)	/IS IT ALTMODE
	JMP	ALTCR1
	SAD	(15)	/IS IT A CARRAGE RETURN
	SKP		/YES PROCESS IT
	JMP	ERR1	/NO IT MUST BY AN ERROR
ALTCR1	DAC	SVBKCH	/SAVE LAST CHARACTER READ
	LAC	B1
	JMS	CMP	/CHECK FOR LEGAL VALUES OF PRIORITY
	1
	1000
	JMP	ERR1	/.LT.1.OR.GT.512
	DAC	REQCPB+4
EXT1	CAL	REQCPB	/ISSUE REQUEST DIRECTIVE
	CAL	WAITEV
	LAC	EV	/GET EVENT VARIABLE
	SMA		/JUMP IF REJECTED
	JMP	EXT1A	/OK NO ERRORS
	SAD	(-201)	/TASK NOT IN SYSTEM ERROR
	JMP	MESA
	SAD	(-202)	/TASK ACTIVE
	JMP	MESB
	SAD	(-204)	/TASK DISABLED
	JMP	MESC
	SAD	(-212	/PARTITION LOST?
	JMP	MESD
	JMS	TYPE	/POOL EMPTY
	MES6
	JMP	EXT2
MESA	JMS	TYPE
	MES3
	JMP	EXT2
MESB	JMS	TYPE
	MES4
	JMP	EXT2
MESC	JMS	TYPE
	MES5
	JMP	EXT2
MESD	JMS	TYPE
	MES7
	JMP	EXT2
EXT1A	LAC	SVBKCH	/GET TERMINATION CHARACTER
	SAD	(15)	/SKIP IF ALTMODE
EXT2	CAL	REQMCR	/REQUEST MCR TASK
	SAD	(175)	/IF ALTMODE DON'T CLEAR MCRRI
	DZM*	(MCRRI)	/CLEAR ^C SWITCH
	CAL	(10)	/RETURN
/
REQMCR	1		/CALL MCR DIRECTIVE
	0
	.SIXBT	"..."
	.SIXBT	"MCR"
	0
REQCPB	1	/FUNCTION CODE
	EV	/EVENT VARIABLE ADR
	0	/TASK NAME (FIRST HALF)
	0	/TASK NAME (SECOND HALF)
	0
B1	0
B2	0
CMPBF	0
/
/ 	CMP -- COMPARE - AC- WITH - LIMITS SUBROUTINE
/
/	CALLING SEQUENCE
/	JMS	CMP
/	LL		/LOWER LIMIT
/	UL		/UPPER LIMIT
/	RETURN AT JMS+3 IF OUTSIDE LIMITS
/	RETURN AT JMS+4 IF WITHIN LIMITS (INCLUSIVE)
/	AC IS RESTORED
/
CMP	0
	DAC	CMPBF	/SAVE AC
	LAC*	CMP	/WITHIN LOWER LIMIT
	ISZ	CMP
	TCA
	TAD	CMPBF
	SPA
	JMP	CMP1	/NO -- RETURN AT JMS+3
	LAC	CMPBF	/YES -- WITHIN UPPER LIMIT?
	TCA
	TAD*	CMP
	SMA		/NO -- RETURN AT JMS+3
	ISZ	CMP	/YES-- RETURN AT JMS+4
CMP1	ISZ	CMP
	LAC	CMPBF	/RESTORE AC
	JMP*	CMP	/RETURN
/
/	TYPE -- SUBROUTINE TO TYPE THE MESSAGE WHOSE ADDRESS FOLLOWS THE JMS
/
TYPE	0
	LAC*	TYPE
	DAC	TYPCPB+4
	ISZ	TYPE
/
	CAL	TYPCPB	/MAKE TYPE CPB REQUEST
/
	CAL	WAITEV	/WAIT FOR TTY TO FINISH
	JMP*	TYPE	/RETURN
/
WAITEV	20	/WAITFOR
	EV	/EVENT VARIABLE ADDRESS
/
TYPCPB	2700
	EV
	3
	2
	XX
EV	0
/
MES2	2; 0; .ASCII	"REQ-SYNTAX ERR"<15>
MES3	2; 0; .ASCII	"REQ-TASK NOT IN SYSTEM"<15>
MES4	2; 0; .ASCII	"REQ-TASK ALREADY ACTIVE"<15>
MES5	2; 0; .ASCII	"REQ-TASK DISABLED"<15>
MES6	2; 0; .ASCII	"REQ-POOL EMPTY"<15>
MES7	2; 0; .ASCII    "REQ-PART LOST"<15>
/
/	ENDCRA	SAVE LINE TERMINATOR
/
ENDCRA	DAC	SVBKCH	/SAVE CR OR ALTMODE
	JMP	REQN2
/
SVBKCH	0
CNT	0
	.END	REQ
