/3 TD8E SYSTEM RESIDENT (12K)
/
/
/
/
/
/
/
/
/
/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.
/
/
/
/
/
/
/
/
/
/
	*0

	-3
	DEVICE TD8E;DEVICE SYS;4211;6007;0;1341
	DEVICE TD8E;DEVICE DTA0;4211;5007;0;1341
	DEVICE TD8E;DEVICE DTA1;4211;SDTA1&177+5000;0;1341
	TDBEGN-TD77-1

	RELOC 7360

/THE BINARY GETS LOADED INTO 27220 INITIALY, AND
/WRITTEN OUT AS PART OF RECORD 0. WHEN THE 30 WORD
/BOOTSTRAP IS USED, THIS CODE GETS READ INTO 7400.



	SDSS=6771
	SDST=6772
	SDSQ=6773
	SDLC=6774
	SDLD=6775
	SDRC=6776
	SDRD=6777

TDBEGN,	ZBLOCK 20
TDBOOT,	TAD K7600	/128 WORDS PER PAGE
	DCA TDWCT
	SDSS		/WAIT FOR A BLOCK MARK (TAPE IS
	JMP .-1		/STILL MOVING)
	SDRC
	AND TD77
	TAD KM26	/IS IT A BLOCK MARK?
	SZA CLA
	JMP TDBOOT+2	/NO..WAIT A WHILE LONGER
	SDRD		/GET THE BLOCK NO.
TDBKNO,	TAD TDM14	/NEED DECTAPE BLOCKS 154 & 155 (REC. 66)
	SZA CLA
	JMP TDBOOT+2	/NOT YET, BUSTER
TDRGRD,	SDSS
	JMP .-1		/NOW LET'S LOOK FOR A REVERSE GUARD WORD
	SDRC
	AND TD77
	TAD KM32
	SZA CLA
	JMP TDRGRD	/KEEP LOOKING FOR IT
	JMS TDRQD
	JMS TDRQD
	JMS TDRQD	/SKIP CONTROL WORDS
	CDF 10		/LOAD UP FIELD 1
TDREAD,	JMS TDRQD	/GET A DATA WORD
	DCA I TDPTR
	ISZ TDPTR	/ARE WE DONE?
	JMP TDREAD	/NOT YET
	ISZ TDBKNO	/YES..LOOK AT BLOCK 15
	TAD KCDF20
	DCA TDREAD-1	/LOAD UP FIELD 2
	ISZ M2		/DONE THIS JUNK?
	JMP TDBOOT	/GO DO FIELD 2
	SDLC		/STOP THE TAPE
	CIF CDF 0
	JMP I K7605
TDM14,	-154
	-155	/USE RECORD 66
TDPTR,
TDWCT,	7600
TDRQD,	0
	SDSQ
	JMP .-1
	SDRD
	JMP I TDRQD

K7600,	7600
KM26,	-26
KM32,	-32
KCDF20,	CDF 20
M2,	-2
K7605,	7605
TD77,	77

/	THIS BOOTSTRAP RESIDES IN BLOCK 0
/	BLOCK 1/2 CONTAINS THE USUAL IMAGE OF 07600
/	BLOCK 66 CONTAINS THE IMAGE OF 17600
/	BLOCK 66 1/2 CONTAINS THE IMAGE OF 27600
	RELOC
	*200

/TD8E DECTAPE SYSTEM HANDLER
/THIS HANDLER CAN DRIVE UNITS 0&1, AND IS PERMANENTLY
/RESIDENT IN FIELDS 0&2.

	RELOC 7600

	VERSION="B&77

	ZBLOCK 7
SHNDLR,	VERSION		/UNIT 0 ENTRY POINT
	CLA CLL
	JMP SHND2
C3,	3		/MUST BE HERE FOR BUILD
S70,	70
SDTA1,	VERSION		/UNIT 1 ENTRY
	CLA CLL CML
SC1000,	TAD SDTA1	/DOUBLES AS CONSTANT 1000
	DCA SHNDLR	/GET ARGS AT SHNDLR
SHND2,	RAR		/UNIT #
	DCA SUNIT
	RDF		/SETUP FOR EXIT
	TAD S6203
	DCA EFLD
	TAD I SHNDLR	/FUNCTION WORD
	SDLD		/PUT IT IN DATA EGISTER
	AND S70		/SDLD DOES NOT 0 AC..GET FIELD
	TAD S6203	/CIF CDF N FOR TRANSFER FIELD
	DCA TFLD
	ISZ SHNDLR
	TAD I SHNDLR	/BUFFER ADDRESS
	DCA BPTR
	ISZ SHNDLR
	TAD I SHNDLR	/BLOCK #. TIMES 2 FOR REAL #
	CLL RAL
	DCA BLOCK
	ISZ SHNDLR	/POINT TO ERROR EXIT
	CIF CDF 20	/PUT UNIT # INTO FIELD 2
	TAD SUNIT
	DCA I SUNIT2
	JMP F2SET	/TO FIELD 2 FOR INIT.

F1GO,	SDRD		/INITIAL DIRECTION TO LINK
	RAR
	JMP RGO
RENTER,	TAD BPTR	/DONE THIS BLOCK..NEXT ADDRESS
	TAD SC200
	DCA BPTR
	ISZ BLOCK	/NEXT TAPE BLOCK..CAN'T SKIP
	CLL CML		/FORCE FORWARD MOTION
RGO,	CLA CML RTR	/LINK TO MOTION BIT
	TAD SC1000
	TAD SUNIT
	SDLC		/MOVE THE TAPE
	SDSQ
	JMP .-1
	SDRD		/KNOCK DOWN QUAD FLAG
	SDSQ
	JMP .-1
	SDRD		/THIS IS NEEDED, ELSE TIME ERROR!!!

SRCH,	SDSS		/WAIT FOR A BLOCK MARK
	JMP .-1
	SDRC		/GET MARK TRACK BITS
	CLL RTL		/DIRECTION TO LINK
	AND SC374
	TAD SM110	/IS IT A N END ZONE?
	SNA
	JMP SENDZ	/YES
	TAD SM20	/MAYBE A BLOCK MARK?
	SZA CLA
	JMP SRCH	/NEITHER..KEEP GOING
	SDRD		/READ THE BLOCK #
	SZL		/IF REVERSE, LOOK 3 AHEAD OF TARGET
	TAD C3
	CMA
	TAD BLOCK
	CMA
	SNA		/IS IT THE RIGHT ONE?
	JMP FOUND	/YES
SM110,	CLA SNA SZL	/SNA SUPERFLUOUS..ONLY SZL VALID
	JMP SRCH	/HEADED FOR IT..KEEP GOING
SENDZ,	SDRC
	CLL RTL
	SZL CLA		/IF IN END ZONE FORWARD, GIVE ERROR
	JMP RGO
	CIF 20		/IF IT IS REALL END ZONE, AN ERROR
	JMP ERROR

FOUND,	SZL CLA		/RIGHT BLOCK..HOW ABOUT DIRECTION?
	JMP RGO		/WRONG..EXECUTE TURNAROUND
	TAD BPTR
TFLD,	HLT		/GETS CIF CDF N
	CIF 20
	JMP RDWT	/LET'S TRANSFER DATA

SEXIT,	ISZ SHNDLR	/NORMAL RETURN
SEREX,	TAD SUNIT	/STOP THE TAPE
	SDLC
	CML CLA RAR	/EITHER 0 OR 4000 IN AC ON RETURN
EFLD,	HLT
	JMP I SHNDLR

	BPTR=7755
	BLOCK=7754
	SUNIT=SDTA1

S6203,	6203
SC200,	200
SC374,	374
SM20,	-20
SUNIT2,	SXUNIT
	RELOC
	*400

	RELOC 7600	/RUNS IN 27600

XPTR,	0		/BUFFER POINTER
F2SET,	CLA CLL CMA RTL	/3 ERROR TRIES
	DCA TRYCNT
	TAD SXUNIT	/MAKE SURE TAPE IS STOPPED
	SDLC
F26203,	CIF CDF 0
	SDRD		/FUNCTION WORD
	CLL RAL
	AND CX7600	/PAGE COUNT
	DCA XPGCT
	SDRD
	DCA SXFUN	/SAVE THE FUNCTION WORD
	JMP F1GO

RDWT,	DCA XPTR	/SAVE NEW BUFFER ADDRESS
	TAD CX7600
	DCA XWCNT	/128 WORDS PER BLOCK
REVGRD,	SDSS		/WAIT FOR REVERSE GUARD WORD
	JMP .-1
	SDRC
	AND X77
	TAD XM32	/IS IT REVERSE GUARD?
	SZA CLA
	JMP REVGRD	/NO
	TAD SXFUN
SK7700,	SMA CLA		/READ OR WRITE?
	JMP READ		/READ
	SDRC
	AND C300	/ERRORS ON WRITE LOCKOUT AND TIME
	SZA CLA
	JMP ERROR
	JMS RDQUAD	/SKIP A WORD
CX7600,	7600
	TAD WRLP
	TAD SXUNIT
	SDLC		/TURN ON THE WRITE
	CLA CMA
	JMS WRQUAD	/WRITE 7777 IN REV. CHECKSUM
	CLA CMA
	DCA SCKSUM	/AND ALSO IN COMPUTE CHECKSUM
WRLP,	TAD I XPTR
	JMS WRQUAD	/WRITE THE DATA
	ISZ XPTR
X77,	77		/JUST IN CASE
	ISZ XWCNT	/DONE 128?
	JMP WRLP
	JMS WRQUAD	/WRITE AND CHECKSUM A WORD OF 0
	JMS GETCHK	/GET CHECKSUM
	JMS WRQUAD
	JMS WRQUAD	/LET CHECKSUM GET WRITTEN

RWCOM,	SDST		/CHECK FOR TIME AND CHECKSUM ERRORS
	SZA CLA
	JMP ERROR	/NOTE THAT LINK IS OFF AT RWCOM
	CIF CDF 0
	TAD XPGCT	/FINISHED TRANSFER?
	TAD CX7600	/LINK GOES ON HERE
	SNA
	JMP SEXIT	/YES..GETOUT
	DCA XPGCT
	JMP RENTER

READ,	JMS RDQUAD	/SKIP CONTROL WORDS
	JMS RDQUAD
	JMS RDQUAD	/GET CHECKSUM
	AND X77
	TAD SK7700
	DCA SCKSUM
SRDLP,	JMS RDQUAD
	DCA I XPTR
	TAD I XPTR
	JMS EQUFUN
	ISZ XPTR
C300,	300
	ISZ XWCNT	/DONE ALL?
	JMP SRDLP	/NO
	JMS RDQUAD	/READ AND CHECKSUM LAST WORD
	JMS EQUFUN
	JMS RDQUAD	/GET CHECKSUM
	AND SK7700
	JMS EQUFUN
	JMS GETCHK
	JMP RWCOM

ERROR,	CLA CLL		/THIS CAUSES SEARCH REVERSE AT RGO
	CIF CDF 0
	ISZ TRYCNT	/EXHAUSTED ERROR TRIES?
	JMP RGO
	JMP SEREX	/YES..FATAL EXIT

WRQUAD,	0		/WRITE A 12 BIT WORD
	SDSQ
	JMP .-1
	SDLD
	JMS EQUFUN	/SDLD LEAVES AC ALONE
	JMP I WRQUAD

RDQUAD,	0		/READ A 12 BIT WORD
	SDSQ
	JMP .-1
	SDRD
	JMP I RDQUAD
EQUFUN,	0		/EQUIVALENCE CHECKSUM
	CMA
	DCA EQUTMP
	TAD EQUTMP
	AND SCKSUM
	CIA
	CLL RAL
	TAD EQUTMP
	TAD SCKSUM
	DCA SCKSUM
	JMP I EQUFUN

GETCHK,	0
	TAD SCKSUM
	CLL CMA RTL
	RTL
	RTL
	JMS EQUFUN
	TAD SCKSUM
	AND SK7700
	JMP I GETCHK

SXUNIT,	0
XPGCT,	0
SXFUN,	0
TRYCNT,	0
XWCNT,	0
XM32,	-32
SCKSUM,	0
EQUTMP,	0

/THE LAST 4 LOCS. ARE FREE FOR USE BY BATCH
	ZBLOCK 4
	RELOC
	$

