/1 RK8E NON-SYSTEM HANDLER FOR OS/8
/
/
/
/
/
/
/
/
/
/COPYRIGHT  (C)  1974,1975 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.
/
/
/
/
/
/
/
/
/
/

/DEC-S8-URK8B-A-LA		HJ

/COPYRIGHT 1973

/DIGITAL EQUIPMENT CORPORATION

/MAYNARD, MASSACHUSETTS   01754

/JANUARY 22, 1973

/ONE RK8E IS TREATED AS TWO LOGICAL DISKS
/EACH OF 3248 OS/8 BLOCKS.

/THIS HANDLER CONTAINS ENTRY POINTS FOR THE 8 LOGICAL UNITS.
/(RKA0,RKB0,RKA1,RKB1,RKA2,RKB2,RKA3,RKB3)


	DCLR=6742
	DLAG=6743
	DLDC=6746
	DRST=6745
	DSKP=6741
	DLCA=6744
	*0
	-10
DEVICE RK05;DEVICE RKA0;4230;20;ZBLOCK 2
DEVICE RK05;DEVICE RKB0;4230;21;ZBLOCK 2
DEVICE RK05;DEVICE RKA1;4230;22;ZBLOCK 2
DEVICE RK05;DEVICE RKB1;4230;23;ZBLOCK 2
DEVICE RK05;DEVICE RKA2;4230;24;ZBLOCK 2
DEVICE RK05;DEVICE RKB2;4230;25;ZBLOCK 2
DEVICE RK05;DEVICE RKA3;4230;26;ZBLOCK 2
DEVICE RK05;DEVICE RKB3;4230;27;ZBLOCK 2
	VERSION="A&77

	*200

/THE FOLLOWING MUST REMAIN HERE BECAUSE OF THE R200 REF.
R37,	37		/USED TO CHECK FOR CYLINDER CHANGE
RKEBLK,	0		/12 BITS OF BLOCK NUMBER
CHKHED,	0		/CHECK HEADER FLAG
RKEARG,	0		/HOLDS RETURN ADDRESS
RKENO,	0		/HOLDS ENTRY POINT COUNT
PAGCNT,	0		/HOLDS REMAINING PAGE COUNT
RKEISZ,	ISZ RKENO	/TO PUT BACK OVER THE EP ADDR

CTRLC,	TAD R200	/TO IGNORE PARITY
	KRS		/READ THE KEYBOARD
	TAD R7575	/SUBTRACT ^C
	SNA CLA
	KSF		/IS KEYBOARD FLAG UP?
	JMP RWAIT	/NO
RCIF,	CDF CIF 0
	JMP I R7600	/BOOTSTRAP






/NOTE: A LOCATION CAN BE EEKED OUT BY USING RKA0 BETTER
RERRCT,	0		/HOLDS RETRY COUNT
	ZBLOCK 220-.	/PAD ENTRY POINTS TO 220

RKA0,	VERSION
RKB0,	ISZ RKENO	/THE ISZ'S SET UP A COUNT OF
RKA1,	ISZ RKENO	/OF WHICH ENTRY POINT WE CAME IN
RKB1,	ISZ RKENO
RKA2,	ISZ RKENO
RKB2,	ISZ RKENO
RKA3,	ISZ RKENO
RKB3,	ISZ RKENO
R400,	400		/AN INNOCUOUS AND INSTRUCTION WHICH
			/IS REFERENCED BY A TAD.
	CLA CLL CMA RTL	/AC=-3
	DCA RERRCT	/RETRY 3 TIMES
	TAD RKENO	/7-EP NUMBER
	CMA		/EP-8
	TAD RKETAD	/ADD ON INSTRUCTION
			/WHICH REFERENCES THE 400 TO GENERATE A
			/TAD CORRECT ENTRY POINT INSTRUCTION.
	DCA GETENT	/WE EXECUTE TO GET USERS ADDRESS
	CLA CLL CML RTR	/AC=2000
	TAD GETENT	/GENERATE A DCA INTO ENTRY POINT INSTRUCTION
	DCA RKECMD	/THIS IS EXECUTED TO REPLACE ISZ RKENO
	RDF		/GET USERS DATA FIELD
	TAD RCIF	/BUILD A CIF FOR RETURNING
	DCA REXIT	/STORE IT INTO THE EXIT CODE
GETENT,	HLT		/WILL BE A TAD "ENTRY POINT"
			/WILL SAVE UNIT INFO HERE FOR ERRORS
	DCA RKEARG	/SAVE USERS ADDR IN COMMON LOCATION
	DCA RKENO	/ZERO COUNT FOR NEXT TIME
	TAD RKEISZ	/GET THE ISZ RKENO
RKECMD,	HLT		/THE DCA ENTRY POINT IS PUT HERE
			/AND THIS LOCATION IS USED FOR THE RK8E COMMAND


RETRY,	TAD RKEARG	/AC=-2 IF ERROR RETRY
	DCA RKEARG
	TAD GETENT
	AND R6		/GET THE UNIT NUMBER
	DCA RKECMD	/SET UP UNIT FOR COMMAND 
	TAD GETENT
	RAR		/PUT HI/LOW LOGICAL DISK BIT IN LINK
	SZL CLA
	TAD R6260	/DISPLACEMENT TO 2ND HALF OF DISK
	DCA RKA0	/NICE PLACE FOR A CONSTANT
	TAD I RKEARG	/GET ARG1
	AND R4070	/GET R/W AND DF BITS
	TAD RKECMD	/GET UNIT NUMBER
	DCA RKECMD	/BASE COMMAND TO RK8E(DLDC)
	TAD I RKEARG	/GET ARG1 AGAIN
	TAD I RKEARG	/GET ARG1 AGAIN
	ISZ RKEARG	/POINT TO ARG2
	AND R7600
	CIA		/TO MAKE 0 LOOK LIKE 40 PAGES
	DCA PAGCNT	/SAVE PAGE COUNT
	TAD I RKEARG	/GET ARG2
	ISZ RKEARG	/POINT TO ARG3
	DLCA		/LOAD CURRENT ADDRESS REGISTER

	TAD I RKEARG	/GET ARG3
	CLL	
	TAD RKA0	/SYS OR RKB0 DISPLACMENT
	DCA RKEBLK	/LOW PART OF RK8E BLOCK NUMBER
	SZL		/STILL OFF IF BELOW BLOCK 10000
OVRFLO,	ISZ RKECMD	/TURN ON EXTENDED BIT IF OVERFLOWED
RELOOP,	DCA CHKHED	/SET CHECK HEADER FLAG TO EITHER
			/0 OR 4000(WHICH GETS RTR'D BEFORE USED)
			/AND CAUSES EITHER A "DATA" OR "ALL"
			/TRANSFER
	DCLR		/CLEAR STATUS REGISTER
	TAD PAGCNT	/TEST TO SEE IF ONLY 1 PAGE WANTED
	TAD R200
	SNA CLA
RKETAD,	TAD R400	/7600 WAS IN PAGCNT
	TAD CHKHED	/ADD IN CHECK HEADER FLAG
	CLL RTR		/SHIFT TO CORRECT BITS
	TAD RKECMD	/ADD IN BASE COMMAND
	DLDC		/LOAD COMMAND REGISTER
	TAD RKEBLK
	DLAG		/LOAD BLOCK REGISTER AND GO
RWAIT,	DSKP		/WAIT ON FLAG
	JMP CTRLC	/CHECK FOR CONTROL C WHILE WAITING
	DRST		/READ COMPLETION REGISTER
	CLL RAL		/GET RID OF SUCCESS BIT
	SZA		/AND SEE IF ANYTHING LEFT
	JMP RERROR	/AN ERROR

/IF THERE WAS NO ERROR L=1 BECAUSE DONE FLAG
	TAD PAGCNT	/CHECK TO SEE IF DONE
	TAD R400	/ADD 2 PAGES ONTO TOTAL
	SNL
	JMP RKDONE	/NO MORE TO DO
	DCA PAGCNT	/SAVE FOR NEXT TIME
	TAD RKEBLK
	CMA

/THE R37 MUST REMAIN AT 200 SO THE FOLLOWING IS A 200
R200,	AND R37		/IF BLOCK IS AT A 37 MAKE
			/NEXT OPERATION DO A CHECK HEADER
	SZA CLA
	STL RAR		/SET AC TO "ALL" FLAG
	ISZ RKEBLK	/BUMP BLOCK NUMBER
	JMP RELOOP	/TRANSFER SOME MORE
	JMP OVRFLO	/PAST BLOCK 7777-SET EXTENDED BIT

RERROR,	AND R1002	/AC WAS RAL'D AND WE WANT TO SEE IF
			/DRIVE SEEK FAILED OR CYLINDER ADDR ERROR
	SNA CLA
	JMP RKTST3	/WE TRY 3 TIMES
/WE HAVE TO RECALIBRATE DRIVE
	DCLR		/CLEAR STAUS REGISTER
	STL RTL		/AC=2
	DCLR		/RECALIBRATE DRIVE
	DSKP		/WAIT ON FLAG
	JMP .-1
	DCLR		/CLEAR STATUS REGISTER
	DRST		/WAIT FOR STATUS TO CLEAR
	SZA CLA
	JMP .-2		/STILL DOING RECALIBRATE
RKTST3,	CLA CLL CMA RAL	/AC=-2
	ISZ RERRCT	/SKIP IF WE TRIED 3 TIMES
	JMP RETRY	/TRY AGAIN
	JMP .+3		/ERROR EXIT
RKDONE,	ISZ RKEARG	/NORMAL RETURN
R7600,	7600		/GROUP 2 CLA
	ISZ RKEARG	/IF JUMPED TO HERE- ERROR RETURN
REXIT,	HLT		/RESET USERS INST FIELD- WE NEVER TOUCHED DF
	JMP I RKEARG	/EXIT

R6260,	6260		/SIZE OF ONE LOGICAL DISK
R4070,	4070		/USED TO GET READ/WRITE AND DF BITS
R1002,	1002		/ " TO CHECK FOR RECALIBRATE ERRORS
R6,	6		/TO PEEL OUT UNIT NUMBER
R7575,	7575		/- ^C CONSTANT


	$$$$

