Google
 

Trailing-Edge - PDP-10 Archives - bb-x130a-sb - fsxkon.mac
There are 11 other files named fsxkon.mac in the archive. Click here to see a list.
TITLE	FSXKON - RS04 (FAST SWAPPING DISK) DRIVER V040
SUBTTL T WACHS/TW/JBS  22 FEB 83
	SEARCH	F,S
	$RELOC
	$HIGH



;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
.CPYRT<
COPYRIGHT (C) 1973,1974,1975,1976,1977,1978,1979,1980,1982,1984 BY DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
>


;DATE		LOAD	EDIT #
;____		____	______

;19-AUG-80	70112	035
;9346
;07-APR-81	70150	036
;12-JAN-82	70126	037
;22-FEB-83	70126	040
;
;
;
XP VFXKON,040

;ASSEMBLY INSTRUCTIONS - FSXKON,FSXKON/C_F,S,KONPAR,FSXKON


;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 FTKI10,<
	IMULI	P,1		;THIS IS QUICK ON KL
>
IFN FTKL10,<
	IMULI	P,1
	IMULI	P,1
>
LIST
>

	ENTRY	FSXKON
FSXKON::
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
	LDB	T3,UNYPUN##	;YES, GET UNIT
	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:	LDB	T2,UNYPUN##	;NO, GET UNIT
	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,KONIOC##(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
	LDB	T4,KOYPI##	;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,4IF,	;++RS04 ISNT FANCY

FSXRCL::POPJ	P,		;NO RECAL

FSXLTM::LDB	T2,UNYPUN##	;UNIT 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::LDB	T3,UNYPUN##	;UNIT 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::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
	TLNE	T2,4000		;22-BIT CHAN?
	TLO	T4,KOP22B##	;YES

	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
	LDB	T3,UNYPUN##	;SET TO READ ERROR REGISTER
	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)
	LDB	T4,UNYPUN##	;UNIT
	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
	LDB	T4,UNYPUN##
	MOVE	U,KONREG##(J)
	MOVEI	F,KONEBK##(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##
IFN FTDHIA,<
;HERE TO CHECK CAPACITY & STATUS OF RH10/RS04, RS05
FSXCPY::LDB	T3,UNYPUN##	;UNIT 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,777		;NO, GET UNIT TYPE
	CAIE	T3,2
	CAIN	T3,3		;SOME FLAVOR OF RS04?
	TDZA	T4,T4		;YES, OK. UNIT TYPE = RS04
	JRST	FSXCP1		;NO, PRETEND ITS DOWN
	XCT	FSXCI2##(J)	;CONI
	TLNE	T2,4000		;DF10 IN KI MODE?
	TLO	T4,KOP22B##	;YES, TELL FILSER

	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
IFN FTDUAL,<
	HRRZS	J		;NO SERIAL NUMBER
>
	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,
>	;END FTDHIA
	END