/ 
/ 
/                   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 #5
/
/ COPYRIGHT 1970, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/
/ MCR FUNCTION -- RESUME	25 MAR 71	R. MCLEAN
/
/ TASK NAME  " ..RES"   TO RESUME A TASK THAT HAS BEEN SUSPENDED.
/ WITH AN OPTIONAL RESTART ADDRESS.
/
/ THE FIRST LINE OF THE COMMAND INPUT FOR ANY MCR
/ FUNCTION IS READ BY THE RESIDENT MCR TASK ("...MCR").
/ FOR THE "RESUME" FUNCTION, THERE IS ONLY ONE LINE OF
/ COMMAND INPUT, AND IT'S SYNTAX IS AS FOLLOWS:
/
/	SYNTAX = 'RES'$<NBC><BREAK CHARACTER><TASK NAME>
/		(<OR/NULL>)(<CR>/<AM>)
/	<BREAK CHAR> = " "/","
/	<TASK NAME> = 1-6 ALPHANUMERIC CHARACTERS
/	<ORA> = OCTAL RESTART ADDRESS
/	<CR> = CAR RTN
/	<AM> = ALTMODE
/	<NBC> = NON BREAK CHARACTER
/	NULL " THE EMPTY SET"
/	$ -- " ANY NUMBER OF "INCLUDING ZERO ""
/
/	THE RESIDENT MCR READS A LINE, FETCHES THE
/	FIRST THREE CHARACTERS TO FORM THE MCR FUNCTION TASK
/	NAME ("...RES"), FLUSHES CHARACTERS THRU THE FIRST
/	BREAK CHARACTER, REQUESTS "...RES", AND EXITS
/	THE TASK "...RES " PROCESSES THE REMAINDER OF THE LINE
/	AND IF THE REQUEST IS VALID, ISSUES AN APPROPRIATE "RESUME"
/	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 'RESUME'
/
MCRRI=171
FAC=174
X10=10
/
RESU	LAW	-7	/SET UP TO FETCH TASK NAME AND STORE
	DAC	CNT	/SIX CHARACTERS (ZERO RIGHT FILL) 
	LAC	(RESCPB+1)
	DAC*	(X10)
/
RESN1	JMS*	(FAC)	/FETCH A CHARACTER
	SAD	(054)	/ IS IT A COMMA?
	JMP	RESN2	/RESTART ADDRESS
	SAD	(040)	/NO -- BLANK?
	JMP	RESN2	/RESTART ADDRESS
	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	RESN1	/NO -- GET NEXT CHARACTER
ERR1	LAC	(MES2)	/GET SYNTAX ERROR MESSAGE ADDRESS
	DAC	TYPCPB+4	/PUT IT IN TYPE MESSAGE
	JMP	ERRTY	/PRINT ERROR MESSAGE
/
ENDCRA	DAC	SVBKCH	/SAVE CAR RTN OR ALTMODE
RESN2	DZM*	X10	/FILL REMAINING CHARACTERS WITH ZERO
	ISZ	CNT
	JMP	RESN2
/
	LAC	RESCPB+4	/FORM FIRST HALF OF TASK NAME
	LRS	6
	LAC	RESCPB+3
	LRS	6
	LAC	RESCPB+2
	SNA		/IS THIS A NULL NAME?
	JMP	ERR1	/YES EXIT WITH ERROR
	LLS	14
	DAC	RESCPB+2	/STORE FIRST HALF OF WORD IN RESCPB
	LAC	RESCPB+7	/FORM SECOND HALF OF TASK NAME
	LRS	6
	LAC	RESCPB+6
	LRS	6
	LAC	RESCPB+5
	LLS	14
	DAC	RESCPB+3
	DZM	RESCPB+4	/RESET RESTART ADDRESS
	LAC	SVBKCH	/PICK UP CAR RTN OR ALTMODE TERMINATOR
	SZA		/WAS AN ALTMODE OR CAR RTN FOUND?
	JMP	EXT1	/YES EXIT -- NO RESTART ADDRESS
	LAW	-5	/SET CNT FOR 5 DIGIT ADDRESS
	DAC	CNT
RESRES	JMS*	(FAC)	/PICK UP A CHARACTER
	SAD	(015)	/IS IT A CAR RTN?
	JMP	RESEX1	/YES EXIT
	SAD	(175)	/IS IT AN ALTMODE?
	JMP	RESEXT	/YES EXIT
	AAC	-70	/MASK OFF ASCII TO MAKE OCTAL
	SMA		/IS IT ASCII NUMERIC
	JMP	ERR1	/NO SYNTAX ERROR
	AAC	10	/IS IT A SPECIAL CHARACTER?
	SPA!CLL
	JMP	ERR1	/YES ERROR
	XOR	EV	/ADD IT TO PREVIOUS NUMBER
	DAC	RESCPB+4	/STORE IT IN RESTART ADDRESS POINTER
	ALS	3	/SHIFT IT THREE FOR NEXT CHARACTER
	DAC	EV	/SAVE IT IN EV
	ISZ	CNT	/ARE WE FINISHED?
	JMP	RESRES	/NO TRY AGAIN
FLUSH	JMS*	(FAC)	/FLUSH THE REST OF THE LINE
	SAD	(015)	/IS IT A CAR RTN?
	JMP	RESEXT	/YES EXIT
	SAD	(175)	/IS IT AN ALTMODE?
	JMP	RESEXT	/YES EXIT
	JMP	FLUSH
/
RESEX1	DAC	SVBKCH	/SAVE TERMINAL CHARACTER
	LAW	-5	/HAVE ANY CHARACTERS BEEN FOUND?
	SAD	CNT
	JMP	ERR1	/NO -- ERROR
	JMP	EXT1	/EXIT
/
RESEXT	DAC	SVBKCH	/SAVE BREAK CHARACTER
EXT1	CAL	RESCPB	/ISSUE RESUME REQUEST
	CAL	WAITEV
	LAC	EV	/PICK UP EVENT VARIABLE TO SEE IF RESUME OK
	SMA		/WAS REQUEST OK?
	JMP	EXT1A	/YES EXIT
	SAD	(-205)	/IS TASK IN SYSTEM?
	JMP	ERRTY	/NO PRINT ERROR MESSAGE
	LAC	(MES1)
	DAC	TYPCPB+4	/PRINT TASK NOT SUSPENDED MESSAGE
ERRTY	CAL	TYPCPB	/MAKE TYPE CPB REQUEST
	CAL	WAITEV	/WAIT FOR MESSAGE TO BE PRINTED
	JMP	EXT2	/CALL MCR AND RETURN
/
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
/
WAITEV	20	/WAIT FOR
	EV	/EVENT VARIABLE ADDRESS
/
RESCPB	7	/RESUME CPB
	EV	/EVENT VARIABLE
	0	/TASK NAME (FIRST HALF)
	0	/TASK NAME (SECOND HALF)
	0	/RESUMPTION ADDRESS
	0
	0
	0
	0
	0
/
TYPCPB	2700
	EV
	3
	2
	MES3
/
EV	0
/
MES1	2; 0; .ASCII	"RES-TASK NOT SUSPENDED"<15>
MES2	2; 0; .ASCII	"RES-SYNTAX ERR"<15>
MES3	2; 0; .ASCII	"RES-TASK NOT ACTIVE"<15>
/
/
/
SVBKCH	0
CNT	0
	.END	RESU
