/ 
/ 
/                   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 #9
/ 010	18-MAR-76 (RCHM)	USE 3 DIGITS FOR LUN NUMBER	/(010)
/
/ COPYRIGHT 1970,1971 DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/
/ MCR FUNCTION -- PHYSICAL DEVICES 	26 MAR 71	R. MCLEAN
/
/ TASK NAME "...DEV" TO REQUEST A LIST OF THE
/	PHYSICAL DEVICE LIST ON LUN 3.
/
/ THE FIRST LINE OF COMMAND INPUT FOR ANY MCR
/ FUNCTION IS READ BY THE RESIDENT MCR TASK
/ ("...MCR"). FOR THE "DEV" FUNCTION, THE SYNTAX
/ OF THE FIRST LINE IS:
/
/	SYNTAX = "DEV"$<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 ("...DEV"), FLUSHES CHARACTERS THRU
/ THE FIRST BREAK CHARACTER, REQUESTS "...DEV".,
/ AND EXITS. THE TASK "...DEV THEN DECODES THE
/ PHYSICAL DEVICE LIST AND LISTS THE LUN SLOTS ASSIGNED TO
/ EACH PHYSICAL DEVICE IN THE PHYSICAL DEVICE LIST.  IF A ^C IS
/ TYPED WHILE "...DEV" IS RUNNING A MESSAGE IS PRINTED AND
/ "...DEV" EXITS
/
/ IF THE COMMAND INPUT LINE IS TERMINATED BY A
/ CAR RTN, THE RESIDENT MCR TASK IS REQUESTED,
/ AND THE FUNCTION DEV 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 'PHYSICAL DEVICE LIST'
/
MCRRI=171
FAC=174
PVDL=252
LUN1=142
LUN2=143
X10=10
X11=11
X12=12
ECLA=641000
/
DEV	CAL	ATLU2	/ATTACH TO TTY ON LUN3
	LAC*	(PVDL)	/PICK UP PHYSICAL DEVICE POINTER
PVDLP	DAC*	(X11)	/SAVE POINTER IN XR11
	DAC	PVDLFD	/SAVE POINTER TO FIND END OF LOOP
	LAC	(PVDLMS+2)	/SET UP MESSAGE POINTER
	DAC*	(X10)	/IN X10
	DZM	CNT	/CLEAR UNIT COUNT
	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	-2
	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
	LAW	-3
	DAC	CNT1	/SET UP FOR MAX THREE NUMBERS
	ISZ*	(X11)
	ISZ*	(X11)
	LAC*	X11	/PICK UP UNIT NUMBER
	LMQ		/PUT IT IN MQ
	LLS	11
NXT1	ECLA!LLS 3	/PICK UP A DIGIT
SKPNXT	SNA	/ZERO SUPPRESS
	JMP	NXT
	PAL
	LAC	(JMP	SKPZER)
	DAC	SKPNXT	/SUPPRESS LEADING ZERO'S ONLY
	PLA
SKPZER	ISZ	CNT	/KEEP COUNT OF NUMBER OF CHARACTERS FOUND
	AAC	60	/MAKE ASCII
	DAC*	X10	/STORE IN MESSAGE
NXT	ISZ	CNT1	/HAVE THREE CHARACTERS BEEN CHECKED
	JMP	NXT1	/NO GET ANOTHER
	LAC	CNT
	SZA		/SKIP IF NO NUMBERS FOUND I.E. UNIT = 0
	JMP	OUTPB	/UNIT NUMBER FOUND
	AAC	60	/INSERT 0 FOR UNIT NUMBER
	DAC*	X10
	AAC	-57	/FILL IN TWO BLANKS
OUTPB	AAC	-4	/INSERT BLANKS INPLACE OF LEADING ZEROES
	DAC	CNT
	SNA	/SKIP IF BLANKS REQUIRED
	JMP	NOBLNK
	LAC	(040)
	DAC*	X10
	ISZ	CNT
	JMP	.-2
	LAC	(SNA)	/RESTORE SKIP INSTRUCTION
	DAC	SKPNXT
NOBLNK	LAW	-2	/SET UP FOR TWO PASSES THRU GET3
	DAC	CNT
	ISZ*	(X11)	/INCREMENT TO PICK UP BASE ADDRESS IN WORD 5
	LAC	(040)
	DAC*	X10	/INSERT A SPACE
	LAW	-1
	DAC	INFIR	/SET UP CHARACTER COUNT
	DZM	LUNNO	/CLEAR LUN COUNT
	LAC*	(LUN1)	/PICK UP FIRST LUN SLOT
	DAC	LUNCNT	/SET UP LUN POINTER
NXTLUN	LAC*	LUNCNT	/PICK UP FIRST LUN POINTER TO PVDL NODE
	ISZ	LUNNO
	SAD	PVDLFD	/IS THIS  A LUN POINTING TO THE NODE WE ARE LOOKING AT?
	JMS	INSRMS	/YES GO INSERT ITS NUMBER IN MESSAGE
	LAC	LUNCNT	/LOOK FOR THE END OF THE LUN TABLE
	ISZ	LUNCNT	/INCREMENT LUN NUMBER FOR NEXT PASS
	SAD*	(LUN2)	/IS THIS THE END OF THE TABLE
	JMP	PRNPVD	/YES GO PRINT THE LUN SLOTS
	JMP	NXTLUN	/NO PICK UP NEXT LUN
PRNPVD	LAC	(15)	/INSERT A CAR RTN IN MESSAGE
	DAC*	X10
	AAC	-3
	DAC*	X10	/INSERT A LINE FEED IN MESSAGE
	LAC	INFIRA	/IS THIS THE FIRST LINE?
	SZA
	JMP	NOOUTP	/YES DON'T OUTPUT A BLANK LINE
	DAC*	X10	/INSERT A NULL TO MAKE WORD PAIR COUNT EVEN
	LAC	PVDLMS+3	/CHECK FOR SECOND LINE BLANK
	SAD	(040)
	SKP		/IF BLANK LOOK TO SEE IF WHOLE LINE IS BLANK
	SKP!CLA		/NON BLANK LINE PRINT IT
	LAC	INFIR
	SPA		/IN POSITIVE OR ZERO LINE IS NOT BLANK
	JMP	NOOUTP
	LAC	INFIR
	RAR!SPA		/SET UP HEADER WORD PAIR
	DZM	PVDLMS+10	/ONLY OUTPUT ONE SPACE
	SZL
	IAC
	AAC	6
	SWHA
	AAC	3	/ADD MESSAGE TYPE
	DAC	PVDLMS	/STORE IN MESSAGE HEADER
	CAL	TTYMSG	/PRINT MESSAGE
	CAL	WAITEV	/WAIT FOR OUTPUT TO COMPLETE
NOOUTP	DZM	INFIRA
	LAW	-1	/CHECK TO SEE IF A 
	DZM	LUNNO
	SAD*	(MCRRI)	/^C HAS BEEN TYPED
	JMP	ABTEXT	/YES, EXIT AFTER PRINTING MESSAGE
	LAC*	PVDLFD	/GET PVDL FORWARD POINTER
	SAD	(PVDL)	/IS IT THE END OF THE LIST
	JMP	NOTCR	/YES EXIT
	JMP	PVDLP	/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
/
/	ABTEXT -- EXITS IF USER TYPES A ^C 
/
ABTEXT	CAL	XITMSG
	CAL	WAITEV	/WAIT FOR MESSAGE TO PRINT
	JMP	ABTXIT	/EXIT AND CALL MCR
/
/ INSRMS INSERTS THE LUN NUMBER AND A COMMA IN THE OUTPUT MESSAGE
/
INSRMS	0
	LAW -1		/ INITIALIZE FIRST CHARACTER INDICATOR	/(010)
	DAC FCHR	/					/(010)
	LAC	(54	/COMMA
	ISZ	INFIR	/IS THIS THE FIRST TIME?
	SKP	/NO INSERT A COMMA
	JMP	COMMA	/YES NO COMMA
	DAC*	X10
COMMA	LAC	LUNNO
	CLL		/ CLEAR THT LINK FOR THE IDIV		/(010)
	IDIV		/ EXTRACT THE 100RDS DIGIT.		/(010)
	144							/(010)
	PAL		/ SAVE THE REMAINDER.			/(010)
	LACQ		/ FETCH THE QUOTIENT.			/(010)
	SNA		/ ANY HUNDREDS DIGIT?			/(010)
	JMP TENNUM	/ NO, GO WORK WITH 10'S.		/(010)
	DZM FCHR	/ CLEAR FIRST CHARACTER INDICATOR.	/(010)
	AAC 60		/ CONVERT 100'S TO NUMERIC CHARACTER.	/(010)
	DAC* X10	/ STORE CHARACTER IN BUFFER.		/(010)
	ISZ INFIR	/ COUNT THE CHARACTER.			/(010)
TENNUM	PLA		/ FETCH THE REMAINDER.			/(010)
	CLL		/PICK LUN SLOT NUMBER
	IDIV
	12		/100 MAX NUMBER DECODED
	PAL	/SAVE LOW ORDER NUMBER
	LACQ	/PICK UP TENS POSITION
	ISZ FCHR	/ WAS THE 100 DIGIT OCCUPIED?		/(010)
	JMP .+3		/ YES, PRINT THE 10'S DIGIT.		/(010)
	SNA
	JMP	ONENUM	/IIT IS NOT GREATER THAN 10
	AAC	60	/ADD 60 TO MAKE ASCII
	DAC*	X10	/STORE IT IN MESSAGE
	ISZ	INFIR	/INCREMENT WORD COUNT
ONENUM	PLA	/PICK UP UNITS POSITION
	AAC	60	/MAKE IT ASCII
	ISZ	INFIR	/INCRMENT CHARACTER COUNT
	DAC*	X10	/STORE IN MESSAGE
	LAC	INFIR	/IS LINE FULL?
	AAC	-41
	SPA
	JMP*	INSRMS	/NO EXIT FOR NDXT LUN
	LAC	INFIR	/PICK UP CHARACTER COUNT
	ISZ	INFIR	/CLEAR CHARACTER COUNT
	RAR		/DIVIDE BY 2
	SZL
	IAC
	AAC	6	/ADD 6 TO ACCOUNT FOR FIRST TEN WORDSAND CR LF
	SWHA		/PUT COUNT IN WORD COUNT AREA
	AAC	3	/ADD MODE
	DAC	PVDLMS	/STORE IN MESSAGE
	LAC	(15)	/STORE CAR RTN
	DAC*	X10
	AAC	-3	/STORE LINE FEED
	DAC*	X10
	CLA
	DAC*	X10	/INSERT A NULL TO MAKE WORD PAIR COUNT EVEN
	CAL	TTYMSG	/PRINT MESSAGE
	CAL	WAITEV	/WAIT FOR MESSAGE TO FINISH
	LAC	(PVDLMS+1)	/RESET MESSAGE POINTER TO TOP
	DAC*	(X10)
	LAW	-10	/CLEAR FIRST TEN WORDS
	DAC	CNT
	LAW	-1	/RESET CHARACTER COUNT
	DAC	INFIR
	AAC	41	/STORE BLANKS
BLANK	DAC*	X10
	ISZ	CNT	/FILL FIRST EIGHT CHARACTERS WITH BLANK
	JMP	BLANK
	JMP*	INSRMS
/
/
WAITEV	20	/WAIT FOR
	TTYEV	/EVENT VARIABLE ADDRESS
/
ATLU2	2400	/ATTACH TO LUN 3
	0
	3
/
DETTTY	2500	/DETACH FROM LUN3
	TTYEV
	3
/
TTYMSG	2700	/OUTPUT MESSAGE
	TTYEV
	3
	3
	PVDLMS
/
XITMSG	2700	/EXIT MESSAGE
	TTYEV
	3
	2
	TTYABT
/
/
REQMCR	1		/REQUEST "...MCR" CPB
	0
	.SIXBT	"..."
	.SIXBT	"MCR"
	0
TTYABT	PVDLMS-TTYABT/2*1000+2
	0
	.ASCII	"^^^ DEV ^C EXIT"<15>
PVDLMS	014003	/HEADER
	0
	.REPT	120	/BLANKS
	40
	15		/CAR RTN
	12		/LF
/	
CNT	0
INFIR	0
TEMP	.BLOCK 	3
INFIRA	0
LUNNO	0
LUNCNT	0
CNT1	0
TTYEV	0
PVDLFD	0
FCHR	0		/ FIRST DIGIT INDICATOR FOR INSRMS	/(010)
	.END	DEV
