/3 RK8E SYSTEM HANDLER FOR OS/8 BUILD
/
/
/
/
/
/
/
/
/
/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.
/
/
/
/
/
/
/
/
/
/
	VERSION="C&77

	*0

	DECIMAL;RKLEN=3248;OCTAL

	-3
	DEVICE RK8E;DEVICE SYS;4231;2007;0;RKLEN
	DEVICE RK8E;DEVICE RKA0;4231;1007;0;RKLEN
	DEVICE RK8E;DEVICE RKB0;4231;SHNDL1&177+1000;0;RKLEN
/ONE RK8E IS TREATED AS TWO LOGICAL DISKS
/EACH OF 3248 OS/8 BLOCKS.

/THIS HANDLER CONTAINS ENTRY POINTS FOR THE SYSTEM DEVICE
/AND RKA1.
/THIS HANDLER ALLOWS BOOTING OFF OF ANY UNIT

	DCLR=6742
	DLAG=6743
	DLDC=6746
	DRST=6745
	DSKP=6741
	DLCA=6744
	DMAN=6747

	RKEBLK=7750	/12 BITS OF BLOCK NUMBER
	SERRCT=7751	/HOLDS RETRY COUNT
	PAGCNT=7752	/PAGE COUNT
	RKECMD=7753	/BASE OF DLDC COMMAND
	CHKHED=7754	/CHECK HEADER FLAG

/MAINTENANCE RELEASE CHANGES:

/1.	FIXED BUG RE INTERACTION WITH NON-SYSTEM HANDLER
/	[APRIL DSN]
	BOOT-BLAST

	RELOC 0

BOOT,	TAD I BOOTX1
	DCA I BOOTX2
	TAD I BOOTX3
	CDF 10
	DCA I BOOTX4
	CDF 0
	TAD BOOTX2
	SZA CLA
	JMP BOOT
	JMP I B7605
BOOTX1,	177
BOOTX2,	7577
BOOTX3,	46
BOOTX4,	7646

	ZBLOCK	30-.	/DSKP GOES OVER 30

	DSKP
	JMP .-1
	AND RK6
	DCA I RKUNIT
	JMP BOOT

RK6,	6
RKUNIT,	SYSUNT+400	/CHANGED BEFORE IT IS MOVED
B7605,	7605
BLAST,	RELOC
	/THE BOOTSTRAP IS RK8E ONLY
	/30	6743
	/31	5031

	/LOAD ADDRESS 30 AND START

/BOOTSTRAP FOR OTHER UNITS:

/	25	7604
/	26	6746
/	27	6743
/	30	7604
/	31	5031

/LOAD ADDRESS 25, PUT UNIT # IN BITS 9&10 OF SWITCH REGISTER,
/CLEAR CONTINUE.
	*200

	RELOC 7600

	ZBLOCK 7
SHNDLR,	VERSION		/SYSTEM HANDLER ENTRY POINT
	CLA CLL		/GUARD AGAINST RANDOM AC
	TAD SHNDLR
	DCA SHNDL1	/SETUP COMMON EXIT AND PARM ADDR'S
	JMP SHNDC	/JUMP TO COMMON CODE

/VARIOUS CONSTANTS TO PAD E.P. FOR RKA1 TO 7621
S6260,	6260		/SIZE OF ONE LOGICAL DISK
S4070,	4070		/USED TO GET READ/WRITE AND DF BITS
S3700,	3700		/ " TO GET PAGE COUNT
SCIF,	CIF 0		/ " TO RESTORE USERS FIELD
S37,	37		/USED TO CHECK FOR CYLINDER CHANGE

	IFNZRO .-7621 <ERROR1,	BARF>

SHNDL1,	VERSION		/2ND E.P. FOR RKB0 AND TEMPORARY
	CLA		/GUARD AGAINST NON-ZERO AC
	TAD S6260	/RKB1 IS SECOND HALF OF PACK
SHNDC,	DCA SHNDLR	/SET BLOCK DISPLACEMENT ACCORDING TO SYS OR RKB0
	CLA CLL CMA RTL	/AC=-3
	DCA SERRCT	/RETRY COUNT
	RDF
	TAD SCIF
	DCA SFIELD	/RESET USER INST FIELD FOR EXIT
RETRY,	TAD SHNDL1	/AC=-2 IF ERROR ENRTY
	DCA SHNDL1
	TAD I SHNDL1	/GET ARG1
	AND S4070	/GET R/W AND DF BITS
	TAD SYSUNT
	DCA RKECMD	/BASE COMMAND TO RK8E(DLDC)
	TAD I SHNDL1	/GET ARG1 AGAIN
	ISZ SHNDL1	/POINT TO ARG2
	AND S3700
	SNA
	STL CLA RAR	/4000
	DCA PAGCNT	/SAVE PAGE COUNT
	TAD I SHNDL1	/GET ARG2
	ISZ SHNDL1	/POINT TO ARG3
	DLCA		/LOAD CURRENT ADDRESS REGISTER
	TAD I SHNDL1	/GET ARG3
	CLL	
	TAD SHNDLR	/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
	TAD PAGCNT	/TEST TO SEE IF ONLY 1 PAGE WANTED
	AND S7600
	SNA CLA
	TAD S400	/100 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
	DSKP		/WAIT ON FLAG
	JMP .-1
	DRST		/READ COMPLETION REGISTER
	CLL RAL		/GET RID OF SUCCESS BIT
	SZA CLA		/AND SEE IF ANYTHING LEFT
	JMP SERROR	/AN ERROR
	IFNZRO .-7700 <ERROR2,	DOUBLE BARF>
	SKP		/PROTECTION AGAINST JMS I 7700 FIELD 0
	HLT		/HE'S HAD IT
	TAD PAGCNT
	TAD S7600
	SPA SNA
	JMP RKDONE
	DCA PAGCNT
	TAD RKEBLK
	CMA
	AND S37		/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
			/RECALIBRATE ON ALL ERRORS
SERROR,	DCLR		/CLEAR STATUS 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 .-3		/V3C STILL DOING RECALIBRATE
	CLA CLL CMA RAL	/AC=-2
	ISZ SERRCT	/SKIP IF WE TRIED 3 TIMES
	JMP RETRY	/TRY AGAIN
	JMP .+3		/ERROR EXIT
RKDONE,	ISZ SHNDL1	/NORMAL RETURN
S7600,	7600		/GROUP 2 CLA
	ISZ SHNDL1	/IF JUMPED TO HERE- ERROR RETURN
SFIELD,	HLT		/RESET USERS INST FIELD- WE NEVER TOUCHED DF
	JMP I SHNDL1	/EXIT

S400,	400		/ " FOR 128 WORD TRANSFER MODE(RTR'D IN CODE)
SYSUNT,	0		/SYSTEM DEV UNIT # (SET BY BOOTSTRAP)
	RELOC
	$
