/ 
/ 
/                   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 #10
/
/ COPYRIGHT 1970,1971  DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/
/ MCR FUNCTION -- COMMON 	22 SEP 71	R. MCLEAN
/
/ TASK NAME "...COM" TO REQUEST A LIST OF THE
/	SYSTEM COMMON BLOCK DEFINITION LIST ON LUN 3.
/
/ THE FIRST LINE OF COMMAND INPUT FOR ANY MCR
/ FUNCTION IS READ BY THE RESIDENT MCR TASK
/ ("...MCR"). FOR THE "COM" FUNCTION, THE SYNTAX
/ OF THE FIRST LINE IS:
/
/	SYNTAX = "COM"$<CHARACTER>(<CR>/<AM>)
/
/	<CR> = CAR RTN
/	<AM> = ALTMODE
/	$ -- ANY NUMBER OF " INCLUDING ZERO"
/
/
/ THE RESIDENT MCR READS A LINE, FETCHES THE
/ FIRST THREE CHARACTERS TO FORM THE MCR FUNCTION
/ TASK NAME ("...COM"), FLUSHES CHARACTERS THRU
/ THE FIRST BREAK CHARACTER, REQUESTS "...COM" ,
/ AND EXITS. THE TASK "...COM" THEN DECODES THE
/ SYSTEM COMMON BLOCK DEFINITION LIST.  IF A ^C IS TYPED WHILE
/ "...COM" IS RUNNING A MESSAGE IS PRINTED AND
/ "...COM" EXITS.
/
/ IF THE COMMAND INPUT LINE IS TERMINATED BY A
/ CAR RTN, THE RESIDENT MCR TASK IS REQUESTED,
/ AND THE FUNCTION COM 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 'COMMON BLOCKS LIST'
/
MCRRI=171
FAC=174
CBDL=254
X10=10
X11=11
ECLA=641000
/
COM	CAL	ATLU2	/ATTACH TO TTY ON LUN3
	CAL	WAITEV	/WAIT FOR ATTACH TO COMPLETE
	LAC*	(CBDL)	/PICK UP COMMON BLOCK POINTER
	SAD	(CBDL)	/IS THERE A COMMON BLOCK?
	JMP	NOCOMM	/NO PRINT MESSAGE AND EXIT
CBDLP	DAC*	(X11)	/SAVE POINTER IN XR11
	DAC	CBDLFD	/SAVE POINTER TO FIND END OF LOOP
	LAC	(CBDLMS+2)	/SET UP MESSAGE POINTER
	DAC*	(X10)	/IN X10
	LAW	-2	/SET UP CNT TO DECODE TWO WORDS
	DAC	CNT	/OF COMMON NAME
	ISZ*	(X11)	/INCREMENT XR11
DECOD2	LAC*	X11	/GET A WORD AND SAVE IT IN MQ
	LMQ		/GET FIRST WORD AND SAVE IT IN MQ
	LAW	-3
	DAC	CNT1
DECOD1	ECLA!LLS 6	/PICK UP FIRST SIX BITS
	SNA		/IS A NULL CHARACTER DETECTED?
	JMP	IGNR	/YES MAKE IT A BLANK
	AAC	-40
	SPA		/IF GREATER THAN IT IS NOT ALPHA
	AAC	100	/MAKE 7 BIT ASCII
IGNR	AAC	40	/REPLACE 40
	DAC*	X10	/STORE IT IN MESSAGE
	ISZ	CNT1	/FINISHED NAME?
	JMP	DECOD1	/NO GET ANOTHER CHARACTER
	ISZ	CNT	/ARE WE FINISHED?
	JMP	DECOD2	/NO DECODE SECOND WORD
	ISZ*	(X10)	/INSERT  A SPACE
	LAW	-2	/SET UP FOR TWO PASSES THRU GET3
	DAC	CNT
	ISZ*	(X11)	/INCREMENT TO PICK UP BASE ADDRESS IN WORD 5
BASEL	LAC*	X11	/PICK UP BASE ADDRESS
	JMS	GET3	/DECODE AND STORE 5 BIT ADDRESS IN MESSAGE
	ISZ*	(X10)	/INSERT A SPACE
	ISZ	CNT	/HAS SIZE BEEN STORED?
	JMP	BASEL	/NO DECODE IT
	CAL	TTYMSG	/YES PRINT MESSAGE
	CAL	WAITEV	/WAIT FOR OUTPUT TO COMPLETE
	LAW	-1	/CHECK TO SEE IF A
	SAD*	(MCRRI)	/^C HAS BEEN TYPED
	JMP	ABTEXT	/YES, EXIT AFTER PRINTING MESSAGE
	LAC*	CBDLFD	/GET SCBDL FORWARD POINTER
	SAD	(CBDL)	/IS IT THE END OF THE LIST
	JMP	NOTCR	/YES EXIT
	JMP	CBDLP	/NO GO DO ANOTHER ONE
NOTCR	JMS*	(FAC)	/FLUSH OUT INPUT LINE TO FIND CAR RTN OR ALTMODE
	SAD	(015)	/IS CHARACTER A CAR RTN?
	JMP	ABTXIT	/YES EXIT
	SAD	(175)	/IS CHARACTER AN ALTMODE?
	JMP	FNDEOF	/YES EXIT
	JMP	NOTCR	/NO FETCH ANOTHER CHARACTER
ABTXIT	CAL	REQMCR	/YES -- REQUEST MCR
	JMP	WTDET	/IS BREAK CHARACTER AN ALTMODE
FNDEOF	DZM*	(MCRRI)	/YES, CLEAR ^C INHIBIT SWITCH
WTDET	CAL	DETTTY	/ DETACH TELETYPE
	CAL	(10)	/EXIT
/
/	NOCOMM	-- PRINTS NO COMMON MESSAGE AND EXITS
/
NOCOMM	CAL	NOCMSG	/PRINT NO COMMON MESSAGE
	CAL	WAITEV	/WAIT FOR TTY TO FINISH
	JMP	NOTCR
/
/	ABTEXT -- EXITS IF USER TYPES A ^C 
/
ABTEXT	CAL	XITMSG
	CAL	WAITEV	/WAIT FOR MESSAGE TO PRINT
	JMP	ABTXIT	/EXIT AND CALL MCR
/
/	GET3 -- STORES ADDRESSES IN MESSAGE.
/		AC CONTAINS  THE QUANTITY TO BE PRINTED
/
GET3	0
	LMQ		/SAVE VALUE IN MQ
	LAW	-6
	DAC	CNT1	/SET UP FOR 5 BIT ADDRESS
GET3L	ECLA!LLS 3	/CLEAR AC AND GET 3 BITS
	AAC	60	/ADD 60 TO MAKE IT ASCII
	DAC*	X10	/STORE IT IN MESSAGE
	ISZ	CNT1	/HAVE WE COPIED ENOUGH YET?
	JMP	GET3L	/NO  LOOP
	JMP*	GET3	/YES RETURN
/
WAITEV	20	/WAIT FOR
	TTYEV	/EVENT VARIABLE ADDRESS
/
ATLU2	2400	/ATTACH TO LUN 3
	TTYEV
	3
/
DETTTY	2500	/DETACH FROM LUN3
	TTYEV
	3
/
TTYMSG	2700	/OUTPUT MESSAGE
	TTYEV
	3
	3
	CBDLMS
/
XITMSG	2700	/EXIT MESSAGE
	TTYEV
	3
	2
	TTYABT
/
NOCMSG	2700
	TTYEV
	3
	2
	COMMSG
/
REQMCR	1		/REQUEST "...MCR" CPB
	0
	.SIXBT	"..."
	.SIXBT	"MCR"
	0
/
TTYABT	COMMSG-TTYABT/2*1000+2
	0
	.ASCII	"^^^ COM ^C EXIT"<15>
COMMSG	CBDLMS-COMMSG/2*1000+2
	0
	 .ASCII	" COM -- NO SYSTEM COMMON BLOCK DEFINITIONS"<15>
CBDLMS	015003	/HEADER
	0
	.REPT	26	/BLANKS
	40
	15		/CAR RTN
	12		/LF
/	
CNT	0
CNT1	0
TTYEV	0
CBDLFD	0
	.END	COM
