	.TITLE *** UFD MCR FUNCTION ***
/
/ COPYRIGHT (C) 1975
/ 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 #5	7/3/75		M. HEBENSTREIT
/
/ THIS TASK WILL PRINT OUT THE LUN'S ASSOCIATED WITH A PARTICULAR
/ DISK-UFD COMBINATION FOR EACH DISK ON THE SYSTEM.
/
/ THE COMMAND STRING IS:   MCR>UFD
/
TYPLUN=3
PDNLUN=3
DSIZE=137
RKDISK=302
RPDISK=303
MCRRI=171
FAC=174
IDX=ISZ
LUTP1=142
LUTP2=143
LUFD1=304
DUFD1=306
PDVL=252
X10=10
X11=11
X12=12
X13=13
X14=14
X15=15
OBSIZ=40
TABSIZ=1000
/
START	LAC	(START		/GET XR ADJUSTMENT
	AND	(70000
	DAC	MXRADJ
	TCA
	DAC	XRADJ
/
	LAC	(2		/SET UP TO CHECK UFDS FOR RF0
	DAC	DEVICE		/SAVE DEVICE CODE
	LAC	(220600		/SAVE RF HANDLERS NAME
	DAC	DEVNAM
	DZM	UNIT		/SET UNIT TO ZERO FOR RF
	LAC*	(DSIZE		/ANY RFS?
	SPA
	JMP	RK		/NO
	JMS	DOUFD		/YES -- GO PRINT UFD/LUN ASSIGNMENTS
/
RK	LAC	(24		/SET UP TO CHECK UFDS FOR RK
	DAC	DEVICE
	LAC	(221300		/SAVE RK HANLDERS NAME
	DAC	DEVNAM
	DZM	UNIT		/SET UNIT TO 0
RK1	LAC*	(RKDISK		/ANY RKS?
	SPA
	JMP	RP		/NO
	TCA			/YES -- IS THIS UNIT PRESENT?
	TAD	UNIT
	SMA!SZA
	JMP	RP		/NO
	JMS	DOUFD		/YES -- PRINT ASSIGNMENTS FOR THIS RK
	IDX	UNIT		/SET UP FOR NEXT RK UNIT
	JMP	RK1
/
RP	LAC	(3		/SET UP TO CHECK UFDS FOR RP
	DAC	DEVICE		/SAVE DEVICE CODE
	LAC	(222000		/SAVE RP HANDLERS NAME
	DAC	DEVNAM
	DZM	UNIT		/SET UNIT TO 0
RP1	LAC*	(RPDISK		/ANY RPS?
	SPA
	JMP	EXIT		/NO -- GO EXIT
	TCA			/YES -- IS THIS UNIT PRESENT?
	TAD	UNIT
	SMA!SZA
	JMP	EXIT		/NO -- EXIT
	JMS	DOUFD		/YES -- PRINT ASSIGNMENTS FOR THIS RP
	IDX	UNIT		/SET UP FOR NEXT RP UNIT
	JMP	RP1
/
EXIT	JMS*	(FAC		/GET A CHAR
	SAD	(15		/CR?
	JMP	EXITCR		/YES
	SAD	(175		/NO -- ALTM?
	SKP
	JMP	EXIT		/NO -- READ NEXT CHAR
	DZM*	(MCRRI		/YES
	CAL	(10
EXITCR	CAL	REQMCR
	CAL	(10
/
/
DEVICE	0			/DEVICE HINF CODE
UNIT	0			/DEVICE UNIT NO.
DEVNAM	0			/DEVICE NAME
	404040
XRADJ	0			/XR ADJUSTMENT
MXRADJ	0			/TCA OF XRADJ
TEMP	0			/TEMPORARIES
	404040
TEMP1	0
	404040
TEMP2	0
TEMP3	0
/
/
BUFF	.BLOCK	OBSIZ
/
/
REQMCR	1
	0
	.SIXBT	"..."
	.SIXBT	"MCR"
	0
/
/ TABLE OF UFD NAMES FOR A DISK
/
TAB	.BLOCK	TABSIZ
/
/
SETXR	0
	TAD	XRADJ
	PAX
	JMP*	SETXR
/
/
DOUFD	0
	LAC	(BUFF		/INIT THE OUTPUT BUFFER
	JMS	IPACK
	LAC	UNIT		/PREPARE TO PRINT UNIT NAME AND UNIT
	AAC	60
	XOR	DEVNAM
	DAC	TEMP
	JMS	SIXPAK		/PACK DK# INTO BUFFER
	TEMP			/PROINTER TO SIXBT WORD TO PACK
	LAC	(55		/PACK A DELIMETER INTO BUFFER
	JMS	PACK
	LAC	(175		/PACK ALTM
	JMS	PACK
	LAC	(BUFF		/PRINT WHAT'S IN BUFFER SO FAR
	JMS	TYPE
/
/ SO FAR WE'VE TYPED 'DK#-'
/ NOW FILL IN THE DEFAULT UFD NAME
/
	LAC	(MSGDEF		/PRINT 'DEFAULT UFD:'
	JMS	TYPE
	LAC	DEVICE		/PREPARE TO GET DEFAULT UFD NAME
	SAD	(2		/IS DEVICE THE RF?
	JMP	DORF		/YES
	SAD	(3		/NO -- RP?
	JMP	DORP		/YES
DORK	LAC*	(DUFD1		/NO -- IT MUST BE THE RK
	AAC	10
	TAD	UNIT		/AC NOW HAS ADDR OF DEF. UFD
	JMP	DODEF
DORF	LAC*	(DUFD1
	AAC	20
	JMP	DODEF
DORP	LAC*	(DUFD1
	TAD	UNIT
DODEF	DAC	TEMP		/SAVE ADDR OF DEF UFD
	LAC*	TEMP		/GET DEF. UFD NAME
	SZA			/IS THERE ONE?
	JMP	DOUFDR		/YES
	LAC	(MSGNON		/NO -- PRINT 'NONE'
	JMP	DOTYPE
DOUFDR	DAC	TEMP		/SAVE THE UFD NAME
	LAC	(BUFF		/INIT OUTPUT BUFFER
	JMS	IPACK
	JMS	SIXPAK		/PACK UFD NAME
	TEMP
	LAC	(15		/FINISH THIS LINE
	JMS	PACK
	LAC	(BUFF
DOTYPE	JMS	TYPE		/TYPE THE DEF. UFD NAME
/
/ SO FAR WE'VE TYPED'DK#-DEFAULT UFD:UFD'
/ NOW PREPARE TO TYPE ACTIVE UFD'S AND THE LUNS ASSOCIATED WITH THEM
/
	LAC	(-TABSIZ	/SET ENTRIES OF THE UFD TABLE TO -1
	DAC	TEMP
	LAC	(TAB-1
	DAC*	(X10
	LAW	-1
	DAC*	X10
	ISZ	TEMP
	JMP	.-2
/
/ NOW THE TABLE HAS BEEN ZEROED
/ INIT THE POINTERS TO LUT,LUNUFD, AND A COUNTER FOR THOSE TABLES
/
/
	LAC*	(LUTP1		/SET UP  A LUN COUNTER(-NLU-1)
	TCA
	TAD*	(LUTP2
	AAC	2
	TCA
	DAC	TEMP
	LAC*	(LUTP1		/USE X10 AS A POINTER TO  LUT
	AAC	-1
	DAC*	(X10
	LAC*	(LUFD1		/USE X11 AS A POINTER TO LUN-UFD
	AAC	-1
	DAC*	(X11
/
/ PREPARE TO SCAN LUN-UFD FOR A NEW UFD ASSOCIATED WITH THIS DISK
/
DO2	ISZ	TEMP		/ALL  DONE?
	SKP
	JMP*	DOUFD		/YES -- RETURN
	LAC*	X11		/NO -- GET A UFD NAME FROM LUN-UFD
	DAC	TEMP1		/SAVE IT
	LAC*	X10		/ GET  THE PDVL N.A. FROM  LUT
	SNA			/IS LUN ASSIGNED?
	JMP	DO2		/NO -- PROCESS NEXT ENTRY
	JMS	SETXR		/YES -- PREPARE  TO ACCESS PDVL NODE
	LAC	2,X		/IS THIS PDVL  NODE  FOR THIS DISK?
	SAD	DEVNAM
	SKP
	JMP	DO2		/NO --  GO PROCESS NEXT ENTRY
	LAC	5,X		/YES -- IS IT FOR THE CORRECT  UNIT?
	SAD	UNIT
	SKP
	JMP	DO2		/NO -- PREPARE TO EXAMINE NEXT  ENTRY
/
/ SCAN THE TABLE FOR A MATCH ON THIS UFD
/ WE KNOW ITS ASSOCIATED WITH THE DISK
/
	LAC	(TAB-1		/YES -- PAREPARE TO SCAN TABLE
	DAC*	(X12
DO3	LAC*	X12		/IS TABLE ENTRY -1?
	SAD	(-1
	JMP	DO4		/YES -- PREPARE TO ENTER THIS UFD INTO TABLE
	SAD	TEMP1		/NO -- DOES IT MATCH THE ONE FOUND
	JMP	DO2		/YES -- ALREADY DONE
	JMP	DO3		/NO -- CONTINUE
/
/ THE UFD IS NO ALREADY IN THE TABLE SO ENTER IT
/
DO4	LAC*	(X12		/YES -- ENTER IT INTO TABLE
	AAC	-1
	DAC*	(X12
	LAC	TEMP1		/ENTER THE UFD
	DAC*	X12
/
/ PREPARE TO PRINT THE UFD NAME AND IT'S 1ST LUN
/
	LAC	(BUFF		/PREPARE TO PACK BUFFER
	JMS	IPACK
	LAC	(40		/PACK A SPACE
	JMS	PACK
	LAC	TEMP1		/DOES LUN-DISK COMBINATION HAVE A UFD?
	SZA
	JMP	DO7		/YES -- GO PRINT UFD NAME
	LAC	(116		/NO -- USE 'NONE' AS UFD NAME
	JMS	PACK
	LAC	(117
	JMS	PACK
	LAC	(116
	JMS	PACK
	LAC	(105
	JMS	PACK
	JMP	DO8
DO7	JMS	SIXPAK		/PACK THE UFD NAME
	TEMP1
DO8	LAC	(72		/PACK A :
	JMS	PACK
	LAC	(175		/PACK AN ALTM.
	JMS	PACK
	LAC	(BUFF		/PRINT UFD NAME
	JMS	TYPE
	LAC*	(X11		/PREPARE TO PRINT LUN NUMBER
	JMS	LUN		/PRINT IT
/
/ SO FAR WE'VE PRINTED " UFD:##"
/ NOW PREPARE TO PRINT ANY OTHER LUNS ASSOCIATED WITH THIS UFD
/
	LAC	TEMP		/SET COUNTER TO SCAN FROM HERE DOWN
	DAC	TEMP2
	LAC*	(X11		/SET POINTER FOR SCANNING
	DAC*	(X12
DO5	ISZ	TEMP2		/DONE WITH THIS PART OF SCAN?
	SKP
	JMP	DO6		/YES -- PREPARE TO END THE LINE
	LAC*	X12		/NO -- GET NEXT ENTRY
	SAD	TEMP1		/IS IT A MATCH?
	SKP
	JMP	DO5		/NO -- LOOK AT NEXT ONE
				/YES -- PREPARE TO PRINT LUN NUMBER
/
/ GET THE LUN
/
	LAC*	(LUFD1
	TCA
	TAD*	(X12		/NO AC HAS OFFSET FOR LUT LOOKUP
	TAD*	(LUTP1
	DAC	TEMP3
	LAC*	TEMP3		/TEMP3 NOW HAS PDVL NODE ADDR
	JMS	SETXR		/PREPARE TO ACCESS NODE
	LAC	2,X		/IS THIS OUR DISK?
	SAD	DEVNAM
	SKP
	JMP	DO5		/NO -- CONTINUE SCAN
	LAC	5,X		/YES -- DO UNITS MATCH?
	SAD	UNIT
	SKP
	JMP	DO5		/NO -- CONTINUE SCAN
	LAC	(MSGCOM		/YES -- PRINT A COMMA
	JMS	TYPE
	LAC*	(X12		/PAREPARE TO PRINT LUN NUMBER
	JMS	LUN		/GO PRINT IT
	JMP	DO5		/CONTINUE SCAN
/
/ THE SCANNING IS OVER FOR THIS UFD, SO END TH LINE
/
DO6	LAC	(MSGCR		/PRINT A CR
	JMS	TYPE
	JMP	DO2
	.EJECT
/
/
/
/ SUBROUTINE TYPE -- PRINT THE MESSAGE WHOSE ADDR. IS IN AC
/
/		RETURN AT JMS+1 UNCONDITIONALLY
/
/		ALL REGISTERS ARE ALTERED EXCEPT X11,X12, AND X10
/
TYPE	0
	DAC	TYPCPB+4	/PUT THE MESSAGE ADDR. IN CPB
	LAC*	(X10
	DAC	TX10
	LAC*	(X11
	DAC	TX11
	LAC*	(X12
	DAC	TX12
	CAL	TYPCPB		/PRINT THE MESSAGE
	CAL	TYPWF		/WAIT FOR COMPLETION
	LAC*	(MCRRI		/SHOULD THIS TYPE-OUT BE ABORTED?
	SAD	(-1
	SKP
	JMP	TYPE1		/NO
	LAC	(MSGCC		/YES -- PRINT CTRL C EXIT
	DAC	TYPCPB+4
	CAL	TYPCPB
	CAL	TYPWF
	JMP	EXITCR
TYPE1	LAC	TX10
	DAC*	(X10
	LAC	TX11
	DAC*	(X11
	LAC	TX12
	DAC*	(X12
	JMP*	TYPE		/RETURN
/
TYPWF	20
	TYPEV
/
TYPCPB	2700
	TYPEV
	TYPLUN
	2
	XX
/
TYPEV	0
/
/
/ SUBROUTINE PDNUM -- PRINT THE CONTENTS OF THE AC AS A DECIMAL INTEGER
/
/	ALL REGISTERS ARE ALTERED
/
/	RETURN AT JMS+1 UNCONDITIONALLY
/
PDNUM	0
	DAC	PDNV.1		/SAVE THE NUMBER
	LAW	-2		/SET UP DIVISION COUNTER
	DAC	PDNV.2
	DZM	PDNBUF+1	/ZERO THE CHECKSUM WORD IN BUFFER
	LAC	(PDNBUF+1	/SET UP X10 AS A POINTER TO THE BUFFER
	DAC*	(X14
	LAC	(PDNDIV-1	/SET UP X11 AS A POINTER TO DIVISION TABLE
	DAC*	(X15
PDN1	LAC*	X15		/GET THE NUMBER TO DIVIDE BY
	DAC	PDN2		/SAVE IT IN THE DIVISION AREA
	LAC	PDNV.1		/PICK UP THE NUMBER
	LMQ
	CLA!CLL
	DIV			/DIVIDE BY A POWER OF 10
PDN2	0
	DAC	PDNV.1		/SAVE THE REMAINDER
	LACQ			/GET THE QUOTIENT
	TAD	(60		/ADD 60(8) TO GET AN INTEGER
	DAC*	X14		/STORE ASCII IN BUFFER
	ISZ	PDNV.2		/CHECK THE DIV. COUNTER -- ARE WE DONE?
	JMP	PDN1		/NO -- DIVIDE AGAIN
	LAC	PDNV.1		/YES -- GET THE LAST DIGIT
	TAD	(60		/MAKE IT ASCII
	DAC*	X14		/SAVE IT IN THE BUFFER
	CAL	PDNWRT		/WRITE OUT THE BUFFER
	CAL	PDNWTF
	JMP*	PDNUM		/RETURN
/
PDNWRT	2700
	PDNV.1
	PDNLUN
	3
	PDNBUF
PDNWTF	20
	PDNV.1
PDNBUF	4000
	0
	.BLOCK 5
	175
/
PDNV.1	0
PDNV.2	0
PDNDIV=.
	.DEC
	100
	10
	.OCT
/
	.EJECT
/
/
/ SUBROUTINE SIXPAK -- PACK THE ASCII REPRESENTATION OF A NAME IN SIXBT
/                      INTO A 5/7 ASCII BUFFER VIA THE PACK SUBROUTINE.
/
/ EDIT #1		JUN 17, 1975		M. HEBENSTREIT
/
/ ENTER THIS SUBROUTINE WITH LOCATION JMS+1 POINTING AT THE NAME
/ AND THE OUPUT BUFFER INITIALIZED FOR CHARACTER PACKING (VIA IPACK)
/
/ RETURN AT JMS+2 UNCONDITIONALLY
/
/ MODIFIED REGISTERS: AC, AND THOSE CHANGED BY PACK
/
SIXPAK	0
	LAC*	SIXPAK		/GET THE PTR TO THE NAME
	DAC	SIXT0		/SAVE IT
SIXP0	LAW	-3		/SET UP THE CHAR/WD COUNTER
	DAC	SIXT1
	LAC*	SIXT0		/GET 1/2 OF THE NAME
	LMQ			/ENTER INTO MQ FOR SHIFTING
SIXP1	CLA			/CLEAR OUT GARBAGE FROM AC
	LLS	6		/SHIFT A CHAR INTO AC
	AAC	-40		/CONVERT IT INTO ASCII
	SPA
	AAC	+100
	AAC	+40
	JMS	PACK		/PACK THE CHAR INTO ASCII BUFFER
	ISZ	SIXT1		/DONE WITH THIS 1/2 OF NAME?
	JMP	SIXP1		/NO -- GO CONVERT ANOTHER CHAR
	IDX	SIXPAK		/RETURN AT JMS+2
	JMP*	SIXPAK
/
SIXT0	0			/POINTER TO NAME IN SIXBT
SIXT1	0			/CHAR/WD COUNTER
/
	.EJECT
/
/ EDIT #1 	APRIL 8, 1974		M. HEBENSTREIT
/
/ THE STANDARD DOS-15 PACKING SUBROUTINES
/ ENTRY TO IPACK WITH AC=BUFFER ADDRESS
/ ENTRY TO PACK WITH AC=CHARACTER
/
/ THIS PAIR OF SUBROUTINES WILL SET UP THE HEADER WORD PAIR AS WELL
/ AS PACK CHARACTERS INTO THE BUFFER.
/
/
SHAL=660000
/
IPACK	0
	DAC	KLBUFH
	AAC	-1
	DAC*	(X13
	LAW	-OBSIZ
	DAC	IPKTMP
	DZM*	X13
	ISZ	IPKTMP
	JMP	.-2
	LAC	KLBUFH
	TAD	L2
	DAC	KLPUTP
	DZM	KL57
	DZM	CHRCNT
	LAC	(1000
	DAC*	KLBUFH
	JMP*	IPACK
/
PACK	0
	ISZ	CHRCNT
	AND	L177
	DAC	KLCHR2
	CLL
	LAC	KL57
	TAD	(JMP*	KLJ57
	DAC	.+2
	LAC	KLCHR2
	XX
KLJ57	KL571
	KL572
	KL573
	KL574
	KL575
KL571	PAX
	LAC	(1000
	TAD*	KLBUFH
	DAC*	KLBUFH
	PXA
	ALS!SHAL	13
KL571A	DZM*	KLPUTP
	JMP	KLND57
KL572	ALS!SHAL	4
	JMP	KLND57
KL573	RTR
	RAR
	AND	L17
	XOR*	KLPUTP
	DAC*	KLPUTP
	ISZ	KLPUTP
	LAC	KLCHR2
	ALS!SHAL	17
	JMP	KL571A
KL574	ALS!SHAL	10
	JMP	KLND57
KL575	RCL
	DZM	KL57
	SKP
KLND57	ISZ	KL57
	XOR*	KLPUTP
	DAC*	KLPUTP
	LAC	KL57
	SNA
	ISZ	KLPUTP
	LAC	KLCHR2
	JMP*	PACK
/
KL57	0
KLPUTP	0
KLBUFH	0
KLCHR2	0
CHRCNT	0
L2	2
L177	177
L17	17
IPKTMP	0
/
	.EJECT
/
/ SUBROUTINE LUN -- PRINT LUN NUMBER FOR A UFD
/
/ ENTER WITH AC=ADDR IN LUN-UFD TABLE
/ RETURN AT JMS+1
/ ALL REGISTERS ARE CHANGED EXCEPT X10,X11, AND X12
/
LUN	0
	DAC	LUNTMP		/SAVE THE AC
	LAC*	(X10		/SAVE AUTO INCR REGS
	DAC	TX10
	LAC*	(X11
	DAC	TX11
	LAC*	(X12
	DAC	TX12
	LAC*	(LUFD1
	TCA
	TAD	LUNTMP
	IAC
	JMS	PDNUM
	LAC	TX10		/RESTORE REG
	DAC*	(X10
	LAC	TX11
	DAC*	(X11
	LAC	TX12
	DAC*	(X12
	JMP*	LUN
/
LUNTMP	0
TX10	0
TX11	0
TX12	0
/
	.EJECT
MSGDEF	MSGNON-MSGDEF/2*1000
	0
	.ASCII "DEFAULT UFD: "<175>
MSGNON	MSGCOM-MSGNON/2*1000
	0
	.ASCII "NONE"<15>
MSGCOM	MSGCR-MSGCOM/2*1000
	0
	.ASCII ","<175>
MSGCR	MSGCC-MSGCR/2*1000
	0
	.ASCII " "<15>
MSGCC	MSGEND-MSGCC/2*1000
	0
	.ASCII	"CTRL/C EXIT"<15>
MSGEND=.
/
	.END
