/10 OS/8 RK8 SYSTEM HANDLER		V3D
/
/
/
/
/
/
/
/
/
/COPYRIGHT  (C)  1974,1975,1977 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.
/
/
/
/
/
/
/
/
/
/
/SYSTEM HANDLER ALSO HAS RESIDENT THE NONSYSTEM HANDLER RKA1:

/	SOFSET=7747

	RKVERSION="D&77

	DLDA=6731	/LOAD DISK ADDRESS (MAINT ONLY)
	DLDC=6732	/LOAD COMMAND REGISTER
			/0: ENABLE CHANGE IN INTERRUPT STATUS
			/1: ENABLE PROGRAM INTERRUPT ON TRANSFER DONE
			/2: ENABLE INTERRUPT ON ERROR
			/3: UNUSED
			/4: SEEK TRACK AND SURFACE ONLY
			/5: ENABLE READ/WRITE OF 2 HEADER WORDS
			/6-8: EXTENDED MEMORY ADDRESS
			/9-10: DISK FILE NUMBER
			/11: UNUSED
	DLDR=6733	/LOAD DISK ADDRESS AND READ, THEN CLEAR AC
			/0-7: TRACK ADDRESS
			/8: SURFACE BIT
			/9-11: SECTOR ADDRESS
	DRDA=6734	/READ DISK ADDRESS
	DLDW=6735	/LOAD DISK ADDRESS AND WRITE, THEN CLEAR AC
	DRDC=6736	/READ DISK COMMAND REGISTER
	DCHP=6737	/LOAD DISK ADDRESS AND CHECK PARITY
	DRDS=6741	/READ DISK STATUS REGISTER
			/0: ERROR
			/1: TRANSFER DONE
			/2: CONTROL BUSY ERROR
			/3: TIME OUT ERROR
			/4: PARITY OR TIMING ERROR
			/5: DATA RATE ERROR
			/6: TRACK ADDRESS ERROR
			/7: SECTOR NO GOOD ERROR
			/8: WRITE LOCK ERROR
			/9: TRACK CAPACITY EXCEEDED ERROR
			/10: SELECT ERROR
			/11: BUSY
	DCLS=6742	/CLEAR STATUS REGISTER
	DMNT=6743	/LOAD MAINTENANCE REGISTER
			/SEE PAGE 7-145 IN 1972 SMALL COMPUTER HANDBOOK
	DSKD=6745	/SKIP ON DISK DONE
	DSKE=6747	/SKIP ON DISK ERROR
	DCLA=6751	/CLEAR ALL
	DRWC=6752	/READ WORD COUNT REGISTER
	DLWC=6753	/LOAD WORD COUNT REGISTER
	DLCA=6755	/LOAD CURRENT ADDRESS REGISTER
	DRCA=6757	/READ CURRENT ADDRESS REGISTER
	*0

	-3
	DEVICE RK8;DEVICE SYS;4051;2007;0;6260
	DEVICE RK8;DEVICE RKA0;4051;1007;0;6260
	DEVICE RK8;DEVICE RKA1;4051;RKA1&177+1000;0;6260

/V3D CHANGES:

/FIXED BUG CONCERNING RETRY COUNT IF LINK SET ON CALL
/REMOVED 'SOFSET'
	BOOT-ENDB-1

	NOPUNC
	*1
	ENPUNC

BOOT,	TAD I BOOTX1
	DCA I BOOTX2
	TAD I BOOTX3
	CDF 10
	DCA I BOOTX4
	CDF 0
	TAD BOOTX2
	SZA CLA
	JMP BOOT
	JMP BGETUT
BOOTX1,	200
BOOTX2,	7577
BOOTX3,	47
BOOTX4,	7646
BGETUT,	DRDC
	RAR
	AND BOOT3
	DCA I BOOTUT
	JMP I B7605
BOOT3,	3
BOOTUT,	DEFUNIT
	ZBLOCK	27-.
B7605,	7605
	DSKD		/MUST LOAD OVER LOC. 30
	JMP .-1		/MUST LOAD OVER 31
ENDB,	JMP BOOT
	/THE BOOTSTRAP FOR THE RK8 IS AS FOLLOWS: (UNIT 0)

	/	LOCATION	CONTENTS
	/	30		6733
	/	31		5031

	/LOAD ADDRESS 30 AND START

/THE BOOTSTRAP FOR OTHER UNITS IS AS FOLLOWS:

/	26	7604
/	27	6732
/	30	6733
/	31	5031

/LOAD ADDRESS 26, PUT UNIT NUMBER IN SWITCH REGISTER BITS 9-10,
/CLEAR, CONTINUE
	*200

	NOPUNCH;*7600;ENPUNCH

	ZBLOCK 7
RK8,	RKVERSION
	CLA
	TAD DEFUNIT	/USE DEFAULT UNIT FOR SYSTEM HANDLER
	JMP COMN
DEFUNIT,0
RKBAD,	STL CLA RAR	/4000
	SKP
RKOVER,	ISZ RK8		/POINT TO GOOD RETURN
SFIELD,	HLT		/CONTAINS CIF CDF TO USER'S FIELD
	JMP I RK8	/RETURN
	IFNZRO .&177-21	<BADLOC,XXXX>
RKA1,	RKVERSION
	CLA
	TAD RKA1
	DCA RK8
	CLA IAC
COMN,	DCA RKANO
	CLL STA RTL	/V3D
	DCA RKCNT	/SET # OF RETRIES ON AN ERROR TO 3
	RDF
	TAD LCIFCDF	/CALLING FIELD FOR RETURN
	DCA SFIELD
RKRETRY,TAD I RK8	/GET FN WORD
	AND L70		/ISOLATE FIELD OF BUFFER
	TAD RKANO
	TAD RKANO	/INCLUDE UNIT # (TIMES 2)
	DLDC		/SET FIELD
	TAD I RK8	/GET FN WORD BACK
	RAL		/MOVE R/W BIT TO LINK
	AND L7600	/ISOLATE # OF WORDS TO READ
	SZA
	CIA		/NEGATE
	DLWC		/LOAD WORD COUNT THEN CLEAR AC
	RTL		/MOVE R/W BIT TO AC 10
	TAD LDLDR
	DCA RKINST	/CREATE READ (6733) OR WRITE (6735)
	ISZ RK8		/POINT TO BUFFER ADDRESS
	STA
	TAD I RK8	/GET CURRENT ADDRESS-1
	DLCA		/LOAD CURENT ADDRESS AND CLEAR AC
	ISZ RK8		/POINT TO BLOCK #
	DCLS		/CLEAR STATUS REGISTER
	DSKE		/CHECK FOR NON-EXISTENT DISK ERROR
L7760,	SMA SZA SNL CLA	/OK, BUT SKIP ALWAYS
	JMP RKBAD	/IT'S BAD
/V3D	TAD RKANO	/! CAN'T HAVE OFFSETS ON OTHER UNITS THAN 0
/V3D	SNA CLA
/V3D	TAD SOFSET
	TAD I RK8	/GET BACK #
	ISZ RK8		/POINT TO ERROR RETURN
RKINST,	HLT		/GO (EITHER 6733 OR 6735)
	SZA CLA		/CHECK FOR NO DISK AT ALL
	JMP RKBAD	/IOT DIDN'T CLEAR AC
/THE ABOVE TWO LINES ARE USELESS. HOW DID HE BOOTSTRAP IF DISK WASN'T THERE?
	DSKD		/WAIT FOR DONE
	JMP .-1
	DSKE
	JMP RKOVER	/NO ERROR
L70,	70
L20,	20
L7600,	7600
L4,	4
	SKP CLA
	IFNZRO .-7701	<NZERR,XXX>
	HLT		/SAFETY HALT AT 7701
	DRDS		/READ STATUS REGISTER
	AND L4		/CHECK FOR TRACK OVERFLOW
	SZA CLA
	JMP RKTKOV
	ISZ RKCNT	/SOME OTHER ERROR - BADNESS [SIC]
	JMP RKOK	/TRY AGAIN
	JMP RKBAD	/3 TRIES IS ENOUGH
RKOK,	DRDS		/READ STATUS REGISTER
	AND L40		/TRACK SEEK ERROR?
	DCLS		/CLEAR STATUS REGISTER
	SNA CLA
	JMP RKBACK
	DCLA		/YES - RECALIBRATE
	DSKD		/WAIT 'TILL DONE
	JMP .-1
RKBACK,	CLL STA RTL	/-3
	TAD RK8
	DCA RK8		/POINT BACK TO FUNCTION WORD
	JMP RKRETRY	/GO TRY AGAIN

RKTKOV,	DCLS		/CLEAR STATUS REGISTER
	DRDA		/READ TRACK ADDRESS STUFF
	AND L7760	/ISOLATE JUST TRACK (NEEDED ??)
	TAD L20		/BUMP TRACK NUMBER BY 1
	JMP RKINST	/GO BACK AND CONTINUE TRANSFER
LCIFCDF,CIF CDF 0
LDLDR,	DLDR
L40,	40
RKCNT,	0
RKANO,	0
/	MUST NOT GO INTO LOCATION 7744
	IFZERO .&177-145&4000	<TOOBIG,XXXX>
	$
