Google
 

Trailing-Edge - PDP-10 Archives - bb-bt99r-bb - fsxkon.x24
There are no other files named fsxkon.x24 in the archive.
TITLE	FSXKON - RS04 (FAST SWAPPING DISK) DRIVER V064
SUBTTL	T WACHS/TW/JBS  25 JULY 89

	SEARCH	F,S,DEVPRM,SAXPRM
	$RELOC
	$HIGH


;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED
;  OR COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION
; 1973,1974,1975,1976,1977,1978,1979,1980,1982,1984,1986,1988.
;ALL RIGHTS RESERVED.

.CPYRT<1973,1988>


XP VFXKON,064

FSXKON::ENTRY	FSXKON
	SUBTTL	AUTOCONFIGURATION TABLES

FSFIX==400000			;BIT 0=1 SINCE FIXED HEAD DISK
FSOFS==400000			;NO OFFSET CAPABILITY
FSRDC==400000			;NO 10/11 COMPATABILITY MODE
FSUNL==400000			;NO UNLOAD CAPABILITY
FSCPY==0			;CAN TELL UNIT TYPE EVEN IF KONTROL IS BUSY
FSMX==0				;CANNOT DO MULTI TRANSFERS
FSDRB==0			;DOESN'T USE DISK I/O REQUEST BLOCKS
FSBMX==0			;NOT A BLOCK MULTIPLEX KONTROLLER
FSECA==0			;TRY OFFSET/RECAL BEFORE TRYING ECC
FSERNO==^D8			;8 DRIVE REGISTERS TO SAVE ON ERROR
FSXELG==MDEELG##		;ERROR LOG ROUTINE IS IN FILIO

FSXDMX==10			;MAXIMUM DRIVES PER KONTROLLER
FSXHDN==FSXDMX-1		;HIGHEST DRIVE NUMBER ON KONTROLLER

;DRIVER CHARACTERISTICS
;	FSX	= FSXCNF
;	DSK	= DISK
;	0	= MAXIMUM DEVICES IN SYSTEM (NO LIMIT)
;	TYPFS	= KONTROLLER TYPE
;	FSXDMX	= MAXIMUM DRIVES PER KONTROLLER
;	FSXHDN	= HIGHEST DRIVE NUMBER ON KONTROLLER
;	MDSEC0	= SECTION FOR KDB/UDB
;	MDSEC0	= SECTION FOR DDB
DRVCHR	(FSX,DSK,0,TYPFS,FSXDMX,FSXHDN,MDSEC0,MDSEC0,DR.MCD)

	.ORG	KONUDB		;START OF RS04/RS05 SPECIFIC DATA
FSXUTB:!BLOCK	FSXDMX		;TABLE OF POINTERS TO UDBS
FSXEBK:!BLOCK	FSERNO		;STORAGE FOR ERROR REGISTERS
FSXIOB:!			;START OF SPECIAL I/O INSTRUCTIONS
FSXCO4:!BLOCK	1
FSXCI2:!BLOCK	1
FSXCO2:!BLOCK	1
FSXDI3:!BLOCK	1
FSXDO3:!BLOCK	1
FSXDO4:!BLOCK	1
FSXIOE:!
FSXFNC:!BLOCK	1		;CURRENT FUNCTION AND FLAGS
FSXIUM:! BLOCK	FSXDMW		;IGNORE DRIVE MASK
FSXNUM:! BLOCK	FSXDMW		;NEW DRIVE MASK
FSXKLN:!			;LENGTH OF KDB
	.ORG

;PROTOTYPE KDB
FSXKDB:	XXKON	(FS)
	SETWRD	(FSXCO4,<CONO	000,(T4)>)
	SETWRD	(FSXCI2,<CONI	000,T2>)
	SETWRD	(FSXCO2,<CONO	000,(T2)>)
	SETWRD	(FSXDI3,<DATAI	000,T3>)
	SETWRD	(FSXDO3,<DATAO	000,T3>)
	SETWRD	(FSXDO4,<DATAO	000,T4>)
	KDBEND

EQUATE	(LOCAL,0,<FSXULP,FSXULB>)
EQUATE	(LOCAL,CPOPJ##,<FSXALV,FSXCCM,FSXEDL,FSXHWP,FSXINI,FSXRLD>)

	FSXICD==DSKICD##	;PROTOTYPE INTERRUPT CODE
	FSXICL==DSKICL##

	FSXUDB==0		;NO PROTOTYPE UDB
	FSXULN==UNIEBK+FSERNO	;LENGTH OF UDB

FSXDSP:	DRVDSP	(FSX,DSKCHN##,DSKDDB##,DDBLEN##,DSKDIA##)

;DEFAULT MONGEN'ED DEVICE TABLE

DEFMDT:	MDKL10	(7,270,0,0,<MD.KON>)	;RH10 DEVICE CODE 270
	MDKL10	(7,274,0,0,<MD.KON>)	;RH10 DEVICE CODE 274
	MDKL10	(7,360,0,0,<MD.KON>)	;RH10 DEVICE CODE 360
	MDTERM				;TERMINATE TABLE

FSXCKT:	EXP	0			;COMPATIBLE KONTROLLER TABLE
	SUBTTL	DEFINITIONS


;INTERESTING DEFINITIONS:
;DATAO'S
LR==4000		;LOAD REGISTER
DODA==050000		;DESIRED ADDRESS
DOLA==070000		;LOOK-AHEAD REGISTER (SECTOR COUNTER)
DOCR==400000		;CONTROL REGISTER
DOER==020000		;ERROR REGISTER
DODB==500000		;DATA BUFFER REGISTER
DORA==540000		;REGISTER ACCESS ERROR

;DATAI BITS
DIERRS==003600
CBTO==2000		;CONTROL BUS TIME OUT
DCK==100000		;DATA CHECK BIT IN ERROR REGISTER


;CONI/CONO BITS
CHNPAR==6		;(LH) CHAN-DETECTED PARITY ERR
CHNNXM==1		;(LH) CHAN-DETECTED NXM
CHANER==120000		;CHAN ERR OR OVERRUN
OVERUN==20000
ALLERR==736360		;ALL CONI ERR BITS (RH)
ILC==4000		;ILLEGAL COMMAND (ILFNC OR SDRAE)
DRVERR==600,,436300	;DRIVE OR CONTROLLER ERROR

DONBIT==10		;DONE 
STPBIT==20		;STOP THE UNIT BIT (CONO)
BSYBIT==20		;BUSY
ILFC==400		;ILLEGAL FUNCTION
SDRAE==200		;SELECTED DRIVE REG ACCESS ERROR (LH)
CI.PWF==2000		;CONI FOR POWERFAIL
CO.MBI==2000		;CONO FOR POWERFAIL


FSALCL==734200		;CLEAR ALL ERRORS

;DATAO BITS
DXES==200000		;DISABLE STOP ON ERROR
FNCCLR==11		;DRIVE CLEAR

FNCRED==71
FNCWRT==61

DEFINE STALL,<
XLIST
IFN FTKL10,<
	IMULI	P,1
	IMULI	P,1
>
LIST
>

FSXRDF:
FSXRDC:
FSXRED:	SKIPA	T1,[FNCRED]	;READ
FSXWTF:
FSXWTC:
FSXWRT:	MOVEI	T1,FNCWRT	;WRITE
	TRO	T1,DXES		;DISABLE STOP ON ERR
	JRST	FSXGO
FSXRDS:	SKIPA	T1,[FNCRED]	;READ
FSXWTS:	MOVEI	T1,FNCWRT	;WRITE
FSXGO:	XCT	FSXCI2(J)	;CONI FSN,T2
	TLNN	T2,ILFC
	TRNE	T2,ALLERR-ILC	;ANY ERROR (INCLUDING BUSY)?
	JRST	NOSTR2		;YES, YOU LOSE
	TLNN	T2,SDRAE	;REG ACCESS ERR?
	JRST	FSXGO1		;NO
	MOVE	T3,UDBPDN(U)	;PHYSICAL DRIVE NUMBER
	MOVEI	T4,1		;POSITION A BIT FOR CONTROLLER DATAO
	LSH	T4,(T3)
	MOVSI	T3,LR(T3)	;SELECT DRIVE CNTRL REG
	HRRI	T3,FNCCLR	;CLEAR THE DRIVE
	XCT	FSXDO3(J)	;ZAP!
	MOVSI	T3,DORA+LR	;SET TO CLEAR RAE IN CONTROLLER
	HRR	T3,T4		;WHICH BIT
	XCT	FSXDO3(J)	;ZAP
FSXGO1:	MOVE	T2,UDBPDN(U)	;GET PHYSICAL DRIVE NUMBER
	MOVE	T3,UNIBLK(U)	;DESIRED BLOCK
	LSH	T3,1		;*2=SECTOR
	HRLI	T3,DODA+LR(T2)	;SET TO DATAO DESIRED ADDRESS
	XCT	FSXDO3(J)	;SET DESIRED BLOCK
	STALL
	XCT	FSXDI3(J)	;READ STATUS
	TLNE	T3,DIERRS	;DRIVE OK?
	JRST	NOSTRT		;NO, YOU LOSE
	MOVE	T3,KDBICP(J)	;YES, GET ICWA
	LSH	T3,6		;POSITION IT
	TRO	T3,(T1)		;+ FUNCTION
	HRLI	T3,DOCR+LR(T2)	;DATAO CONTROL REGISTER
	MOVEM	T3,FSXFNC(J)	;SAVE FUNCTION
	MOVEM	T3,UNILAS(U)	;SAVE LAST DATAO TO THE DRIVE
	XCT	FSXDO3(J)	;START DRIVE GOING
	MOVEI	T4,DSKCHN##	;SET PI IN RH10
	XCT	FSXCO4(J)	;CONO FSN,(T4)
	PJRST	CPOPJ1##	;AND TAKE SKIP-RETURN
;HERE IF DRIVE ISN'T READY
NOSTRT:	TLNN	T3,CBTO		;DRIVE THERE?
NOSTR2:	TDZA	T1,T1		;YES
	MOVEI	T1,KOPOFL	;NO
	MOVSI	T3,DOCR		;CNTRL REGISTER DATAI BITS
	XCT	FSXDO3(J)	; RETURNED IN T3 ON UNIT NOT READY
	STALL
	XCT	FSXDI3(J)
	XCT	FSXCI2(J)	;CONI BITS IN T2
	POPJ	P,		;NON-SKIP RETURN

FSXREG:	PUSH	P,U		;RDREG WIPES U
	PUSHJ	P,RDREG		;READ ALL DRIVE REGS
	PJRST	UPOPJ##		;RESTORE U AND RETURN
FSXPOS:	STOPCD	CPOPJ1##,DEBUG,RDP, ;++RS04 DOESNT POSITION
FSXUNL:
FSXERR:
FSXECC:	STOPCD	CPOPJ1##,DEBUG,RS04IF,	;++RS04 ISNT FANCY

FSXRCL:	POPJ	P,		;NO RECAL

FSXLTM:	MOVE	T2,UDBPDN(U)	;PHYSICAL DRIVE NUMBER
	MOVSI	T3,DOLA+LR(T2)	;DATAO LOOK-AHEAD REGISTER
	XCT	FSXDO3(J)
	STALL
	XCT	FSXDI3(J)	;READ STATUS
	TLNE	T3,DIERRS	;DRIVE OK?
	POPJ	P,		;NO, NON-SKIP
	LDB	T2,[POINT 6,T3,29]	;YES, GET SECTOR COUNTER
	LSH	T1,1		;CONVERT TO BLOCK NUMBER
	ANDI	T1,77		;STRIP NON-SECTOR STUFF FROM DESIRED BLOCK
	SUBI	T1,3(T2)	;FUDGE-FACTOR = 3 SECTORS
	SKIPGE	T1
	ADDI	T1,^D64		;ADD 1 REVOLUTION IF NEGATIVE
	IMULI	T1,^D240	;PER 64-WORD SECTOR
		;IF WE WANT TO GET FANCY,
		; CAN ADD THE WORD-TIMES IN TOO
		; BUT ITS PROBABLY A BAD IDEA SINCE WILL
		; NEVER EXACTLY GET A 0 TIME
;	ADD	T1,T3
	PJRST	CPOPJ1##	;TAKE GOOD RETURN

;HERE TO TRY AND STOP THE UNIT
FSXSTP:	MOVE	T3,UDBPDN(U)	;PHYSICAL DRIVE NUMBER
	MOVSI	T3,DOER(T3)	;SET TO READ ERROR REG
	XCT	FSXDO3(J)	;DATAO ERROR REGISTER
	STALL
	XCT	FSXDI3(J)	;(BEFORE) ERROR STATUS
	XCT	FSXCI2(J)	;(BEFORE) CONI STATUS
	PUSH	P,T2		;SAVE CONI STATUS
	MOVEI	T2,STPBIT	;TRY TO STOP DRIVE
	XCT	FSXCO2(J)	;ZAP
	XCT	FSXCI2(J)
	TRNN	T2,BSYBIT	;DID IT STOP?
	AOS	-1(P)		;YES, SKIP-RETURN
	PJRST	T2POPJ##	;RESTORE CONI STATUS AND RETURN
;HERE ON AN INTERRUPT
FSXINT:	MOVE	W,J		;SET UP KDB ADDRESS
	PUSHJ	P,SVMBR##	;SAVE CURRENT MBR FOR UUO LEVEL
	XCT	FSXCI2(J)	;READ STATUS
	MOVSI	T3,DOCR		;SET TO DATAO CONTROL REG
	XCT	FSXDO3(J)
	STALL
	XCT	FSXDI3(J)	;READ CNTRL REG
	MOVE	T4,T3		;SAVE IT
	TLO	T3,LR
	XCT	FSXCI2(J)	;CONI FH'N,T2
	MOVEI	T1,0
	CAME	T3,FSXFNC(J)	;RIGHT DATA IN CNTRL REG?
	TRO	T1,IODERR	;OOPS!
	ANDI	T3,77		;GET FUNCTION
	CAIN	T3,FNCWRT	;WRITE?
	TRO	T1,OPWRT	;YES (OPRED=0)
	MOVE	T3,FSXFNC(J)	;FUNCTION AGAIN
	HLL	T1,T3		;UNIT TO T1
	TLZ	T1,777770	;NO ATTENTIONS

	TRNN	T2,ALLERR	;ERROR?
	JRST	DISMIS		;NO
	TDNE	T2,[EXP DRVERR]	;YES, DRIVE/CONTROLLER ERROR?
	TRO	T1,IODERR	;YES
	TRNN	T2,CHANER	;CHAN ERR?
	JRST	DISMIS		;NO
	TRNE	T2,OVERUN	;YES, OVERRUN?
	TRO	T1,IOVRUN+IODERR	;YES
	TLNE	T2,CHNPAR	;CHAN ERR OR OVERRUN
	TRO	T1,IOCHMP+IODERR	;CORE PARITY ERROR
	TLNE	T2,CHNNXM
	TRO	T1,IOCHMP+IODERR	;MEMORY PARITY ERROR
DISMIS:	MOVE	U,KONCUA(J)	;UNITDB
	MOVE	T3,UDBPDN(U)	;PHYSICAL DRIVE NUMBER
	MOVSI	T3,DOER(T3)
	XCT	FSXDO3(J)	;READ IT
	STALL
	XCT	FSXDI3(J)
	TRNE	T3,DCK		;DATA CHECK?
	TRO	T1,IODTER	;YES, LIGHT A BIT
	HRL	T3,T4		;RETURN CNTRL REG,,ERROR REG DATAI'S
	TRNE	T1,IODERR!IODTER	;ERROR?
	PUSHJ	P,RDREG

	TRNN	T2,CI.PWF	;POWERFAIL BIT LIT ?
	JRST	FINSH1		;NO, CONTINUE
	MOVEI	T4,CO.MBI	;YES, SETUP T4 FOR MASSBUS INIT
	XCT	FSXCO4(J)	;DO THE INIT
FINSH1:	MOVEI	T4,FSALCL+DONBIT-ILC	;CLEAR ALL ERRORS AND DONE (LEAVE SDRAE)
	XCT	FSXCO4(J)
	MOVE	T4,UDBPDN(U)	;PHYSICAL DRIVE NUMBER
	MOVSI	T4,LR(T4)	;SET TO CLEAR THE DRIVE
	HRRI	T4,FNCCLR
	XCT	FSXDO4(J)	;ZAP
	PJRST	FILINT##	;GO TELL FILSER
RDREG:	PUSH	P,F
	PUSH	P,T3
	MOVE	T4,UDBPDN(U)	;PHYSICAL DRIVE NUMBER
	MOVE	U,KONREG(J)
	MOVEI	F,FSXEBK(J)	; AND SAVE IN KONTROLLER DB
	ADDI	F,-1(U)
ERRSUM:	MOVSI	T3,-1(U)
	LSH	T3,^D12		;REGISTER NUMBER
	TLO	T3,(T4)		;DRIVE NO
	XCT	FSXDO3(J)
	STALL
	XCT	FSXDI3(J)	;READ THE REGISTER
	MOVEM	T3,(F)		;SAVE
	SUBI	F,1
	SOJG	U,ERRSUM	;AND READ THE NEXT
	MOVSI	T3,DOCR		;READ RH10 CONTROL REG
	XCT	FSXDO3(J)
	XCT	FSXDI3(J)
	MOVEM	T3,KONECR(J)	; AND STORE IN KDB
	MOVSI	T3,DODB		;READ DATA BUFFER
	XCT	FSXDO3(J)
	XCT	FSXDI3(J)
	MOVEM	T3,KONEDB(J)	; AND STORE IN KDB
	POP	P,T3		;RESTORE T3
	MOVE	U,KONCUA(J)	;RESTORE U
	JRST	FPOPJ##
;HERE TO CHECK CAPACITY & STATUS OF RH10/RS04, RS05
FSXCPY:	MOVE	T3,UDBPDN(U)	;PHYSICAL DRIVE NUMBER
	MOVSI	T3,060000(T3)	;SET TO DATAO DRIVE-TYPE REGISTER
	XCT	FSXDO3(J)
	STALL
	XCT	FSXDI3(J)	;READ DRIVE TYPE (& STATUS)
	TLNE	T3,2000		;CONTROL BUS TIMEOUT?
	JRST	FSXCP1		;YES, THE UNIT ISNT THERE
	ANDI	T3,TR.TYP	;GET UNIT TYPE
	CAIE	T3,TY.RS4
	CAIN	T3,TY.RS5	;SOME FLAVOR OF RS04?
	TDZA	T4,T4		;YES, OK. UNIT TYPE = RS04
				;(NO DISTINCTION BETWEEN RS04 AND RS05)
	JRST	FSXCP1		;NO, PRETEND ITS DOWN
	MOVEI	T1,^D2048	;BLOCKS PER UNIT
	MOVE	T2,T1		;BLOCKS PER CYLINDER
	SETZ	T3,		;NO COMPATABILITY MODE
	MOVE	W,[^D32,,^D2048]	;BLKS PER TRK,,BLKS PER CYL
	PJRST	CPOPJ1##	;TAKE GOOD RETURN


;HERE ON CONTROL BUS TIMEOUT
FSXCP1:	MOVSI	T4,KOPUHE	;OFF LINE OR DOWN
	TLO	T4,KOPNSU	;NO SUCH UNIT
	POPJ	P,
	$INIT

;CHECK FOR KONTROLLER UP
FSXUPA:	MOVEI	T4,FSALCL+DSKCHN## ;CLEAR ALL ERROR BITS
	XCT	FSXCO4(J)	;CONO FSX,(T4)
	XCT	FSXCI2(J)	;CONI FSX,T2
	TRNN	T2,2030		;PS FAIL, BUSY OR DONE UP?
	TRNN	T2,7		;NO, PI UP?
	POPJ	P,		;DOWN
	PJSP	T1,CPOPJ1##	;UP, SET T1 NON-0 (WH LOCKOUT), AND RETURN

	$HIGH
	SUBTTL	AUTOCONFIGURATION

;ENTERED WITH DEVICE CODE/4 IN T1, AND CONI DEV, IN T2

FSXCFG:	TLNE	T2,(SI.SAX!CI.PPT) ;WEED OUT SA10 OR IPA CHANNEL
	JRST	CPOPJ1##	;SORRY, I'M NOT INTERESTED
	XMOVEI	T1,FSXMDT##	;MONGEN'ED DEVICE TABLE
	XMOVEI	T2,DEFMDT	;DEFAULT TABLE
	MOVSI	T3,-1		;MATCH ON ANY MASSBUS UNIT
	MOVEI	T4,MD.KON	;MATCH ON KONTROLLER DEFINITION
	PUSHJ	P,AUTMDT##	;SCAN THE TABLES
	  JRST	CPOPJ1##	;NO MATCHES
	XCT	.CPCNI##	;GET CONI ,T1
	TLNN	T1,4000		;CHECK FOR DF10 OR DF10C IN 18-BIT MODE
	JRST	AUTEBD##	;18-BIT DF10/DF10C, INFORM OF ERROR AND RETURN
	MOVSI	T1,0		;GET CHANNEL TYPE BITS FOR RH10
	PUSHJ	P,AUTCHN##	;BUILD A CHANNEL DATA BLOCK
	  POPJ	P,		;NO CORE
	PUSHJ	P,SAVE1##	;FREE UP P1
	SETZB	J,P1		;NO KDB YET, START WITH MASSBUS UNIT 0

FSXCF1:	PUSHJ	P,FSXUNI	;CONFIGURE A SINGLE UNIT
	  JFCL			;IGNORE ERRORS
	AOBJN	P1,.+1		;ADVANCE TO NEXT UNIT
	HLLZS	P1		;KEEP JUST MASSBUS UNIT NUMBER
	TLNN	P1,10		;DONE THEM ALL?
	JRST	FSXCF1		;NO, DO ANOTHER
	POPJ	P,		;ALL DONE
;HERE TO CONFIGURE A SINGLE NEW UNIT

FSXUNI:	JUMPE	J,FSXUN1	;SKIP TEST IF NO KDB YET
	HLRZ	T1,P1		;GET UNIT
	MOVE	T1,BITTBL##(T1)	;AND IT'S BIT
	TDNE	T1,FSXIUM(J)	;WANT TO IGNORE THIS DRIVE?
	POPJ	P,		;SAY IT DOESN'T EXIST
FSXUN1:	MOVE	W,J		;AUTCON WANTS W SET UP
	PUSHJ	P,RDDTR##	;READ DRIVE TYPE REGISTER
	CAIE	T2,TY.RS4	;SOME TYPE OF RS04?
	CAIN	T2,TY.RS5
	TDZA	T2,T2		;YES, NO DISTINCTION BETWEEN RS04 AND RS05
	JRST	FSXUN3		;UNKNOWN UNIT TYPE
	TLO	T2,(1B0)	;INDICATE IT'S A NON-REMOVABLE MEDIA DRIVE
	HLLZ	T1,P1		;COPY UNIT NUMBER
	HLRS	T1		;ALSO USE AS UDB TABLE OFFSET
	JUMPN	J,FSXUN2	;IF WE ALREADY HAVE A KDB, PROCEED
	PUSH	P,T1		;SAVE THE USEFUL ACS
	PUSH	P,T2
	MOVNI	T1,1		;NO MASSBUS UNIT NUMBER
	MOVEI	T2,TYPFS	;KONTROLLER TYPE CODE
	PUSHJ	P,DSKKON##	;BUILD A KONTROLLER DATA BLOCK
	  JRST	TTPOPJ##	;NO CORE
	MOVSI	T1,-<FSXIOE-FSXIOB> ;NUMBER OF WORDS TO CHECK
	XMOVEI	T2,FSXIOB(J)	;STARTING WORD
	HRRZ	T3,.CPDVC##	;<DEVICE CODE>/4
	PUSHJ	P,AUTDVC##	;SET DEVICE CODES
				;*** NEED SYMBOL - CBOV, RAE, ATTN, DONE
	MOVEI	T1,350		;GET INTERRUPT FLAGS FOR RH10
	MOVE	T2,KDBCSO(J)	;GET ADDRESS OF CONSO SKIP CHAIN
	HRRM	T1,DICDIF##(T2)	;SET CORRECT INTERRUPT FLAGS
	POP	P,T2		;RESTORE THE ACS
	POP	P,T1
FSXUN2:	PUSHJ	P,DSKDRV##	;BUILD AND LINK THE UDB
	  JRST	FSXUN3		;NO CORE
	MOVSI	T2,(.DISNR)	;READ SERIAL NUMBER REGISTER
	PUSHJ	P,RDMBR##
	SETZ	T1,		;REALLY A ONE-WORD QUANTITY
	MOVE	T3,UDBPDN(U)	;GET PHYSICAL DRIVE NUMBER
	PUSHJ	P,AUTDSN##	;FAKE UP S/N IF A ZERO
	DMOVEM	T1,UDBDSN(U)	;SET SERIAL NUMBER IN UDB
	JRST	CPOPJ1##	;RETURN

FSXUN3:	SETZ	U,		;INDICATE NO UDB
	POPJ	P,		;RETURN
;ONCE A SECOND CODE
FSXSEC:	SKIPL	@KDBCHN(J)	;CHANNEL BUSY?
	POPJ	P,		;LEAVE IT ALONE
	SKIPE	T1,FSXNUM(J)	;GET BIT MASK
	JFFO	T1,FSXSE1	;FIND FIRST UNIT NUMBER
	HRRZS	KDBNUM(J)	;INDICATE NO DRIVES TO CONFIGURE
	POPJ	P,		;DONE
FSXSE1:	PUSHJ	P,AUTLOK##	;GET AUTCON INTERLOCK
	  POPJ	P,		;TRY AGAIN NEXT TIME
	PUSHJ	P,SAVW##	;PRESERVE W
	MOVE	W,J		;COPY KDB ADDRESS TO W FOR AUTCON
	MOVSS	T2		;MASSBUS UNIT = DRIVE NUMBER FOR FSX DISKS
	PUSH	P,T2		;SAVE
	MOVE	T1,KDBDVC(J)	;DEVICE CODE
	XMOVEI	T2,FSXDSP	;DISPATCH
	MOVE	T3,KDBCHN(J)	;CHANNEL DATA BLOCK
	PUSHJ	P,AUTSET##	;SET UP CPU VARIABLES
	EXCH	P1,(P)		;SAVE P1, GET MASSBUS UNIT
	PUSH	P,KDBUNI(J)	;SAVE KDBUNI
	MOVEM	P1,KDBUNI(J)	;SET FOR THIS MASSBUS UNIT NUMBER (FOR RDMBR)
	PUSHJ	P,FSXUNI	;CONFIGURE A NEW UNIT
	  JFCL			;IGNORE ERRORS
	PUSHJ	P,AUTULK##	;RELEASE AUTCON INTERLOCK
	POP	P,KDBUNI(J)	;RESTORE KDBUNI
	PJRST	P1POPJ##	;RESTORE P1 AND RETURN
	END