File: MTOLD.TK of Disk: Disks/MyPDP/m8-blue-rka1-rkb1
(Source file text) 

/MT.TK 18-APR-79
IFDEF TC58 <
/DEFINITION OF INSTRUCTIONS FOR KENNEDY TAPE CONTROLLER:
MTSF=6701	/SKIP ON ERROR FLAG OR MAGTAPE FLAG
MTRS=6706	/READ STATUS REGISTER
MTCR=6711	/SKIP IF CONTROL READY
MTAF=6712	/CLEAR STATUS & COMMAND REGISTER; CLEAR ERROR AND
		/MAGTAPE FLAGS; IF NOT READY, CLEAR FLAGS ONLY.
MTCM=6714	/INCLUSIVE OR BITS 0-5, 9-11 INTO COMMAND REGISTER,
		/JAM 6-8 (FUNCTION).
MTLC=6716	/LOAD COMMAND REGISTER
MTTR=6721	/SKIP ON TAPE TRANSPORT READY
MTGO=6722	/SET GO TO EXECUTE COMMAND
MTRC=6724	/OR COMMAND REGISTER INTO AC
SDF=6731	/(MAINTENANCE)
MTLF=6734	/LOAD EXTENDED MEMORY BITS FROM AC 9-11
MTBR=6741	/SKIP IF MAGTAPE BUFFER READY (PROGRAMMED MODE)
MTPI=6746	/READ MAGTAPE BUFFER (PROGRAMMED MODE)
MTAX=6751	/SET PROGRAMMED MODE
MTPO=6754	/LOAD MAGTAPE BUFFER (PROGRAMMED MODE)
/SPECIAL TAPE HANDLING CODES
/	PAGE COUNT=0
/
/0	(CLOSE) WRITE 2 EOF'S AND BACKSPACE
/1	REWIND
/2	SPACE FORWARD/REVERSE RECORDS
/	IF WRITE BIT IS SET BACKSPACE
/	IF WRITEBIT IS CLEARED SKIP RECORDS
/	BLOCKNUMBER (ARG3) HOLDS - NUMBER OF RECORDS
/	THIS FUNCTION NEVER SKIPS OVER FILE MARKS
/3	SPACE FORWARD/REVERSE FILES
/	ARGS SAME AS FUNCTION 2
/	NEVER SPACE OVER 2 CONSECUTIVE FILE MARKS
/4	REWIND AND PUT OF LINE (NOT IMPLEMENTED)
/5	WRITE EOF
/6	PERFORM OPERATION WITH SPECIFIED BLOCK SIZE
/	THE NEGATIVE OF THE DESIRED BLOCKSIZE
/	IS SPECIFIED AS ARG3. NOTE ! THIS FUNCTION IS NOT
/	IMPLEMENTEDAND RETURNS A FATAL ERROR !
/7	CURRENTLY NOT USED
/	*** NOTE ***
/CURRENTLY RECORD LENGTH=400 WORDS !

	RLNGTH=400
	*200
COUNT,	"M^100+"T&3777	/NAME IS MT
	401		/TWO PAGES, 1 FLAGS
	MTA		/READY/ERROR FLAG
	MTIDON
SPECLX,	SPECIAL
FUNC,	0
REQUEST=ZTEM1

MT,	DCA REQUEST	/POINTER TO REQUEST PARAMETERS
	TAD I REQUEST	/GET FUNCTION WORD
	DCA FUNC
	ISZ REQUEST	/BUMP POINTER
	ACM1
	TAD I REQUEST
	DCA BUFFER	/ADDRESS OF BUFFER-1
	ISZ REQUEST
	TAD I REQUEST	/GET BLOCKNUMBER
	DCA BLOCK
	JMS MONITOR	/RETURN EVENT NUMBER TO CALLER
	   RESERV RETURN CONTINUE
	DCA EVENT	/REMEMBER WHERE COMPLETION SHOULD GO
	TAD M10
	DCA ERRCNT	/SETUP RETRY COUNTER
/COMPUTE COMMAND REGISTER BITS
	TAD FUNC	/SETUP FIELD AND UNIT
	CLL RTR
	RAR		/FIELD IN BITS 9-11
	MTLF		/LOAD FIELD REGISTER
	RAR		/UNIT IN BITS 1-2
	AND C7000
	TAD PARITY	/ADD PARITY BITS
	DCA UNIT	/
/ZERO BUFFER FOR READ
	TAD FUNC	/READING ?
	RAL
	AND C7600	/(CHECK FOR SPECIAL FUNCTION!)
	SNA SZL		/AND HAVE THE BUFFER LENGTH AT ONCE
	 JMP NOCLR
	CIA
	DCA ZTEM1	/COUNTER
	TAD BUFFER	/GET ADDRESS OF BUFFER
	DCA AUTO10
	TAD FUNC	/GET FIELD OF BUFFER
	AND C70
	TAD C6201	/MAKE A CDF
	DCA .+1
MTTEM,	 HLT		//CDF TO BUFFER FIELD
LOOP,	DCA I AUTO10	//ZERO A WORD
	ISZ ZTEM1	//ALL DONE ?
	 JMP LOOP	//NO
NOCLR,	CLA CLL
	CDTOIF		/
/SEE WHAT FUNCTION IT IS
	TAD FUNC
	AND C3700	/EXTRACT LENGTH
	SNA		/SPECIAL FUNCTIONS ?
	 JMP I SPECLX	/Y: GO THERE
	BSW		/NUMBER OF RECORDS*2
IFZERO RLNGTH-400 <
	CLL IAC RAR	/ROUND UP, DIVIDE BY 2 >
	CIA
	DCA COUNT	/- # OF BLOCKS
	TAD FUNC	/READ OR WRITE?
	SPA CLA		/+=READ
	 TAD (20	/WRITE: MAKE SUITABLE CODE
	TAD (20		/CODE FOR READ
	DCA MTTEM	/STORE
RWRITE,	TAD MTTEM
	JMS MTH		/CALL TAPE DRIVE
SIZE,	   -RLNGTH	/RLNGTH WORDS PER RECORD (!)
	   3776		/ERROR MASK
	 JMP ERROR1	/SOMETHING IS WRONG
	TAD BUFFER	/UPDATE BUFFER ADDRESS
	TAD (RLNGTH	/
	DCA BUFFER	/
	ISZ COUNT	/DONE ALL?
	 JMP RWRITE	/NO
	JMP MTSTOP	/Y:STOP

/THE ACTUAL DRIVER ROUTINE:
MTH,	0
	TAD UNIT	/UNIT BITS 1 AND 2 + PARITY
	MTLC		/LOAD COMMAND
	CLA
	MTTR		/UNIT READY ?
	SKP
	JMP MTH0
	JMS MONITOR
	   STALL
	   1
	CLA CLL
	MTTR		/UNIT READY NOW ?
	 JMP ERROR	/NO, SELECT ERROR, OR REWINDING
MTH0,	TAD I MTH
	CDF 0
	ISZ MTH
	DCA I (7752	//SET WORD COUNT
	TAD BUFFER	//BUFFER ADDRESS
	DCA I (7753	//CURRENT ADDRESS
	CDTOIF
	MTGO		/GO
	JMS MONITOR
	   WAIT
	   MTA
	AND I MTH	/APPLY ERROR MASK
	ISZ MTH		/MAKE CORRECT RETURN
	SNA		/FATAL ERROR ?
	 ISZ MTH	/NO: ADVANCE TO NORMAL RETURN
	JMP I MTH	/RETURN

ERROR1,	CLA
	TAD C70		/BACKSPACE
	JMS MTH		/BACKSPACE OVER THE ERROR
	   -1		/ONE RECORD
	   0776		/ERROR MASK
	 JMP ERROR	/FATAL ERROR
	ISZ ERRCNT	/ANOTHER TRY ?
	 JMP RWRITE	/YES
ERROR,	TAD (4000	/SET ERROR BIT
MTSTOP,	CLL RAR		/PASS SHIFTED STATUS TO CALLER
	JMS MONITOR
	   HALT SIGNAL CLEAR RELEASE
EVENT,	   0
/
BUFFER,	0		/BUFFER ADD. -1
BLOCK,	0		/BLOCK NUMBER, -NUMBER OF RECORDS/FILES
UNIT,	0		/UNIT IN BIT 1 AND 2 + PARITY
ERRCNT,	0		/RETRY COUNTER
PARITY,	607		/9 TRACK, 800 BPI, DUMP MODE

PAGE
BLOCKX,	BLOCK
SIZEX,	SIZE
FUNCX,	FUNC
MTHX,	MTH
CODE,	CLOSE	/CODE 0 IS CLOSE (2 EOF'S)+BACKSPACE
	REW	/CODE 1 IS REWIND
	SPCR	/CODE 2 IS SPACE RECORD F/B
	SPCF	/CODE 3 IS SPACE FILE F/B
	REW	/CODE 4 IS REWIND AND OFF-LINE
	EOF	/CODE 5 IS END OF FILE
ERRORX,	ERROR	/CODE 6 DOES NOT EXIST
STOPX,	MTSTOP	/CODE 7 IS NOP
	0
/
/INTERRUPT HANDLING
MTIDON,	MTRS		///READ STATUS
	DCA MTSTAT	///RETURN STATUS TO WAITER
	MTAF		///CLEAR FLAGS
	TAD (MTA
	CIF 0
	JMS I ZSOFINT
MTSTAT,	   0
/
/SPECIAL TAPE MANIPULATIONS.
SPECIAL,TAD I FUNCX	/CODE IS IN BIT 6-8 (!!!!)
	CLL RTR
	RAR
	AND C7
	TAD (JMP I CODE	/FORM THE JUMP
	DCA .+1
FLAG,	HLT

CLOSE,	TAD C50		/2 X EOF
	JMS I MTHX
	   -1
	   3666		/ERROR MASK
	 JMP I ERRORX
	TAD C50
	JMS I MTHX
	   -1
	   3666
	 JMP I ERRORX
	TAD C70		/BACKSPACE
	JMS I MTHX
	   -1
	   3666
	 JMP I ERRORX
	JMP I STOPX
EOF,	TAD C50		/EOF
	JMS I MTHX
	   -1
	   3666		/ERROR MASK
	JMP I ERRORX
	JMP I STOPX

SPCR,	TAD I FUNCX	/DETERMINE DIRECTION
	SMA CLA		/-IS BACKWARD
	 TAD M10	/FUNC=60
	TAD C70
	JMS I MTHX
	   -1
	   3666		/ERROR MASK
	 JMP I ERRORX
	ISZ I BLOCKX
	JMP SPCR
	JMP I STOPX	/DONE.

REW,	TAD C10		/REWIND
	JMS I MTHX
	   100
	   0		/NO ERRORS
	 JMP I ERRORX	/NOT POSSIBLE
	JMP I STOPX

FILE,	CLA IAC		/SET NO DATA  FLAG
SPCF,	DCA FLAG
	TAD I FUNCX	/DETERMINE DIRECTION
	SMA CLA
	TAD M10		/FORWARD
	TAD C70
	JMS I MTHX
	   -1
	   3666		/ERROR MASK
	 JMP I ERRORX
	TAD MTSTAT	/EXAMINE STATUS
	AND C100	/FILE MARK?
	SNA CLA		/Y
	 JMP FILE	/NO
	ISZ I BLOCKX	/DONE ENOUGH?
	 SKP		/NO
	JMP I STOPX	/Y:STOP
	TAD FLAG	/ANY DATA SEEN?
	SZA CLA		/NO: DONT TRY FURTHER!
	 JMP SPCF	/Y:NEXT RECORD/FILE
	TAD C70		/BACKSPACE ONE REC.
	JMP EOF+1

C10,	10
C50,	50

PAGE	/END OF TC58 >