	.SYSID <	.TITLE DTF. >,< 108>
/
/COPYRIGHT (C) 1975
/DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
/ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
/THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
/SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
/VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
/EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
/THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
/SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
/
/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
/WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
/MITMENT BY DIGITAL EQUIPMENT CORPORATION.
/
/DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
/OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
	.EJECT
/ 107	06-JUN-75 (RCHM)	MAKE XVM CHANGES.
/ 108	07-NOV-75 (RCHM)	FINISH XVM CHANGES.
/10-14-70	EDIT 7
/W. A. DESIMONE
/9-16-69 (TIMING BUG)
/1-12-70 (ENDFILE BUG)
/8-26-70 (CLEAR SWITCHES SO CAN RESTART ON ^P; FIX RETURN
/	FOR FILE ORIENTED REQUESTS)
/DTF. = IOPS DECTAPE HANDLER FOR NON-FILE ORIENTED I/O
/LIMITED FUNCTIONS
/NO INTERNAL BUFFERS
/CALLING SEQUENCE
/CAL+.DAT SLOT(9-17) + I(7-8)/.INIT
/UNIT (0-2) +1(=FUNCTION)
/RESTART ADDR. (ONLY MEANINGFUL FOR TTY HANDLER)
/MAXIMUM BUFFER SIZE (255)
/CAL + .DAT SLOT (9-17)/.CLOSE - PERFORMS EOF
/UNIT (0-2) +6(=FUNCTION)
/CAL + SUBFUNCTION(5-8) + .DAT SLOT /.MTAPE	(00=REWIND
/UNIT (0-2) +7(=FUNCTION)			(02=BACKSPACE RECORD
/						(05=FORWARD SPACE RECORD
/CAL + DATA MODE(6-8) + .DAT SLOT(9-17)/.READ
/UNIT(0-2) + 10(=FUNCTION) (IOPS ASCII AND IOPS BINARY
/LINE BUF ADDR   DATA MODES ONLY)
/-WC OF L.B. (2'S COMP)
/SAME AS .READ (FUNCTION = 11)/.WRITE
/CAL + .DAT SLOT (9-17)/.WAIT
/UNIT 0-2) + 12(=FUNCTION)
/CAL + 1000 + .DAT SLOT(9-17)/.WAITR
/UNIT(0-2) + 12(=FUNCTION)
/15BIT BUSY ADDRESS
	.EJECT
	.GLOBL DTF.
.MED=3
/DECTAPE IOT ASSIGNMENTS
DTCA=707541		/CLEAR STATUS REGISTER A
DTXA=707544		/XOR AC TO STATUS REGISTER A
DTLA=707545		/LOAD STATUS REGISTER A FROM AC
DTRA=707552		/READ STATUS REGISTER A INTO AC
DTEF=707561		/SKIP ON ERROR FLAG
DTRB=707572		/READ STATUS REGISTER B INTO AC
DTDF=707601		/SKIP ON DECTAPE FLAG
DTF.	DAC DTCALP		/STORE CAL POINTER
	DAC DTARGP		/SET UP ARG. POINTER
	LAW 7000
	AND* DTCALP		/MASK (6-8)
	RAR!CLL			/SHIFT TO (15-17)
	RTR		/ROTATE 8 RIGHT
	RTR
	RTR
	RTR
	DAC DTCT		/TEMP. STORE DATA MODE OR SUBFUNCTION
	ISZ DTARGP		/INDEX TO FUNCTION AND UNIT #
	LAC* DTARGP		/MASK UNIT #
	AND DTUMSK		/DTUMSK=LAW -400
	DAC DTUNIT		/SAVE UNIT #
/LINK=0 - GET STATUS OF THIS DT UNIT
	RTL
	RTL			/RIGHT JUSTIFY UNIT #
	TAD (LAC DTMULP		/CONSTR. FOR DT STATE LAC
	DAC DTPVOT
	XOR (240000		/CONSTR. A DAC FOR DTUPDT
	DAC DTLOAD
DTPVOT	XX
	DAC DTSTAT		/STORE DT STATE
	RAR			/DTIOSW BIT TO 17
	AND DLIT1
	DAC DTIOSW		/SWITCH SET TO CURRENT STATUS
	SZL!CLA			/IF L=0, SET DTFTR=0
	CMA			/IF L=1, SET DTFTR=777777
	DAC DTFTR
	XOR DTDECR
	SPA!CLC			/IF NEGATIVE, DTFTR AND DTDECR AGREE
	JMP .+4			/IF POSITIVE, MUST COMPLEMENT DTDECR
	TAD DTDECR		/GET TWO'S COMPLEMENT
	CMA!CLL
	DAC DTDECR		/NOW UPDATE
	LAC DTSTAT
	RTR			/BITS 4-15 TO 6-17
	AND (7777			/MASK OFF DTNXBK
	SAD (7777
	LAW -5			/SET TO -5 IF
	DAC DTNXBK
	LAC DTSTAT
	RTL			/RESULTING L=0 BECAUSE BIT 3=0 ALWAYS
	RTL
	AND DLIT7
	DAC DTMPAS
	LAC* DTARGP		/INDEX TO ARG. 3
	ISZ DTARGP
	AND (77
	TAD (JMP DTTABL
	DAC DTTABL
DTTABL	XX
	JMP DTINIT		/1=.INIT
	JMP DTIGNR		/2=.OPER IGNORE
	JMP DTIGNR		/3=.SEEK IGNORE
	JMP DTIGNR		/4=.ENTER IGNORE
	JMP DTER6		/5=.CLEAR ILLEG.
	JMP DTCLOS		/6=.CLOSE
	JMP DTMTAP		/7=.MTAPE
	JMP DTREAD		/10=.READ
	JMP DTWRIT		/11=.WRITE
	JMP DTWAIT		/12=.WAIT, .WAITR
DTER6	LAC DLIT6		/13=.TRAN
	JMP DTEROT	/ILL FUNCTION; IOPS 6
DTIGNR	ISZ DTARGP	/BUMP CAL POINTER SO RETURN TO CORRECT PLACE.
	CLA		/MUST RETURN WITH AC=0.
	JMP DTFBK	/
IOPS67	LAW 67			/(RCHM-107) FETCH ILLEGAL MEMORY MESSAGE.
	JMP DTEROT		/(RCHM-107) GO PRINT ERROR.
	.EJECT
/I/O UNDERWAY CHECK SUBROUTINE DTUND = 0 IMPLIES I/O NOT UNDERWAY
DTIOU	0
	LAC DTUND
	SZA!CLL!CMA		/I/O UNDERWAY? LINK CLEARED FOR USE IN DTMCK
DTBUSB	JMP DTBUSY	/YES
	JMP* DTIOU	/NO. EXIT
DTBUSY	LAC DTCALP	/CAUSE HANG ON USER CAL
	DAC DTARGP
	JMP DTFBK	/EXIT ON HANG.
/DTF. INTERRUPT SERVICE
DTIN	JMP DTPIC	/JMP FOR PI ENTRY
	DAC DTAC	/STORE AC FOR API ENTRY
	LAC DTFVSW-1	/DTFVSW-2 = LAC DTAC
	DAC DTFVSW	/LEAVE PIC ALONE ON EXIT
	LAC DTIN	/FOR API. CONTAINS PC,L,EM,MP
	JMP DTCOM	/COMMON EXIT
DTPIC	DAC DTAC	/SAVE AC ON PI ENTRY
	LAC DTSVTM	/ALLOW FOR PIC TO BE TURNED ON DTSUTM = ION
	DAC DTFVSW	/AGAIN AT EXIT IN PI ENVIRONMENT
	LAC* DTMBAK	/DTMBAK = 0. GET PC,L,EM,MP FOR PI
DTCOM	DAC DTOUT
	LAC DTUND		/I/O UNDERWAY?
	SZA		/NO. STOP TAPE
	JMP DTRBB
	DTLA		/CLEAR CONTROL
	JMP DTFISM
/STATUS B-0 = EF
/         1 = MARK TRACK ERROR
/         2 = EOT
/         3 = SELECT ERR.
/         4 = PARITY ERR.
/         5 = TIMING ERR.
/         11= DTF
/STATUS A-0-2 = UNIT #
/         3 = FORW.(0) REVERSE(1)
/         4 = STOP(0), GO(1)
/         5 = NORM.(0), CONT.(1)
/         6-8 = FUNCTION
/         9 = DISABLE DTF, EF(0), ENABLE(1)
/         10= CLEAR EF(0)
/         11= CLEAR DTF(0)
DTRBB	DTRB		/READ DTF STATUS B
	SMA		/ANY ERRORS?
/DTFIS = JMP DTSRCK ON SEARCH
/DTFIS = JMP DTRDWR ON READ OR WRITE
DTFIS	XX
	AND (330000
	SZA!RTL
	.EJECT
/DTERJ = JMP DTRLE ON MOVE REVERSE
/DTERJ = JMP DTERS ON SEARCH
/DTERJ = JMP DTERT ON READ OR WRITE
DTERJ	XX
	DTRA		/ON A SELECT ERROR EXAMINE STATUS A
	AND DLCMA		/ONLY BITS 0-11 READ IN
/SAVE UNIT#,FW-REV BIT
	DAC DTT2	/SAVE BITS O=>3 FOR FUTURE IOT
	DTLA+10		/CLEAR ST. REG. A,FLAGS, DISABLE FROM INT.
	LAC (DTRYAG	/GO TO .MED FOR MANUAL READY
	DAC* DLIT3	/(.MED) SET UP EXIT FROM RESM.
	DZM DTUND		/CLEAR TO ALLOW ^P RESTART.
	LAC DLIT4	/IOPS 4 AND WAIT FOR ^R
	JMP* DLIT4	/(.MED + 1)
DTRYAG	LAW -1
	DAC DTUND		/RESET I/O UNDERWAY SWITCH.
	LAC DTRWSW	/REWIND ATTEMPTED?
	SPA
	JMP DTSRW	/REWIND
	JMS DTSRCH	/NO REWIND. REENTRY FOR RETRY
	LAC DTT2	/RESTORE 0=>3 OF STATUS A
	XOR (21400	/SET UP FOR DTXA-FORCE A SEARCH
	JMP DTXIOT
DTSRW	LAC DTT2	/REWIND - FORCE A MOVE REVERSE
	XOR (20400)	/SET UP FOR DTXA
	JMP DTXIOT
/ERROR IN SEARCH MODE
DTERS	SPA
	JMP DTEOT	/EOT - CHANGE DIRECTION OR DT FULL
	SNL		/MARK TRACK ERROR - IRREC.
	JMP DTPR2		/TIMING ERROR - TRY AGAIN
DTERS1	DTRA		/GET UNIT #
	RTL
	RTL
	AND DLIT7		/INTO 15-17
	DTRB-10		/IOR STATUS B
	DAC* DLIT3	/(.MED)
DTCLA	CLA		/IRREC. DT ERROR - IOPS 12
	JMP DTER12	/MARK TRACK OR EOT DURING SEARCH
/ERROR DURING READ OR WRITE
DTERT	SZL!SPA!RTL	/PARITY OR TIMING
	JMP DTERS1	/IRREC. MT OR EOT DURING TRANSFER
	SMA!STL		/SET LINK IN CASE OF TIMING ERROR
	JMP DTTIM	/TIMING ERROR - RETRY
DTPART	ISZ DTERCT	/PARITY ERROR
	JMP DTTIM-1	/COUNT NOT EXHAUSTED - RETRY
	LAC DTMBAC+1	/SET VALIDITY BITS
	XOR* DTUFP	/FOR PARITY ERROR
	DAC* DTUFP
	.EJECT
DTPRGO	DZM DTUND	/REINIT I/O UNDERWAY SWITCH
	DZM DTEOTZ	/REINIT DOUBLE END ZONE SWITCH
DTPR2	LAC (20000	/CLEAR GO BIT (SET IF TIMING)
	JMP DTXIOT
	CLL		/PARITY ERROR
DTTIM	JMS DTSRCH	/SET UP FOR SEARCH
	LAC DTTR	/CLEAR OUT READ OR WRITE BITS		
	SZL		/PARITY
	XOR (20000	/SET GO BIT IF TIMING
	DTXA
	JMP DCHK2
DCHKF	LAC DTFTR	/LOAD TRANSFER DIRECTION
	XOR DTBLNC
DLITSM	SMA!CLA
	JMP DCHKC3
	LAC DTWC
	DAC* (30	/SET UP WC - 2'S COMPL.
	LAC DTFCA	/CA -1 FOR TRANSFER
	DAC*	(31
	LAC (JMP DTRDWR	/LOAD FOR TRANSFER COMPLETE
	DAC DTFIS
	LAC (JMP DTERT	/FOR ERROR DURING TRANSFER
	DAC DTERJ
	LAC DTTR	/READ OR WRITE
DTXIOT	DTXA
DTFISM	LAC (JMP DTPIC	/RESTORE PIC INTERRUPT ENTRY
	DAC DTIN
	LAC DTAC	/RESTORE AC
DTFVSW	XX		/ION IF UNDER PI - LAC DTAC IS UNDER API
	DBR
	XCT .+1		/PRESERVE IOT CHAIN
	XCT .+1
	JMP* DTOUT	/DTOUT = 0 IF PI DTOUT = DTIN IF API
DTRDWR	LAC DTTR	/RETURNING FROM READ OR WRITE
	SAD (15000	/A WRITE?
	JMP DTPRGO	/DON'T CALCULATE CHECKSUM ON WRITE
	LAC (20000	/ON A READ
	DTXA		/STOP DT
	.EJECT
/INTERRUPT TURNED ON TO ALLOW EXIT
DTSVTM	ION		/ALLOW INTERRUPT
	LAC* DTUFP
	JMS DTWGPC	/CALC. WC FROM USER HEADER 0
	LAC DTWPC	/LOAD CALC. WC
	TAD DTUWC	/ADD 2'S COMP. OF WC FROM .READ
	SMA!CLA		/> OR = 0 IF SHORT LINE
	JMP DTSHRT	/GO SET VALIDITY BITS
	LAC DTUFP	/LOAD PTR. TO USER W0
	DZM DTCKSM	/CLEAR CHECKSUM COUNT
	JMS CALCKS	/GO CALC. CHK SUM.  RETRN IN AC
	SNA!CLA		/SKP IF CHK SUM NOT 0
	JMP DTRLEV	/NO CHK SUM OR SHRT LINE PROBLEM
	SKP
DTSHRT	TAD (20
	TAD (40
	XOR* DTUFP	/SET VALIDITY BITS
	DAC* DTUFP	/REDEFINE
DTRLEV	DZM DTEOTZ	/REINIT DOUBLE END ZONE SWT AND
DTRLE	DZM DTUND	/REINIT IO UNDERWAY SWT.
	DZM DTRWSW	/RESET REWIND SWITCH
	CLA		/MUST RESELECT UNIT ON EOT HIT ON REWIND
	JMP DTXIOT	/EXIT
/SEARCH INTERRUPT SERVICE
DTSRCK	CLC
	DAC DTEOTZ	/CLEAR DOUBLE END ZONE SWITCH
	LAC DTBCA	/BLOCK JUST READ
	SAD DTBLC	/BLOCK SEARCHED FOR
	JMP DCHKF	/MAYBE - CHECK DIRECTION
DLCMA	CMA
	TAD DTBLC	/BLK SEARCHED FOR - BLK READ
DCHKC	SMA!CLA		/OVERSHOOT FORWARD OR SPA!CLA = REV.
	JMP DTXIOT	/CONT. SEARCH IN SAME DIRECTION
DTEOT	DAC DTEOTS	/SET (0) OR CLEAR (-) EOT SWITCH
DCHK2	LAC DTBLNC	/FORM: SUB. 2 FROM BLK TO SEARCH
DCHKC3	TAD DTNXBK	/REV.: ADD 2 TO BLK TO SEARCH
	DAC DTBLC
	CLC		/CHANGE SIGN OF BLK INCREM. FOR
	TAD DTBLNC	/NEXT DIRECTION CHANGE
	CMA
	DAC DTBLNC
	LAC DTEOTS	/END ZONE ENTERED SWITCH
	SMA
	JMP DCHK4	/END ZONE ENTERED
	ISZ DTEOTZ	/DOUBLE END ZONE SWITCH SET?
	JMP DCHK4	/NO
	LAC DTNXBK	/STORE BLK TO TRANSFER
	DAC DTBLC	/INTO BLK TO SEARCH FOR
	.EJECT
/INSURES CORRECT SETTING OF DTBLC ON 1ST ENTRY INTO END ZONE
DCHK4	LAC DCHKC
	XOR (1000	/OR VICE VERSA
	DAC DCHKC
	LAC DTEOTS	/EOT SWITCH
	RAL		/L = 1 = EOT
	LAC (40000	/MOTION BIT
	SZL		/L NON-ZERO IS EOT
	XOR (20000	/SET GO BIT SINCE EF SETS GO BIT TO STOP
	DZM DTEOTS	/CLEAR EOT SWITCH
	JMP DTXIOT	/CHANGE SEARCH DIRECTION
DTINIT	ISZ DTARGP	/INDEX TO BUFFER SIZE ARG.
	LAC (377	/MAX BUFFER SIZE - 
	DAC* DTARGP
	DZM DTRWSW	/REINIT REWIND SW IN CASE ^P
	LAC DTCT	/USED DATA MODE OR SUBFUNCTION A SWITCH SET
	DAC DTIOSW	/LOAD SWITCH TO 0 IF INPUT
	ISZ DTARGP	/FOR NORMAL EXIT
DTONCE	CAL 44		/ONCE ONLY CODE FROM HERE TO DTSTOP
/DTWC - WC FOR WC WORKING RESISTER
	/DTTR = IOT SETUP -
	/DTOUT = EXIT ADDRESS
	/DTCCA = CA-1 REGISTER
	/DTUCKP = CHECKSUM POINTER
	/CKSCNT = COUNTER IN CHECKSUM CALCULATOR
	/DTT2 = STORAGE FOR BITS 0-3 OF STATUS A
	/DTERCT - PARITY RETRY COUNT
	/DTAC - SAVE AC REGISTER
DTWC	16
DTTR	DTDF
DTOUT	DTIN
DTCCA	CAL 44
DTUCKP	16
CKSCNT	DTEF
DTT2	DTIN
DTERCT	LAC (JMP DTSTOP	/RESET FOR JUMP OVER ONCE ONLY CODE
DTAC	DAC DTONCE
	.EJECT
DTSTOP	JMS DTIOU	/ALLOW FOR I/O BUSY TEST?
	JMP DTREXT
DTMTAP	JMS DTIOU	/I/O UNDERWAY?
	LAC DTMTP2-1
	DAC TRENTR	/TRANSFER ENTRY
	LAC DTCT	/LOAD .MTAPE FUNCTION
	SNA
	JMP DTMREW	/REWIND
	SAD DLIT2	/A 2?
	JMP DTBKSP	/BACKSPACE
	SAD DLIT5	/A 5?
	SKP!CLC		/ALLOW FOR 2'S COMPL. OPERATION AND FORWARD SPACE
TRENTR	JMP DTREXT	/IGNORE FUNCTIONS NOT = 00,02,05
	TAD DTDECR	/-5 IF FORWARD .+5 IF REVERSE
	CMA!CLL		/MUST MAKE +5 FOR FORWARD, -5 FOR REVERSE
	TAD DTNXBK	/INDEX FOR FORWARD SPACE
	JMP DTFORS	/SET BLK UP 5 AND CHECK TURNAROUND
DTBKSP	LAC DTNXBK	/DECTAPE BACKSPACE
	SAD DTMREW+2	/IS IT -5
	JMP DTREXT	/YES.  IGNORE BACKSPACE
	TAD DTDECR	/DECREMENT BLOCK # BY 5
	DAC DTNXBK		/STORE IN CASE VALID
	SAD DLIT2	/IF 1,2,1075,OR 1103, MUST TURN
	SKP		/AROUND
	SAD DLIT1
	SKP
	SAD (1075
	SKP
	SPA
	JMP DTMTP2
	TAD DL1100	/IN END ZONE?
	SMA
	JMP DTMTP2	/YES.  TURN AROUND
	JMP DTREXT	/COMMON EXIT
DTMTP2	SAD DTMREW+2
	JMP DTREXT	/NO TURN AROUND
	LAC DTMPAS
	TAD DTLMK	/DTLMK = LAC DTMBAK
	DAC .+1
	XX
	DAC DTNXBK	/RESET CURRENT BLK #
	.EJECT
DFLPLT	JMS DTMFLP	/RESET DTMPAS AND REVERSE TRANS. DIR. SWT.
	LAW -2		/TO CORRECT FOR BUMP OF DTMPAS
	TAD DTMPAS	/IN ROUTINE DTMFLP
	DAC DTMPAS
	JMP DTREXT	/COMMON EXIT
DTFORS	SPA		/PROCESS FORWARD SPACE
	JMP DTNFBT	/YES ON A TURNAROUND
	DAC DTNXBK	/STORE IN CASE NOT ON TURNAROUND
	TAD DL1100
	SPA!CLL		/CLEAR LINK FOR DTUPDTL		
	JMP DTREXT	/NO TURNAROUND - COMMON EXIT
DTNFBT	LAC DTMPAS
	SAD DLIT4	/NO MORE TAPE
	JMP DTFULL	/DECTAPE FULL.  ERR MSG 15
	TAD DTLMC	/DTLMC = LAC DTMBAC
	DAC .+2
	JMS DTMFLP	/FLIP DECREMENT, TRANS. DIR. SWT., BUMP DTMPAS
	XX
	DAC DTNXBK	/STORE NEW TURNAROUND BLOCK
DTREXT	JMS DTUPDT	/COMMON EXIT
	LAC DTRSWT
	SNA
	JMP DTFBK	/NOT A TRANSFER - A BKSP OR FWSP OR REWIND
	DZM DTRSWT	/A TRANSFER. REINIT SWITCH AND EXIT
	JMP* TRENTR	/THROUGH SUBROUTINE ENTRY PT.
DTMFLP	0
	ISZ DTMPAS	/BUMP FOR CASE OF FORSPACE - NULLIFIED BY TAD (-2
	LAC DTFTR	/IN CASE OF BACKSPACE
	CMA
	DAC DTFTR
	CLC		/GET 2'S COMPL. OF DTDECR
	TAD DTDECR
	CMA
	DAC DTDECR
	JMP* DTMFLP
DTFULL	DZM DTMPAS
	DZM DTNXBK
/DTDECR=-5, DTFTR=0 ALREADY - AC SHOULD = 4
	JMS DTUPDT	/UPDATE DT STATUS REGISTERS
	LAC (DTREXT	/SET FOR REENTRY
	DAC* DLIT3
	LAC DLIT4
	JMP* DLIT4	/GO OUTPUT IOPS 4
	.EJECT
/BACKSPACE, FORWARD SPACE TURNTABLE + EOF BUFFER
DTEOFH	2005		/EOF HEADER WORD 0
TWOCOM	775773	/TWOS COMPLEMENT CHECKSUM
DTMBAK	0		/MUST REMAIN ZERO
	1077
DLIT4	4
	1073
DLIT3	3
DTMBAC	1076
DLIT6	6
	1070
DLIT7	7
DLIT1	1
DLIT2	2
DTFMOD	0		/STORAGE FOR DATA MODE
DTFCA	0		/STORAGE FOR CA -1
DTUFP	0		/FIXED PTR. TO WORD 0
DTBLC	0		/STORAGE FOR BLOCK LOOKED FOR
DTUWC	0		/STORAGE FOR USER WORD COUNT
DTMPAS	0		/INITIAL VALUE OF PASS
DL1100	-1100		/FOR TEST ON TURN AROUND
DTARGP	0		/DTF CAL ARGPOINTER
DTCALP	0		/DTF CAL POINTER
DTBLNC	0		/BLK. DECR. +2 OR -2
DTRSWT	0		/DT WC FOR WC REGISTER
DTIOSW	0		/DT I/O SWITCH
DTMTP4	JMP DTAPE1
DTLMK	LAC DTMBAK
DTLMC	LAC DTMBAC
DTWPC	0		/DT WC IN 2'S COMPL.
DTHPT	0		/DT WORD 0 WORKING PTR.
DTEOTZ	0		/DOUBLE END ZONE SWT
DTEOTS	0		/EOT SWT. FOR SEARCH SERVICE
DTCT	0		/TEMP STORAGE FOR DM OR FUNCT.
DLIT5	5
DTUNIT	0		/DT UNIT # STORAGE
DTUND	0		/ I/O UNDERWAY SWIT. 0 IF NOT
DTCLSW	777777		/.CLOSE DONE SWITCH
DTCKSM	0		/CHKSUM STORAGE
DTBUIL	0		/T-DTSTAT
DTSTAT	0		/DT STATE
DTFTR	0		/DT TRANSF DIR.  0=F, 777777=R
DTDECR	-5		/WRITE ON EVERY FIFTH BLOCK
DTBCA	0		/BLOCK JUST READ
DTNXBK	-5	/ALLOW FOR BUMP BEFORE SEARCH
DTUMSK	LAW -400		/MASK FOR CAL PROCESSOR
DTRWSW	0	/REWIND SW.  <0 IF ON.
CALCKS	0	/ROUT. TO CALCULATE CHKSUM
	DAC DTUCKP
	LAC DTUWC
	DAC CKSCNT
CKAGAN	LAC* DTUCKP	/LOAD WORD 0
	TAD DTCKSM
	DAC DTCKSM	/STORE CUMULATIVE TOTAL
	ISZ DTUCKP	/BUMP PTR.
	ISZ CKSCNT	/BUMP COUNTER
	JMP CKAGAN	/REPEAT
	JMP* CALCKS
DTWGPC	0
	RTR
	RTR
	RTR
	RTR
	AND (776
	DAC DTWPC	/NOW WORD COUNT
	SNA
	JMP DTER23
	AND (400
	SNA!CLA
	JMP* DTWGPC
DTER23	TAD DLIT5		/IOPS 23
	JMP DTER16
	.EJECT
DTMREW	DZM DTMPAS	/INIT PASS COUNT
	DZM DTFTR	/SET TRANSFER DIRECTION FORWARD
	LAW -5
	DAC DTDECR	/INIT FOR EVERY 5TH BLOCK
	DAC DTNXBK	/SET SO BUMP OF BLOCK ON TRANSF. GIVES 0
	DAC DTUND	/SET I/O UNDERWAY SWITCH
	DAC DTRWSW	/SET REWIND SWITCH
	LAC (JMP DTRLE
	DAC DTERJ	/FOR EXIT ON INTERRUPT
	LAC (60400	/REWIND VIA A MOVE REVERSE
	XOR DTUNIT	/LOAD UNIT #
	DTLA
	JMP DTREXT	/NORMAL EXIT
DTREAD	JMS DTIOU	/I/O UNDERWAY
	LAC (13000	/FOR READ SET UP
	JMS DTMCK	/COMMON READ - WRITE SETUP - RETURNS WITH AC=777777
	DZM DTCKSM	/CLEAR CHKSUM
	TAD DTHPT	/ENTER WITH CA -1
	JMS DTWCS
DTAPE1	ISZ DTARGP	/BUMP TO NORMAL
	JMP DTFBK	/EXIT
DTMCK	0		/COMMON READ - WRITE SETUP
	DAC DTTR
	DAC DTRSWT	/SET TRANSF. SWT.
	LAC* DTARGP	/GET USER BUFFER POINTER
	DAC DTHPT	/WORKING POINTER IN USER BUFFER
	DAC DTUFP	/FIXED PTR.
	LAC* DTARGP		/(RCHM-108)
	AND (700000)		/(RCHM-107) EXTRACT EXTENDED MEMORY BITS.
	SZA			/(RCHM-107) ARE ANY OF THEM ON?
	JMP IOPS67		/(RCHM-107) YES, GIVE EXTENDED MEMORY VIOLATION.
	ISZ DTARGP	/BUMP POINTER
	LAC* DTARGP	/GET USER WC - 2'S COMP. - FROM PSEUDO OP
	DAC DTUWC	/USER WC
	LAC DTCT	/DATA MODE
	DAC DTFMOD	/STORE DATA MODE
/LINK SHOULD BE CLEARED IN DTIOU ROUTINE
	RTR		/0 OR 2 DATA MODE TEST ONLY!
	SNA!CLC		/COMPL. AC IN CASE OF ERROR
	JMP* DTMCK	/DATA MODE O.K. EXIT
	JMP DTER10	/IOPS7 - ILLEGAL DATA MODE
	.EJECT
DTWCS	0		/SUBROUTINE TO SET UP CA,WA
	DAC DTFCA	/CURRENT ADDRESS REGISTER
	LAC DTUWC	/2'S COM. OF WC FROM USER CAL OR HEADER 0
	DAC DTWC	/STORE FOR FUTURE SET UP OF WA
	LAW -10		/PARITY ERROR RETRY COUNT
	DAC DTERCT	/REINIT
	DAC DTUND	/SET I/O UNDER WAY
	CLC		/NEED 777777 IN AC FOR ENTRY TO TRENTR
	JMS TRENTR	/FORWARD SPACE TO FIND BLOCK TO SEARCH FOR
	LAC DTFTR	/TRANSF. DIRECTIONS SWT.
	AND (1000
	XOR DLITSM	/SMA!CLA = SEARCH FORWARD
	DAC DCHKC	/SPA!CLA = SEARCH REVERSE
	LAC DTNXBK
	DAC DTBLC
	LAC DTFTR	/TRANSF. DIRECTION 0=F,777777=R
	SMA!CLA		/CAUSE DTBLNC=-2 ON F TRANSF.
	LAW -4		/CAUSE DTBLNC=+2 ON R TRANSF.
	TAD DLIT2
	DAC DTBLNC	/SEARCH BLK INCREMENT FOR TURNAROUND SLACK
	JMS DTSRCH	/SET UP FOR SEARCH
	LAC DTFTR
	AND (40000	/UNIT + 21400 = SEARCH FORWARD
	XOR (21400	/UNIT + 61400 = SEARCH REVERSE
	XOR DTUNIT	/LOAD UNIT #
	DTLA
	JMP* DTWCS	/EXIT BACK
DTWRIT	JMS DTIOU	/I/O UNDERWAY?
	LAC (15000	/NO
	JMS DTMCK	/COMMON READ - WRITE SETUP ROUTINE - 1
	LAC* DTUFP		/LOAD WORD 0
	JMS DTWGPC	/GO CALCULATE WC FROM USER WORD 0
	LAC* DTUFP	/LOAD WORD 0 OF USER BUFFER
	AND DLIT7		/MASK BITS
	SAD DLIT5		/EOF?
	JMP DTPASM-1		/FORGET LOADING DATA MODEP DTPASM
	SAD DLIT6		/EOT?
	DAC DTFMOD	/OVERRIDE DATA MODE FOR EOT INDIC.ATION OR EOF INDIC
DTPASM	LAC* DTUFP	/IT IS O.K. SINCE DATA MODE CHECKED IN DTMCK
	AND (377000	/SAVE UP COUNT
	XOR DTFMOD
	DAC* DTUFP	/RESTORE MODIFIED WORD 0
	.EJECT
DTWRT4	DZM DTCKSM	/INIT CHECKSUM COUNT
	ISZ DTHPT	/BUMP TO WORD 1
	DZM* DTHPT	/ZERO WORD 1 FOR CHECKSUM CALCULATION
	LAW -377
	JMS DTOBCK	/CHECK USER BUFFER SIZE
	CLC		/GET TWO'S COMPL. OF WC
	TAD DTWPC
	CMA
	DAC DTUWC	/2'S COMPL OF WC-FOR DEFINING CHKSUM COUNTER
	LAC DTUFP	/WORD 0
	JMS CALCKS	/CALCULATE CHKSUM
	CMA
	TAD DLIT1	/2'S COMP OF CHKSUM
	DAC* DTHPT	/LOAD CHKSUM
	CLC
	TAD DTUFP	/CA-1
	JMS DTWCS	/SUBROTINE TO SET UP EC,CA & SEARCH
	JMP DTAPE1	/NORMAL EXIT
DTOBCK	0
	TAD DTWPC	/LBWC
	SPA!CLA
	JMP* DTOBCK	/NO BUFFER OVERFLOW
DTER16	TAD DLIT2	/BUFFER OVERFLOW
			/DECTAPE FULL
DTER14	TAD DLIT2	/DTA DIRECTORY FULL-NOT USED **
			/FILE NOT FOUND-NOT USED **
DTER12	TAD DLIT2	/IRREC. DTFERR.MK.TIK,EOT DURING TRANSFER
			/.SEEK OR .ENTER NOT EXECUTED-NOT USED **
DTER10	TAD DLIT2	/FILE STILL ACTIVE-NOT USED
			/ILLEG. DATA MODE
	TAD DLIT6		/ILLEG.  HANDLER FUNCTION
DTEROT	DZM DTUND		/CLEAR SO CAN RESTART ON ^P.
	JMP* DLIT4	/KM-9 ERR. LOC (.MED+1)
DTSRCH	0		/SET UP FOR DECTAPE SEARCH
	LAC (DTBCA	/SET UP CA AND WC FOR SEARCH
	DAC* (31
	DZM* (30	/ZERO WC
	LAC (JMP DTSRCK	/SET UP INTERRUPT SERVICE FOR SEARCH
	DAC DTFIS
	LAC (JMP DTERS	/SET UP FOR ERROR CHECK IN SEARCH MODE
	DAC DTERJ
	JMP* DTSRCH
DTCLOS	JMS DTIOU	/I/O UNDERWAY
	ISZ DTCLSW	/INIT. 777777
	JMP DTCLDN	/.CLOSE FINISHED--AC=777777
	LAC DTIOSW	/I OR O
	SNA!CLC
	JMP DTCLDN	/INPUT-RESET SWITCHES 2 EXIT
	LAC (-3		/OUTPUT - 2'S COMPL. OF WORD COUNT FOR EOF
	DAC DTUWC
	LAC (15000
	DAC DTRSWT	/SET TRANSFER SWITCH FOR CORRECT EXIT IN DTREXT
	DAC DTTR
	LAC (DTEOFH-1	/LOAD PTR. TO EOF HEADERS MINUS ONE
	JMS DTWCS
	JMP DTBUSY	/GO HANG ON .CLOSE
DTCLDN	DAC DTCLSW	/RESET TO 777777
	JMP DTFBK	/NORMAL EXIT
DTWAIT	LAC DTCT	/WAIT DTF ROUTINE
	SNA		/1 IF .WAITR
	JMP DTFBK-1	/NO. HANG ON .WAIT
	LAC (700000	/LINK ETC.
	AND DTCALP
	DAC DTCALP
	LAC* DTARGP	/15 BIT BUSY ADDR.
	AND (77777
	XOR DTCALP
	ISZ DTARGP
	DAC DTCALP
	JMS DTIOU
DTFBK	DBR
	XCT .+1
	XCT .+1
	JMP* DTARGP	/NORMAL EXIT
DTUPDT	0
	LAC DTIOSW
	RAL!CLL
	DAC DTBUIL	/SAVE BIT 16----DTIOSW
	LAC DTMPAS	/L=0
	RTR		/TO BITS 0 TO 2
	RTR
	XOR DTBUIL	/ADD TO STATE BUILD
	DAC DTBUIL	/STORE IN BUILD REGISTER
	LAC DTFTR	/UPDATE TRANSF. DIRECTION
	AND DLIT1	/MASK BIT 17
	XOR DTBUIL	/SET BIT 17 IN DTSTAT BUILDER
	DAC DTBUIL
	LAC DTNXBK
	SPA		/SKIP IF NOT SPEC. CASE -5
	CLC		/777777 IN AC IF LESS THAN 0
	AND (7777	/MASK OFF 12 BITS
	RTL
	XOR DTBUIL	/LOAD BITS 4-15 WITH DTNXBK
DTLOAD	XX	/WILL BE A DAC DTMULP+DT UNIT #
	JMP* DTUPDT	/EXIT
 
/MULTIUNIT DECTAPE STATUS TABLE
/DTNXBK,DTFTR,DTMPAS,DTIOSW INFORMATION STORED IN ONE WORD FOR EACH UNIT
/BIT ASSIGNMENT FOR DT UNIT STATUS WORD:
/BITS 0-2=DTMPAS BIT3=0 ALWAYS BITS 4-15=DTNXBK(=7777 IF DTNXBK=-5)
/BIT16=DTIOSW (0=INPUT, 1=OUTPUT) BIT17=DTFTR (0=FORWARD, 1=REVERSE)
/INITIALLY BITS 4-15=1 ALL OTHERS=0
DTMULP=.
	.REPT 10
	37774
	.END
