/2 TC08 HANDLER FOR 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 MANUAL.
/
/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.
/
/
/
/
/
/
/
/
/
/
/1 TC08 HANDLER FOR BUILD
	*0
	-10
DEVICE TC;DEVICE DTA0;4160;10;ZBLOCK 2
DEVICE TC;DEVICE DTA1;4160;11;ZBLOCK 2
DEVICE TC;DEVICE DTA2;4160;12;ZBLOCK 2
DEVICE TC;DEVICE DTA3;4160;13;ZBLOCK 2
DEVICE TC;DEVICE DTA4;4160;14;ZBLOCK 2
DEVICE TC;DEVICE DTA5;4160;15;ZBLOCK 2
DEVICE TC;DEVICE DTA6;4160;16;ZBLOCK 2
DEVICE TC;DEVICE DTA7;4160;17;ZBLOCK 2
	DTRB=6772
	DTLB=6774
	DTXA=6764
	DTCA=6762
	DTRA=6761
	DTSF=6771

	TCVERSION="A&77

	*200
	/DECTAPE HANDLERS(PAGE RELOCATABLE) FOR PS/8 MONITOR
DFUN,	0
DM203,	-203
DBLOCK,	0
DBLKCT,	0
D3,	3
WC,	7754
CA,	7755
DERRCT,	TCVERSION
DTA0,	ISZ DTANO
DTA1,	ISZ DTANO
DTA2,	ISZ DTANO
DTA3,	ISZ DTANO
DTA4,	ISZ DTANO
DTA5,	ISZ DTANO
DTA6,	ISZ DTANO
DTA7,	ISZ DTANO
D400,	400
	CLA CLL CMA RTL
	DCA DERRCT	/SET TO REPEAT THREE TIMES IN CASE OF ERROR
	TAD DTANO
	CMA
	TAD DTATAD	/GENERATE "TAD DTAN" WHERE DTAN IS THE ONE THAT
	DCA DTANO	/WAS CALLED.
	CLA CLL CML RTR
	TAD DTANO	/ALSO GENERATE "DCA DTAN" SO WE CAN RESTORE IT
	DCA DTADCA
	RDF
	TAD DCDIF0
	DCA DSTOP	/STORE CALLING FIELD FOR RETURNING
DTANO,	0		/GET CALLING ADDRESS
	DCA DTA		/SAVE IT
	TAD DTAISZ
DTADCA,	0		/RESTORE ENTRY POINT
	DLOC=DTADCA
DTAISZ,	ISZ DTANO	/BUMP DTANO FOR VARIOUS GROOVY REASONS
			/WHICH WILL BE APPARENT LATER
	TAD I DTA
	DCA DFUN	/STORE AWAY FUNCTION WORD FOR FUTURE USE
	ISZ DTA
DT7140,	CLL CMA		/THE "CLL" IS ONLY NECESSARY TO FORM THE 7140
	TAD I DTA
	DCA DLOC	/BUFFER ADDRESS -1
	ISZ DTA
	TAD I DTA
	CLL RAL		/MULTIPLY BY 2 FOR 256-WORD SIMULATED RECORDS
	DCA DBLOCK	/DECTAPE BLOCK #
	ISZ DTA
DTATRY,	TAD WC
DCDIF0,	CDF CIF 0
	DCA I CA
	TAD DFUN
	RAR
	CLA CML		/COMPLEMENT OF BIT 11 OF DFUN NOW IN THE LINK
	TAD DTANO	/DTANO = "TAD DTAN+1"
	RTR
	RTR		/THESE TWO ROTATES FORM THE FLLOWING NUMBER
			/IN THE AC: YYYF00101000, WHERE YYY =DTAN+1
			/AND F IS THE COMPLEMENT OF DFUN(11)
	TAD DT7140	/THE MAGIC STEP - THIS SIMULTANEOUSLY BUMPS DOWN
			/THE RECORD NUMBER IN AC(0-2) AND TRANSFORMS
			/THE REST OF THE AC TO F10001000 WHICH IS A
			/SEARCH IN DIRECTION F(F=1 MEANS BACKWARDS) WITH
			/THE MOTION BIT ON.
	DTCA DTXA
	DTLB		/SET DECTAPE FIELD TO 0 FOR SEARCHING
	JMP DC+3	/JUMP INTO THE BLOCK SEARCH ROUTINE
DERR,	RTL		/DECTAPE STATUS REGISTER B IS USUALLY IN THE AC HERE
	RAL
D7600,	7600		/GET THE "END OF TAPE" FLAG INTO THE LINK AND CLEAR THE AC
	TAD D200	/GET MOTION BIT
DC,	SZL		/AND, IF LINK IS ON
DTATAD,	TAD D400	/REVERSE DIRECTION OF MOTION
	DTXA
	TAD D200
	KRS
	TAD DM203
	SNA CLA
	KSF		/CHECK FOR ^C TYPED
	JMP DTAWT
	TAD D7600	/**PROBLEM: LINK IS RANDOM YET MUST BE 0
	DCA DTA		/FAKE DTA SO WE GO TO LOC 7600 IN FIELD 0
	JMP DSTOP1	/AFTER STOPPING THE TAPE
DTAWT,	DTSF DTRB
	JMP .-1		/WAIT FOR SEARCH TO COMPLETE
	SPA		/HAS AN ERROR OCCURED?
	JMP DERR	/DO SOMETHING APPROPRIATE
	DTRA
	RTL
	CMA RTL
	SNL CLA		/WAS MOTIOZ OF TAPE FORWARDS?
	TAD D3		/NO, SO ONLY SUCCEED IF WE ARE 3 BLOCKS IN FRONT 
			/OF TARGET BLOCK
	TAD I WC
	CMA
	TAD DBLOCK
	CMA		/AFTER THIS OPERATION WE HAVE THE FOLLOWING 4 POSSIBILITIES
			/1)AC=0, L=1	/SEARCH COMPLETE
			/2)AC=0, L=0	/RIGHT PLACE ON TAPE,WRONG DIRECTION
			/3)AC .GT. 0, L=0	/WEVE PASSED THE CORRECT BLOCK
			/4)AC .GT. 0, L=1	/WE HAVENT REACHED THE CORRECT BLOCK YET
	SZA CLA
	JMP DC
	SNL
	JMP DTATAD	/DC+1
	TAD DLOC
	DCA I CA	/SET THE CURRENT ADDRESS REGISTER TO THE BUFFER -1
	TAD DFUN
	DTLB		/SET FIELD TO BUFFER FIELD
	TAD D7700
D200,	AND DFUN
	CLL RAL
	DCA DBLKCT	/GET UNCOMPLEMENTED WORD COUNT INTO DBLKCT
	RAL
	IAC
	CLL CML RTL
	RTL		/FORM A 50 IF L=1, A 30 IF L=0
DL,	DTXA		/XOR IN 50(WRITE) OR 30(READ) OR 0(CONTINUE PREVIOUS OP)
	TAD D7600
	DCA I WC	/READ/WRITE 128 WORDS FROM/INTO EACH BLOCK
	DTSF DTRB
	JMP .-1
	CLL CML		/SET ERROR FLAG ON INITIALLY
D7700,	SMA CLA
	JMP DJ
	ISZ DERRCT	/ERROR-IS IT THE THIRD?
	JMP DTATRY	/NO-TRY AGAIN
	JMP DSTOP	/3 ERRORS-STOP TAPE!
DJ,	TAD DBLKCT
	TAD D7600
	SNA		/BUMP WORD COUNT BY -128 AND SEE IF 0
			/ALSO REVERSE LINK.
	JMP DOVER	/YES - DONE
	DCA DBLKCT	/RESTORE BUMPED WORD COUNT
	JMP DL		/AND LOOP
DOVER,	ISZ DTA		/SKIP ERROR RETURN
DSTOP,	HLT		/RESTORE CALLING FIELD
DSTOP1,	TAD D200	/STOP THE TAPE
	DTXA
	DCA DTANO	/INITIALIZE DTANO FOR THE NEXT CALL
	RAR		/GET ERROR CODE FROM LINK INTO AC0
	JMP I DTA	/AND EXIT
DTA,	0
	$

