/1 RK8 DRIVER FOR RTS8 V2B			8/30/74
	XLIST	1
/
/
/
/
/
/
/
/
/
/COPYRIGHT  (C)  1974,1975,1976 BY DIGITAL EQUIPMENT CORPORATION
/
/
/
/
/
/
/
/
/
/
/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 RESPONSIBILITY
/FOR ANY ERRORS THAT MAY APPEAR IN THIS DOCUMENT.
/
/THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FURNISHED 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 PROVIDED IN WRITING BY DIGITAL.
/
/DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY FOR THE USE
/OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY
/DIGITAL.
/
/
/
/
/
/
/
/
/
/
	XLIST	0
	VERS=	1
/ACCEPTS STANDARD MASS-STORAGE MESSAGE FORMAT

TASK=	RK8
INIWT=	0
CUR=	0

DLDC=	6732
DLCA=	6755
DLWC=	6753
DLDR=	6733
DSKD=	6745
DSKE=	6747
DCLS=	6742
DRDS=	6741
DRDA=	6734
DCLA=	6751

	FIELD	CUR%10
	*4200
TMP,
START,	CAL
DONEFG,	SKPINS
TRYCT,	INTRPT

LOOP,	CAL
	RECEIV		/GET A MESSAGE
ADDR,	0
	DCA	FLD
	ISZ	DONEFG	/INITIALIZE EVENT FLAG
	STA
DOAGIN,	TAD	ADDR
	IOF
	JMS	INIT	/START UP THE OLE DISK
	TAD	(FSTINT
	DCA	IDISP	/INITIALIZE INTERRUPT DISPATCH
	AC7775
	ION
	DCA	TRYCT	/TRY 3 TIMES
	CAL
	WAITE
PDONFG,	DONEFG		/WAIT FOR COMPLETION
	TAD	DONEFG
	SNA CLA
	JMP	NOPFAL	/IF EVENT FLAG STILL NON-ZERO, WE
	TAD	(-4	/MUST HAVE HAD A POWER FAILURE
	JMP	DOAGIN
NOPFAL,	JMS	GET	/THIS JUST SETS THE DF AND ADDR
P7600,	7600
	TAD	STATUS
	DCA  I	ADDR
	TAD	FLD
	DCA	PFLD
	TAD	ADDR
	TAD	(-7	/GET POINTER TO MESSAGE EVENT FLAG
	CAL
	POST
STATUS,
PFLD,	HLT
	JMP	LOOP	/GET ANOTHER MESSAGE

GET,	0
FLD,	HLT
	ISZ	ADDR
	TAD I	ADDR
	JMP I	GET
/RK8 STARTUP SUBROUTINE - CALLED WITH IOF
INIT,	0
	DCA	ADDR	/ADDRESS OF PARAMETER BLOCK -1 IN AC
	DCLS		/CLEAR DISK STATUS
	JMS	GET
	CLL RAL		/GET 2*UNIT NUMBER
	AND	(7
	DCA	TMP
	ISZ	ADDR	/GET OS/8 STYLE I/O CONTROL WORD
	TAD I	ADDR
	AND	(70	/EXTRACT FIELD
	TAD	TMP
	TAD	(6000	/ENABLE DONE INTERRUPT ONLY
	DLDC		/LOAD RK8 COMMAND REGISTER
	TAD I	ADDR	/RE-FETCH CONTROL WORD
	RAL
	AND	P7600
	SZA		/PRESERVE LINK
	CIA		/AROUND NEGATE
	DLWC		/LOAD RK8 WORD COUNT
	RTL
	TAD	(DLDR	/FORM READ OR WRITE OP
	DCA	INST
	STA
	ISZ	ADDR	/GET START ADDR -1
	TAD I	ADDR
	DLCA		/TO RK8 HARDWARE CA REGISTER
	ISZ	ADDR	/GET BLOCK NUMBER
	TAD I	ADDR
INST,	HLT		/READY, STEADY, GO!
	JMP I	INIT

INTRPT,	0;0		/SKIP CHAINING GOES HERE
	DSKD
	JMP I	INTRPT
	CDF CIF CUR	/SET DF AND IF CORRECTLY
	JMP I	.+1
IDISP,	IGNORE		/IGNORE INITIAL INTERRUPT
	CIF 0		/IDISP IS A COROUTINE WITH
	POSTDS		/THE RTS-8 INTERRUPT SYSTEM
/RK8 INTERRUPT SERVICE

TRYAGN,	DRDS
	AND	(40
	DCLS
	SNA CLA		/CHECK FOR TRACK SEEK ERROR
	JMP	NOTKSK	/IF WE GOT ONE
	DCLA		/WE HAVE TO RECALIBRATE THE DISK
	TAD	(6000
	DLDC		/RE-ENABLE INTERRUPT ON COMPLETION
	JMS	IDISP	/AND  WAIT UNTIL COMPLETION
NOTKSK,	TAD	ADDR
	TAD	(-4	/BACK UP THE ADDRESS POINTER
	JMS	INIT
GOAWAY,	JMS	IDISP

FSTINT,	DSKE		/ERROR?
	JMP	RKOVER	/NO - WE'RE DONE
	DRDS
	AND	(4	/CHECK FOR TRACK OVERFLOW
	SZA CLA		/WHICH DOESN'T COUNT AS AN ERROR
	JMP	TRKOV	/BUT AS A HARDWARE DEFICIENCY
	ISZ	TRYCT	/ITS A MORE SERIOUS ERROR - HOW MANY
	JMP	TRYAGN	/TIMES HAVE WE HIT IT?
	DRDS		/TOO MANY - RETURN DISK STATUS REGISTER
RKOVER,	DCA	STATUS
IGNORE,	DCLS		/CLEAR NASTY FLAGS
	TAD	PDONFG	/GOING TO POSTDS WITH THE AC NON-ZERO
	JMS	IDISP	/WAKES UP THE HANDLER TO CLEAN UP
HALT,	HLT		/FOR GOOD LUCK

TRKOV,	TAD	INST
	DCA	OVINST	/COPY READ OR WRITE INST (CLUMSY!)
	DCLS		/WIPE SLATE CLEAN
	DRDA		/WE MUST BUMP THE DISK ADDRESS
	AND	(7760	/TO THE NEXT TRACK
	TAD	(20	/BY HAND
OVINST,	HLT
	JMP	GOAWAY	/DO REMAINDER OF OPERATION
	PAGE
	$$
