	.TITLE DTQ.
/
/ 12-OCT-73 MOD BY R. C. P. TO REMOVE CONFLICTS ON 'DT11PK'
/ 11-OCT-73  MOD BY R. C. PEARCE FOR PDP-11 FILE STRUCTURE
/		TO INCLUDE IMAGE MODES
/		AND TO IGNORE 'RUBOUTS' IN ASCII
/  21 AUG 72 - MOD BY P. HENDERSON FOR PDP-11 FILE STRUCTURE
/
/COPYRIGHT 1970, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/M. SIFNAS
/10-8-70	EDIT 6
/8-26-70 (SWITCH CLEARING ON ERRORS SO CAN RESTART ON ^P)
/9-16-69 (TIMING BUG, REMOVAL OF XX ON IOPS15)
/P OLYNK (.MTAPE DELETE 7-28-69)
/ 4-9-68 (IOPS 23 5-8-68)(56 FILES 5-8-68)
/(EOF 5-22-68) (PARITY 6-3-68)
/DTQ.=IOPS DECTAPE HANDLER-READ, WRITE, ALL MODES
/ALL FUNCTIONS EXCEPT .MTAPE
/1-256 WD. BUF.
/1 FILE BIT MAP (32 WDS) + 1 DIRECTORY BIT MAP (32 WDS)
/1 FILE ACTIVE AT ANY GIVEN TIME
/CALLING SEQUENCE
/CAL+.DAT SLOT(9-17)+I(7-8)/.INIT
/UNIT (0-2)+1
/RESTART ADDR. (ONLY MEANINGFUL FOR TTY HANDLER)
/BUF SIZE (255)
/CAL+X(6-8)+.DAT SLOT (9-17) /.OPER	(X=1=.DLETE)
/UNIT (0-2)+2		(X=2=.RENAM)
/			(X=3=.FSTAT)
/DIR TYPE(0-2)=1+CORE ADDR. (3-17)
/CAL+.DAT SLOT (9-17)  /.SEEK
/UNIT (0-2)+3
/USER DIRECTORY ENTRY POINTER
/SAME AS .SEEK(FUNCTION=4) /.ENTER
/CAL+.DAT SLOT (9-17)  /.CLEAR
/UNIT(0-2)+5
/CAL+.DAT SLOT(9-17)  /.CLOSE
/UNIT(0-2)+6
/CAL+SUBFUNCTION(5-8)+.DAT SLOT /.MTAPE (0=REWIND)            (ILLEGAL FUNCTION)
/UNIT(0-2)+7			(2=BACKSPACE RECORD)  (ILLEGAL FUNCTION)
/CAL+D.M.(6-8)+.DATSLOT(9-17)  /.READ
/UNIT (0-2)+10
/LINE BUF ADDR
/-WC OF L.B. (2'S COMP)
/SAME AS .READ(FUNCTION=11)  /.WRITE
/CAL+.DAT SLOT(9-17)	/.WAIT
/UNIT(0-2)+12
/CAL+1000+.DAT SLOT(9-17)		/.WAITR
/UNIT(0-2)+12
/15BIT BUSY ADDR
/CAL+Y(7)+X(8)+.DAT SLOT (9-17) /.TRAN	(X=0=READ)(Y=0=FORWARD)
/UNIT (0-2)+13			(X=1=WRITE) (Y=1=REVERSE)
/BLOCK#
/CORE ADDRESS
/-WC
/
	.EJECT
	.GLOBL	DTQ.
/
.MED=3
/IOT ASSIGNMENTS
DTCA=707541
DTXA=707544
DTLA=707545
DTRA=707552
DTEF=707561
DTRB=707572
DTDF=707601
DELTA=4
/
DTQ.	DAC	DTCALP		/CAL POINTER
	DAC	DTARGP		/ARG. POINTER
	LAC* DTCALP			/.DAT SLOT IN BITS 9-17.
	AND (777
	DAC DATSLT		/SAVE FOR COMPARISON WITH PREVIOUS .DAT SLOT.
	LAW	7000
	AND*	DTCALP		/(6-8) TO (15-17)
	RAR!CLL
	RTR
	RTR
	RTR
	RTR
	DAC	DTCT		/T STORE DATA MODE OR SUBFUNCTION
	ISZ	DTARGP		/INDEX TO FUNCTION (AND UNIT#)
	LAC*	DTARGP
	AND	DTUMSK
	DAC	DTUNIT		/T. SAVE UNIT#
	LAC*	DTARGP		/FUNCTION (3-17)=1-13
	ISZ	DTARGP		/INDEX TO ARG.3
	AND	(77
	DAC DTSTPA		/TEMP STORAGE OF FUUCTION.
	TAD	(JMP DTTABL
	DAC	DTTABL
	LAC DATPST		/SEE IF TRYING TO USE MORE THAN 1 .DAT SLOT
	SAD DATSLT		/(THEREFORE HAVING MORE THAN 1 FILE OPEN CONCURRENTLY).
	JMP DTTABL-1		/NO - OK.
	SNA
	JMP FIXDAT		/IF 0, FIRST TIME THRU OR ON AN .INIT.
	LAW -3
	TAD DTSTPA		/ALLOW THE FOLLOWING FUNCTIONS THRU:
	SPA			/.INIT,.OPER, .WAIT AND .TRAN.
	JMP FIXDAT
	TAD (-7
	SMA
	JMP FIXDAT
DTER17	JMS DTIOU		/CAN'T LEAVE ON ERROR TILL NOT BUSY.
	LAW 17			/IOPS 17: TOO MANY FILES.
	JMP DTEROT
FIXDAT	LAC DATSLT		/OK - RESET PAST .DAT SLOT.
	DAC DATPST
	CLA			/AC MUST=0 FOR DISPATCH
	.EJECT
DTTABL	XX
	JMP	DTIN	/1=.INIT
	JMP	DTOPER	/2=.OPER
	JMP	DTSEEK	/3=.SEEK
	JMP	DTENTR	/4=.ENTER
	JMP	DTCLER	/5=.CLEAR
	JMP	DTCLOS	/6=.CLOSE
	JMP	DTER6	/7=.MTAPE
	JMP	DTREAD	/10=.READ
	JMP	DTWRIT	/11=.WRITE
	JMP	DTWAIT	/12=.WAIT,.WAITR
	JMP	DTAPE	/13=.TRAN
/
DTBUSY	LAC	DTCALP		/BUSY-DTA I/O GOING ON
	DAC	DTARGP		/RETURN TO USER CAL
	JMP	DTDBK
/I/O UNDERWAY CHECK SUBR.
DTIOU	0
	LAC	DTUND		/I/O UNDERWAY
	SZA			/NO
DTBUSB	JMP	DTBUSY		/WAIT
	LAC	DTWRWT		/CONTINUE MORE I/O
	SZA!CMA
	JMP*	DTWRWT		/YES
	JMP*	DTIOU		/OK-EXIT
/
	.EJECT
/DTA INTERRUPT SERVICE
DTINT	JMP DTPIC		/PIC ENTRY.
	DAC DTAC		/PIC ENTRY
	LAC DTDVSW-1	/LEAVE PIC ALONE ON EXIT
	DAC DTDVSW
	LAC	DTINT		/API PC, L, EM, MP
	JMP DTCOM
DTPIC	DAC	DTAC		/SAVE AC
	LAC (ION		/TURN ON PICAT EXIT
	DAC DTDVSW
	LAC*	(0	/PIC PC,L,EM,MP
DTCOM	DAC DOUT		/SAVE FOR EXIT
	LAC	DTUND		/I/O UNDERWAY SWITCH STILL ON?
	SZA			/NO-STOP TAPE
	JMP	DTRBB
	DTLA			/CLEAR CONTROL
	JMP	DTDISM
/STATUS B-0=EF
/	1=MK. TK. ERR.
/	2=EOT
/	3=SELECT ERR
/	4=PARITY ERR.
/	5=TIMING ERR.
/	11=DTF
/STATUS A-0-2=UNIT#
/	3=FORW.(0),REV(1)
/	4=GO(1),STOP(0)
/	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 DTA STATUS B
	SMA
/DTDIS = JMP DTSRCK ON SEARCH
/DTDIS = JMP DTRDWT ON READ OR WRITE
DTDIS	XX
	AND	(330000
	SZA!RTL			/SELECT ERROR
/DTERJ=	JMP	DTERS		/ON SEARCH
/	JMP	DTERT		/ON READ OR WRITE
DTERJ	XX
	DTRA
	AND	(740000
	DAC	DTT2		/SAVE STATUS A
	DTLA+10			/CLEAR A,FLAGS,DISABLE FROM INT.
	LAC	(DTRYAG		/GO TO .MED FOR MANUAL READY
	DAC*	DLIT3		/(.MED)
	DZM	DTUND		/SO CAN RESTART WITH ^P.
	LAC	DLIT4
	JMP*	DLIT4		/(.MED+1)
DTRYAG	LAW	-1
	DAC	DTUND		/RESET I/O UNDERWAY SWITCH.
	JMS DTSRCH		/SET UP FOR SEARCH
	LAC DTT2
	XOR (21400
	JMP	DTXIOT		/EXECUTE IOT AGAIN
/
/ERROR IN SEARCH MODE
DTERS	SPA
	JMP	DTEOT		/EOT-CHANGE DIRECTION
	SNL			/MK .TK. ERR. IRREC.
	JMP	DTRWEN		/TIMING ERR.-TRY AGAIN(SETTING GO BIT)
DTERS1	DTRA		/GET UNIT #
	RTL
	RTL
	AND (7		/INTO 15-17
	DTRB-10		/IOR STATUS B
	DAC*	DLIT3		/(.MED=3)
	CLA			/IRREC. DTA ERROR
	JMP	DTER12		/MK. TK. OR EOT DURING READ OR WRITE
/
/ERROR DURING READ OR WRITE
DTERT	SZL!SPA!RTL		/PARITY OR TIMING
	JMP	DTERS1		/MK. TK. OR EOT DURING TRANSFER
	SMA!STL			/PARITY
	JMP	DTTIM		/TIMING ERROR. (LINE MUST BE 1)
DTPART	ISZ	DTERCT		/INDEX PARITY ERROR CT.
	JMP DTTIM-1		/TRY AGAIN
	LAC* (30		/WC OVERFLOW?
	SMA		/NO, MUST GET REST OF DATA
	JMP DTRDWT	/ACCEPT DATA AS IS
	DAC DTCCA	/TEMP STORE REMAINDER
	LAC DTWC	/(ORIG WC - REMAINDER)
	CMA!STL		/LINK WILL BE COMPLEMENTED ON TAD DTCCA
	TAD	DLIT1
	TAD	DTCCA
	RTR
	RTR
	RTR
	RTR
	TAD	DTBLC	/FORMER BLK #
	DAC	DTBLC	/NEW BLK #
	LAC	DTCCA	/RESET WC FOR REMAINDER
	DAC	DTWC
	LAC*	(31	/RESET CURR ADDR
	DAC	DTCCA
	LAW	-10	/RESET PARITY RETRY COUNT
	DAC	DTERCT
	.EJECT
	CLL			/LINK MUST BE 0 FOR 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		/SEARCH AGAIN FOR RETRY
DTRDWT	DZM	DTUND		/CLEAR I/O UNDERWAY
	DZM	DTEOTZ		/SET DOUBLE ENDZONE SWITCH
L7777	LAW	-102		/WAS DIR. (BL 102-104) READIN
	TAD	DTBLC
	SZA
	JMP	DTRWEN		/YES
	LAC	DTDRGT		/GET DIR SWITCH SET
	SZA!CLC			/YES-CLEAR
	JMP	DTRWEN
	DAC	DTDRGT
	LAC	DTUNIT		/UNIT# IN BITS 0-2
	DAC	DTNCOR		/SET DIR IN CORE SW.
DTRWEN	LAC	(20000		/CLEAR (SET IF TIMING) GO BIT
	JMP	DTXIOT
/SEARCH INTERRUPT SERVICE
DTSRCK	CLC
	DAC	DTEOTZ		/CLEAR DOUBLE END ZONE SWITCH
	LAC	DTBCA		/BLK# JUST READ
	SAD	DTBLC		/BLK SEARCHED FOR
	JMP	DCHKF		/MAYBE-CHECK DIRECTION
	CMA
	TAD	DTBLC		/BLK# SEARCHED FOR-BL# READ
DCHKC	SMA!CLA			/OVERSHOOT-FORW; SPA!CLA=REV.
	JMP	DTXIOT		/CONT. SEARCH, SAME DIRECTION
DTEOT	DAC	DTEOTS		/SET (0) OR CLEAR (-) EOT SWITCH
DCHK2	LAC	DTBLNC		/FORW: SUB. 2 FROM BL# TO SEARCH
DCHKC3	TAD	DTNXBK		/REV; AND 2 FROM BL# TO SEARCH
	DAC	DTBLC
	CLC			/CHANGE SIGN OF BLK INCR.
	TAD	DTBLNC		/FOR NEXT DIRECTION CHANGE
	CMA
	DAC	DTBLNC
	LAC	DTEOTS		/END ZONE ENTERED SWITCH
	SMA
	JMP	DCHKC4		/NO ENTERED
	ISZ	DTEOTZ		/DOUBLE END ZONE SWITCH SET
	JMP	DCHKC4		/NO
	LAC	DTNXBK		/STORE BL# TO TRANSFER
	DAC	DTBLC		/INTO BL# TO SEARCH FOR
	.EJECT
/THIS ROUTINE INSURES CORRECT SETTING OF DTBLC
/ON 1ST ENTRY INTO END ZONE
DCHKC4	LAC	DCHKC
	XOR	(1000		/OR VICE VERSA
	DAC	DCHKC
	LAC	DTEOTS		/EOT SWITCH
	RAL			/L = 1 = EOT
	LAC (40000		/MOTION BIT
	SZL			/NO EOT
	XOR	(20000		/SET GO BIT
	DZM	DTEOTS		/CLEAR EOT SWITCH
	JMP	DTXIOT		/CHANGE SEARCH DIRECTION
/SET UP FOR SEARCH MODE
DTSRCH	0
	LAC	(DTBCA		/SET UP CA AND WC
	DAC*	(31		/FOR SEARCH
	DZM*	(30
	LAC	(JMP DTSRCK	/SET UP INT. SERVICE
	DAC	DTDIS		/FOR SEARCH
	LAC	(JMP DTERS
	DAC	DTERJ
	JMP*	DTSRCH
DCHKF	LAC	DTDTR
	XOR	DTBLNC
DLITSM	SMA!CLA			/SEARCH DIRECT.=TRANSF. DIR.
	JMP	DCHKC3		/CHANGE SEARCH DIR. AGAIN
	LAC	DTWC		/SET UP-WC
	DAC*	(30
	LAC	DTCCA		/CA-1
	DAC*	(31		/FOR TRANSFER
	LAC	(JMP DTRDWT	/SET UP TRANSFER COMPLETE JMP
	DAC	DTDIS
	LAC	(JMP DTERT		/SET UP ERROR JMP
	DAC	DTERJ
	LAC	DTTR		/READ (13000) OR WRITE (15000)
DTXIOT	DTXA
DTDISM	LAC	(JMP DTPIC	/RESTORE PIC INTERR. ENTRY
	DAC	DTINT
	LAC	DTAC		/RESTORE AC
DTDVSW	XX		/ION IF PIC, LAC DTAC IF API
	DBR
	XCT .+1
	XCT .+1
	JMP*	DOUT		/INTERR. EXIT
/
/INIT DTA ROUTINE - MAINSTREAM
DTIN	ISZ	DTARGP		/INDEX TO BUF. SIZE ARG.
	LAC	(377		/RETURN 255 AS BUF. SIZE
	DAC*	DTARGP
	LAC	DTCT		/I OR O
	DAC	DTIOSW		/OUTPUT=1, INPUT=0
	ISZ	DTARGP		/INDEX TO NORM. EXIT
	LAC	DLMBIT		/(DTMBIT) = FILE BIT MAP POINTER
	JMS	DTBFC2		/CLEAR FILE BIT MAP (L=0)
DTONCE	CAL	44		/API CORE ADDR.-MODIFIED
/DTONCE+1 TO 11 USED FOR TEMP. STORE. AFTER 1ST .INIT
/DTAC=AC STORAGE CELL DURING INTERRUPT
/DOUT=INTERRUPTED RETURN ADDRESS
/DTT2=STATUS A STORAGE CELL
/DTBCA=BL.# STORAGE CELL DURING SEARCH
/DTERCT=PARITY COUNTER (INIT. TO-10)
/DTBLC=BL# BEING SEARCHED FOR
/DTBLNC=BL. INCR. TO CHANGE DIRECTION,-2=F,+2=R.
/DTNXBK=BL.# TO BE TRANSFERRED
/DTDTR=TRANSFER DIRECTION SWITCH, 0=F,-1=R
DTAC	16			/.SETUP
DOUT	DTDF			/DONE FLAG
DTT2	DTINT			/DTA INT. SERV. ADDR.
DTBCA	CAL	44
DTERCT	16
DTBLC	DTEF			/ERR. FLAG
DTBLNC	DTINT
DTNXBK	LAC	DJSTOP
DTDTR	DAC	DTONCE
DTBMIN=DTFAKE			/BIT MAP BLOCK IN SWITCH (NON0=IN)
DTBMOT=DTFAKE+1			/BIT MAP BLOCK OUT SWITCH (NON0=OUT)
DTSTOP	JMS	DTSTPA
	JMP	DTDBK
/STOP DTA ROUTINE
DTSTPA	0
	DZM DATPST
	DZM	DTWRWT		/CLEAR OUTPUT WAIT SWITCH
	DZM	DTEOF		/CLEAR EOF SWITCH
	DZM	DTCLSS		/SET CLOSE SWITCH
	DZM	DTSKNT		/CLEAR .SEEK, ENTER SWITCH
	DZM	DTWREX		/CLEAR WRITE  EXECUTED SWITCH
	DZM	DTBMIN		/BIT MAP IN SWITCH (FOR CLOSE)
	DZM	DTBMOT		/BIT MAP OUT SWITCH (FOR CLOSE)
	LAC	DTMTP4		/JMP DTAPE1
	DAC	DTOUT
	DAC	DTNCOR		/CLEAR DIR. IN CORE SWITCH
	JMP*	DTSTPA
/WAIT DTA ROUTINE
DTWAIT	SAD DTCT		/1 IF .WAITR
	JMP DTDBKW	/0 IF .WAIT
	LAC (700000	/LINK,ETC
	AND DTCALP
	DAC DTCALP
	LAC* DTARGP	/15 BIT BUSY ADDR
	AND (77777
	XOR DTCALP
	ISZ DTARGP
	DAC DTCALP
DTDBKW	JMS	DTIOU		/CHECK I/O UNDERWAY
DTDBK	DBR
	XCT .+1
	XCT .+1
	JMP*	DTARGP		/NORM. EXIT
/
	.EJECT
/.OPER ROUTINE INTERPRETS
/.DLETE (SUBFUNCTION 1)
/.RENAME (SUBFUNCTION 2)
/.FSTAT (SUBFUNCTION 3)
DTOPER	LAC	DTDLUN		/DELETE OR RENAM UNDERWAY
	SZA			/NO, IF 1ST PASS THRU
	JMP	DTLET3		/YES (HUNG ON CAL BY DTIOU AT DTCLOS)
	JMS	DTCKCL		/CHECK DIRECTORY FOR THIS FILE
	DAC	DTNXBK		/SAVE FOR 0 AC WHEN NOT FOUND
	SNA
	JMP	DTFST		/NOT FOUND-RETURN WITH AC=0
	XCT	DTSK5		/PICK UP 1ST BLK# OF FILE
	DAC	DTNXBK		/1ST BLK# OF FILE
	LAC	DTCT		/SET UP SUBFUNCTION DISPATCH
	TAD	(JMP DTOPTB
	DZM	DTESAV		/SETUP FOR DELETE
	DZM	DTESAV+1
	DZM	DTESAV+2
	DZM	DTESAV+3
	DAC	DTOPTB-1
	LAW	-4
	TAD	DTCT		/CHECK SUBFUNCTION
	SPA!CLA			/1-3 LEGAL ONLY
	XX			/DISPATCH TO SUBFUNCTION
DTOPTB	JMP	DTER6		/ILL. HANDLER FUNCTION
	JMP	DTLET		/1= .DLETE
	JMP	DTREN		/2=.RENAM
DTFST	LAC*	DTARGP		/3=.FSTAT
	XOR	(100000		/RETURN TYPE (1 IN 0-2)
	DAC*	DTARGP 		/TO USER
	DZM	DTCLSS		/INDICATE FILE CLOSED
	JMP	DTAPE1
/.RENAM ROUTINE
DTREN	LAC*	DTARGP		/GET ADDRESS OF NEW NAME FOR FILE
	TAD	(3
	JMS	DTRX50		/TRANSLATE TO RADIX 50
	DAC	DTUDRP		/SAVE POINTER FOR 'DTNTRZ'
	JMS	DTNTRZ		/NEW NAME INTO DTESAV
	XCT	DTSK5		/GET 4TH WD OF OLD ENTRY
	XCT	DTNTR3		/SAVE IN DTESAV+3
	DAC	DTBMIN		/NO NEED TO RERECORD
	DAC	DTBMOT		/FILE BIT MAPS
	.EJECT
/.DELETE ROUTINE
DTLET	CLC
	DAC	DTDLUN	/SET DELETE UNDERWAY SWITCH
	DAC	DTIOSW		/SIMULATE WRITE
	DAC	DTWREX		/USE .CLOSE TO MODIFY
DTLET3	ISZ	DTARGP		/INDEX ENTRANCE ARG. POINTER
	JMP	DTCLOS		/FILE BIT MAP+DIRECTORY
/CHECK DIRECT. IN CORE SUBR.
DTDRCK	0
	JMS	DTIOU		/I/O UNDERWAY
	LAC	DTNCOR		/D IN 
	SAD	DTUNIT		/NO
	JMP	DTDRC1		/YES - CHECK PARITY
DTDRC2	LAC	(13000		/READ PARAM
	JMS	DTDRIN		/BRING IN DIRECTORY
	JMP	DTDRCK+1		/WAIT FOR DIRECTORY
DTDRC1	LAC	DTERCT		/DIRECTORY UNACCEPTABLE WITH PARITY ERR.
	SZA
	JMP*	DTDRCK
DTER61	LAW	61		/DIRECTORY OR FILE BIT MAP PARITY ERROR
	JMP	DTEROT
/CALL IN DIRECTORY SUBR.
DTDRIN	0
	DAC	DTTR		/TRANSFER DIRECTION SWITCH
	LAC	(102
	DAC	DTNXBK		/BL# TO TRANSFER
	DZM	DTDTR		/TRANSFER FORWARD
	DZM	DTDRGT
	LAC	(DTDIRB-1
	JMS	DTWCS		/SETUP WC,CA
	LAW	-1100		/READ IN 2 BLOCKS + 100 WD OF 3RD BLOCK
	DAC	DTWC
	JMP*	DTDRIN
DTDRGT	777777			/GET DIR INDIC. (+0=GET)
/
DT0.5	XX
	LAW	-34
	DAC	DTHALF		/DO HALF OF 56 ENTRIES BECAUSE
	LAC	DTDBPT		/DIRECTORY IS IN 2 BLOCKS
	TAD	(400
	DAC	DTDBPT
	JMP*	DT0.5
/
/DIRECTORY SEARCH SUBR.
DTSK1	0
	DAC	DTUDRR		/USER DIR. ENTRY POINTER
	DZM	DTDTR		/SET TRANSF. DIRECTION=FORWARD
	LAW	-70
	DAC	DTFPCT		/56 FILES
	LAC	(DTDIRB-377	/EVENTUAL ADDRESS OF DIRECTORY BUFFER
	DAC	DTDBPT
DTSK2	JMS	DT0.5
DTSK3	DAC	DTDES		/ENTRY SECTION POINTER
	DAC	DTCURE		/CURR. ENTRY, WD0, POINTER
	.EJECT
/NEXT FILE NAME ENTRY
	LAC	DTUDRR		/USER DIR. ENTRY POINTER
	DAC	DTUDRP
	LAW	-4
	DAC	DTCT1S		/MATCH COUNT
	DAC	DTCTS		/COUNT OF ENTRY WDS TO CHECK
	ISZ	DTCTS
/NEXT WORD OF CURRENT ENTRY
DTSK5	LAC*	DTDES		/DTA DIR. ENTRY (D.E.)
	SAD*	DTUDRP		/USER D.E.
	ISZ	DTCT1S		/WD N OF ENTRY MATCHES
	ISZ	DTDES		/NEXT WD OF DTA ENTRY
	ISZ	DTUDRP		/NEXT WD OF USER ENTRY
	ISZ	DTCTS		/ENTRY WD COUNT
	JMP	DTSK5		/CONT. MATCH CHECK
DTSK6	LAC	DTCURE
	ISZ	DTDES
	ISZ	DTDES		/INCREMENT TO START BLOCK # ENTRY
	ISZ	DTCT1S		/MATCH
	SKP			/N
	JMP*	DTSK1		/YES - POINTER TO CURRENT ENTRY IN AC
	TAD	(11		/INDEX TO NEXT ENTRY
	ISZ	DTFPCT		/INDEX FILE ENTRY CT.
	SKP
	JMP	DTSK7
	ISZ	DTHALF		/DONE 1ST HALF YET?
	JMP	DTSK3		/NEXT ENTRY
	JMP	DTSK2
DTSK7	CLA
	JMP*	DTSK1		/YES-CAN'T FIND FILE NAME
/
/CLOSE FILE SUBR
DTCLOS	JMS	DTIOU		/I/O UNDERWAY WAIT
	LAC	DTIOSW		/I OR O
	SNA
DJSTOP	JMP	DTSTOP		/INPUT-CLEAR SWITCHES EXIT
	LAC	DTWREX		/ANYWRITE EXECUTED AFTER .ENTER
	SZA
	JMP	DTCLS2		/YES
	JMS	DTCBIT		/NO-CLEAR BIT FROM MAPS
	JMP	DTSTOP
DTCLS2	LAC	DTEOF		/EOF BUF IS OUT
	SPA!CLC
	JMP	DTCLS3
	DAC	DTEOF		/SET EOF SWITCH
	DZM	DTCT		/FAKE DATA MODE=IOPS BIN
	LAC	(15000		/OUTPUT
	JMS	DTMCK
	LAC	DLEOFH		/EOF HEADER POINTER (DTEOFH
	CLA
	JMS	DT11PA		/ZERO FILL REST OF BUFFER
	JMP	.-2
	.EJECT
DTCLS3	LAC	DTBMIN	/CHECK IF FILE BIT MAP IS IN
	SZA!CLC
	JMP	DTCLS4
	DAC	DTBMIN		/SET BIT MAP IN SWITCH
	LAC	DTNXBK
	DAC	DTKPLB		/KEEP LAST BLOCK #
	LAC	DLIT77		/START WITH BLK 77
DTCLT	DAC	DTNXBK		/BIT MAP BLOCK #
	LAC	DTFPCT		/FILE COUNT
	TAD	(7		/7 - 44 WORD (OCTAL) MAPS PER BLOCK
	DAC	DTFPCT
	SMA!CLC
	JMP	DTCLQ		/IN THIS BLOCK
				/DECR. BIT MAP BLOCK # BY 1
	TAD	DTNXBK
	JMP	DTCLT
DTCLQ	LAC	DTBUSB
	DAC	DTOUT
	DZM	DTDTR		/SET TRANSF. DIRECT. SWITCH TO FORW.
	LAC	(13000
DTCLQ1	DAC	DTTR
	JMP	DTCOUB		/READ BIT MAP BLOCK INTO BUF. AREA
DTCLS4	LAC	DTBMOT		/FILE BIT MAP BLOCK OUT
	SZA!CLA!CLL
	JMP	DTCLS6
	SAD	DTERCT		/SET BIT MAP OUT SWITCH
	JMP	DTER61		/PARITY ERR ON FILL BIT MAP
	LAC	DTFPCT		/REL. BIT MAP POINTER
	MUL
	44
	LACQ
	TAD	DLTBUF		/ADDRESS OF CURRENT FILE BIT MAP
	DAC	DTBMOT		/SET BIT MAP OUT SWITCH
	DAC	DTOLBM
	DAC	DTXROL		/OLD BIT MAP ADDR.
	LAC	DLTDIR		/DIR. BIT MAP ADDR. 
	JMS	DTXOR		/XOR OLD FILE BIT MAP INTO DIR. BIT MAP
	LAC	DLMBIT		/NEW FILE BIT MAP ADDR.
	DAC	DTXROL
	LAC	DTOLBM		/OLD BIT MAP ADDR
	JMS	DTXOR		/XOR NEW INTO OLD BIT MAP
	LAC	(15000
	JMP	DTCLQ1		/OUTPUT BIT MAP BLOCK
/
	.EJECT
/SUBR. TO XOR BIT MAP 1 INTO BIT MAP 2
/ALSO CLEARS BIT MAP 1
DTXOR	0
DTXRNW=DTMPP			/NEW BIT MAP POINTER
	DAC	DTXRNW		/BIT MAP 2 ADDR
	LAW	-44
	DAC	DTCTS
DTXOR1	LAC*	DTXROL		/BIT MAP 1 POINTER
	XOR*	DTXRNW		/BIT MAP 2 POINTER
	DAC*	DTXRNW
	DZM*	DTXROL		/CLEAR BIT MAP 1
	ISZ	DTXROL
	ISZ	DTXRNW
	ISZ	DTCTS
	JMP	DTXOR1
	JMP*	DTXOR
/
DTCLS6	SAD	DTCLSS		/AC=0 ON ENTRY
	JMP	DTSTOP
	JMS	DTDRCK		/LOAD DIRECTORY INTO DTBUF
	LAC	DLSAV		/(DTESAV
DTFIN=DTBFC2			/DTESAV POINTER
	DAC	DTFIN
	LAW	-3
	DAC	DTCT
DTCLS7	LAC*	DTFIN		/NEW FILE NAME (4 WDS)
	DAC*	DTCURE		/INTO DIRECTORY ENTRY SECTION
	ISZ	DTFIN
	ISZ	DTCURE
	ISZ	DTCT
	JMP	DTCLS7
	ISZ	DTCURE
	ISZ	DTCURE		/INDEX TO START BLK #
	LAC*	DTFIN
	DAC*	DTCURE		/MOVE START BLK #
	ISZ	DTCURE		/POINT TO LENGTH INDICATOR
	DZM*	DTCURE		/INITIALIZE TO ZERO
/
	.EJECT
/  COUNT NUMBER OF BITS SET IN BIT MAP FOR LENGTH INDICATOR
	LAW	-44
	DAC	DTCT
DTCNTA	LAW	-20		/16 BITS PER WORD
	DAC	DTCTS
	LAC*	DTOLBM		/GET WORD FROM BIT MAP
DTCNTB	RAR
	SZL
	ISZ*	DTCURE		/COUNT # OF BITS SET
	ISZ	DTCTS
	JMP	DTCNTB
	ISZ	DTOLBM		/POINT TO NEXT WORD OF MAP
	ISZ	DTCT		/END OF MAP YET?
	JMP	DTCNTA
	ISZ	DTCURE
	LAC	DTKPLB		/LAST BLOCK # OF FILE
	DAC*	DTCURE
	ISZ	DTCURE
	LAC	(200		/ALLOW ALL USERS ACESS
	DAC*	DTCURE
	DZM	DTCLSS		/CLEAR CLOSE IND.
	LAC	(15000		/REWRITE DIRECTORY
	JMS	DTDRIN
	JMP	DTCLOS
/
	.EJECT
/.TRAN ROUTINE
DTAPE	JMS	DTIOU		/I/O UNDERWAY
	CLC
	SAD	DT11PK		/PART II OF BLK 100 SPECIAL CASE?
	JMP	DTISZA		/YES.  INCREMENT POINTERS
	LAC*	DTARGP		/BL#
	JMS	DTSET		/SETUP BL#, ETC R/W, FOR/REV
	ISZ	DTARGP
	CLC
	TAD*	DTARGP		/CORE ADDR. -1
	DAC	DT6BIT		/TEMPORARILY SAVE L.B. ADDR
	ISZ	DTARGP
	JMS	DTWCS		/SETUP CA AND START SEARCH
	LAC*	DTARGP		/WC
	DAC	DTWC
DTAPE1	ISZ	DTARGP		/INDEX TO NORM EXIT
	LAC	DTNXBK		/IN CASE OF .FSTAT, GET 1ST BLK #
	SAD	(100		/SPECIAL CASE IF .TRAN BLK 100
	SKP
	JMP	DTDBK		/NOT BLK 100. EXIT.
	LAW	-400
	SAD	DTWC		/DID USER WANT COMPLETE BLOCK?
	SKP!CLC
	JMP	DTDBK		/NO.  EXIT.
	DAC	DT11PK		/YES.  SET "SPECIAL .TRAN" FLAG
	JMP	DTUNTR
DTISZA	ISZ	DTARGP		/ARGUMENT POINTER MUST BE
	ISZ	DTARGP		/STEPPED CORRECT NUMBER OF TIMES
	ISZ	DTARGP		/IF SECOND PASS THROUGH.
	.EJECT
DTUNTR	JMS	DTDRCK		/ENSURE DIRECTORY IS IN CORE
	LAW	-2
	DAC	DTFPCT		/2 BLOCKS IN DIRECTORY
	LAC	DT6BIT		/RETRIEVE USER LINE BUFFER ADDRESS
	TAD	(41		/POINT TO START OF DIRECTORY PART
	DAC	DTFIN
	LAC	(DTDIRB-377	/EVENTUAL HANDLER DIRECTORY ADDR
	DAC	DTDBPT
DTUT1	JMS	DT0.5		/POINT TO CURRENT UFD BLOCK
DTLEGL=DT0.5
DTUT2	DAC	DTDES		/POINT TO CURRENT D.E.
	LAW	-3		/FILE NAME & EXT
	DAC	DTCT
	DZM	DTLEGL		/CLEAR FILE LEGALITY CHECK WORD
DTUT3	LAC*	DTDES		/PICK UP RADIX 50 WORD
	ISZ	DTDES
	JMS	DT6BIT		/CONVERT TO .SIXBT
	DAC*	DTFIN		/STORE IN USER BUFFER
	TAD	DTLEGL
	DAC	DTLEGL		/UPDATE LEGALITY CHECK
	ISZ	DTFIN
	ISZ	DTCT		/END OF 'FILNAMEXT' ?
	JMP	DTUT3
	ISZ	DTDES		/YES. POINT TO START BLK #
	ISZ	DTDES
	LAC	DTLEGL		/IF BLANK FILE, DTLEGL=0
	SNA
	JMP	DTUT4
	LAC*	DTDES
	XOR	(400000		/LEGALIZE FILE START BLK #
DTUT4	DAC*	DTFIN		/TRANSFER START BLK #
	ISZ	DTFIN
	LAC	DTDES
	TAD	(4		/POINT TO NEXT FILE ENTRY
	ISZ	DTHALF		/END OF 1ST 28 FILES?
	JMP	DTUT2		/NO
	ISZ	DTFPCT		/YES. END OF 2ND 28?
	JMP	DTUT1
	DZM	DT11PK		/CLEAR "SPECIAL .TRAN" FLAG WHEN DONE
	JMP	DTDBK		/FOLLOW NORMAL EXIT ROUTINE
	.EJECT
/  SUBROUTINE TO CONVERT ONE WORD (3 CHARACTERS) FROM PDP-11
/  RADIX 50 TO .SIXBT
/
/  ENTER WITH RADIX 50 IN AC; LEAVE WITH .SIXBT IN AC
/
DT6BIT	XX
	CLL
	IDIV			/EXTRACT 1ST DIGIT
	3100
	DAC	DTR50C		/TEMPORARILY SAVE REMAINDER
	LACQ
	DAC	DTR50A		/1ST CHARACTER - IMAGE RADIX 50
	LAC	DTR50C		/RETRIEVE PREVIOUS REMAINDER
	IDIV
	50
	DAC	DTR50C		/3RD CHARACTER
	LACQ
	DAC	DTR50B		/2ND CHARACTER
	JMS	DT5026		/CONVERT 1ST CHARACTER TO .SIXBT
	LAC	DTR50A		/EXECUTED FROM INSIDE SUBROUTINE
	JMS	DT5026		/2ND CHARACTER
	LAC	DTR50B
	JMS	DT5026		/3RD CHARACTER
	LAC	DTR50C
	LACQ			/.SIXBT NOW FETCHED FROM MQ
	JMP*	DT6BIT
/
QOMQ=642000		/INCLUSIVE OR AC & MQ, LEAVE RESULT IN MQ
/
DT5026	XX
	LLSS	6		/SHIFT MQ TO MAKE ROOM FOR THIS CHARACTER
	XCT*	DT5026		/FETCH CHARACTER
	TAD	(-33		/TEST CHARACTER
	SMA
	TAD	(22		/ IF (CHAR.GT.33) CHAR=CHAR+22
	TAD	(33		/RESTORE VALUE CHANGED BY TEST
	QOMQ
	JMP*	DT5026		/ 'LAC' AFTER EXIT DOES NO HARM
/
	.EJECT
/SUBROUTINE TO SET UP BLOCK #, TRANSFER DIRECTION
DTSET	0
	DAC	DTNXBK
	LAC	DTCT		/TRANSFER DIRECTION
	RTR
	SMA!CLC			/OUTPUT
	LAC	(11000		/INPUT
	XOR	(2000
	AND	(17000
	DAC	DTTR		/WRITE (15000) OR READ (13000)
	SZL!CLA			/FORWARD
	CLC			/REVERSE
	DAC	DTDTR		/TRANSFER DIRECTION SWITCH
	JMP*	DTSET
/SUBR. TO SET UP CA, WC, AND TRANSFER
DTWCS	0
	DAC	DTCCA		/ADDR.-1(BIT 0-2 DO NOT MATTER)
DTUMSK	LAW	-400
	DAC	DTWC		/WORD COUNT (2'S COMP)
	LAW	-10
	DAC	DTERCT		/PARITY ERROR RETRY COUNT
	DAC	DTUND		/SET I/O UNDERWAY
	LAC	DTDTR		/TRANS. DIRECT. SWITCH
	AND	(1000		/AND
	XOR	DLITSM		/SMA!CLA=SEARCH FORW.
	DAC	DCHKC		/SPA!CLA=SEARCH REV.
	LAC	DTNXBK
	DAC	DTBLC
	LAC	DTDTR
	SMA!CLA			/-2 ON TRANSFER FORW.
	LAW	-4		/+2 ON TRANSFER REV.
	TAD	DLIT2		/(2
	DAC	DTBLNC		/SEARCH BLOCK INCREMENT
	JMS	DTSRCH		/SET UP FOR SEARCH
	LAC	DTDTR		/DIRECTION SWITCH
	AND	(40000
	XOR	(21400		/UNIT+21400=SEARCH FORW.
	XOR	DTUNIT		/UNIT+61400=SEARCH REV.
	DTLA
	JMP*	DTWCS		/EXIT SUBR
	.EJECT
/.READ, .WRITE COMMON SETUP SUBR.
DTMCK	0
	DAC	DTTR		/READ (13000) OR WRITE (15000)
	DZM	LINEND		/CLEAR END-OF-LINE FLAG
	XCT*	DTMCK		/L.B. OR DTA BUF. L.B. ADDR.
	DAC	DTUHP		/HEADER POINTER
	DAC	DTUDP		/DATA POINTER
	ISZ	DTARGP
	LAC*	DTARGP		/USER WC
	DAC	DTUWC
	LAC	DTCT		/DATA MODE
	DAC	DTDMOD
	JMP*	DTMCK		/IOPS OR IMAGE EXIT
/
/SUBR. TO CHECK ACTIVE FILE
DTCKCL	0
	LAC	DTCLSS		/PREVIOUS FILE CLOSED
	SZA!CLA
	JMP	DTER10		/NO-FILE STILL ACTIVE
	JMS	DTDRCK		/CHECK FOR DIRECTORY IN CORE
	LAC*	DTARGP		/USER D.E. POINTER
	JMS	DTRX50		/TRANSLATE .SIXBT TO RADIX 50
	JMS	DTSK1		/DIR. SEARCH FOR FILE
	DAC	DTCLSS		/CLEAR OR SET CLOSE SWITCH
	JMP*	DTCKCL
/.SEEK ROUTINE
DTSEEK	LAC	DTIOSW
	SZA!CLC
	JMP DTER17		/TOO MANY FILES OPEN.
	JMS	DTCKCL		/CHECK DIRECTORY FOR THIS FILE
	SNA!CLC			/DTA DIR. ENTRY POINTER IN AC
	JMP	DTER14		/FILE NOT FOUND (DTER13)
	XCT	DTSK5		/PICK UP 1ST BLK # OF FILE
	DAC	DTNXBK		/1ST BLK # TO READ
	DAC	DTSKNT		/SET .SEEK, .ENTER EXECUTED SWITCH
	LAC	(13000
	DAC	DTTR		/INPUT
/	DAC	DTNCOR		/CLEAR DIRECTORY IN CORE SWITCH
	DZM DTDMOD	/CLEAR DATA MODE TO BYPASS DUMP CHECK
	LAC	(12		/FORM CONTROL FOR 1ST LINE IS
	DAC	DTFCTL		/LINE FEED.
	JMP	DTRNX1		/TRANSFER 1ST BLOCK
/
	.EJECT
/.WRITE ROUTINE
DTWRIT	JMS	DTIOU		/I/O UNDERWAY
	LAC	DTMTP4		/SET EXIT TO
	DAC	DTOUT		/JMP DTAPE1
	DAC	DTWREX		/SET WRITE EXECUTED SWITCH
	LAC	(15000
	JMS	DTMCK		/READ/WRITE COMMON SETUP
	LAC*	DTARGP
/RETURN HERE FOR IOPS OR IMAGE MODES
DTWRT1	DZM	DTWRWT		/OUTPUT WAIT SWITCH-CLEAR
	ISZ	DTUDP		/STEP PAST HEADERS
	LAC	DTDMOD		/CHECK MODE OF TRANSFER
	SAD	(3
	JMP	DTIMGW		/ITS IMAGE ALPHANUMERIC
DTW1	ISZ	DTUDP
	LAC*	DTUDP
	ISZ	DTUDP
	DAC	DTONE		/FETCH PAIR OF ASCII WORDS
	LAC*	DTUDP
	DAC	DTTWO
	LAW	-5		/PREPARE TO EXTRACT 5 CHARACTERS
	DAC	DTCCNT
DTW2	LAC	DTONE		/PICK UP LEFT WORD OF PAIR
	LRS	13		/EXTRACT 1ST CHARACTER
	JMS	DT11PA
	JMS	DTLLS		/NOW SHIFT LEFT 2 WORDS BY 1 CHARACTER
	LLS	7
	ISZ	DTCCNT		/5 CHARACTERS DONE YET?
	JMP	DTW2		/NO
	JMP	DTW1		/YES.  EXTRACT NEXT 5/7 PAIR
/
DTCCNT=DT6BIT
/
DTIMGW	LAC*	DTUHP		/GET WORD COUNT
	LRS	10		/FROM HEADER
	AND	(776
	CMA
	TAD	(3		/DON'T INCLUDE HEADER
	DAC	DTUWC		/SAVE WORD COUNT
	SMA
	JMP	DTAPE1		/WORD COUNT TOO SMALL, ABORT!
DTIW0	ISZ	DTUDP
	LAC*	DTUDP		/GET USER WORD
	JMS	DT11PI		/IMAGE MODE PACK
	ISZ	DTUWC
	JMP	DTIW0		/GET ANOTHER WORD
	JMP	DTAPE1		/DONE ENTIRE BUFFER
	.EJECT
/
DT11PI	XX			/IMAGE ENTRY
	AND	(377		/CHOP TO 8 BITS
	JMP	DTPK1
DT11PA	XX
	AND	(177		/CHOP TO 7 BITS
	SAD	(12
	JMP*	DT11PA		/IGNORE ALL LINE FEEDS
	SAD	(15
	DAC	LINEND		/SET END-OF-LINE FLAG ON 
	SAD	(175
	DAC	LINEND		/CARRIAGE RETURN & ALT MODE
DTPK1	ISZ	DTSWT		/1ST OR 2ND BYTE?
	SKP
	JMP	DTPK2		/2ND BYTE
	DAC*	DTHPT		/1ST BYTE.  STORE IN BUFFER
	LAW	-1
	DAC	DTSWT		/SET SWITCH TO SKIP NEXT TIME
	JMP	NDTST
/
DTPK2	ALSS	10		/SHIFT TO BYTE 2 POSITION
	XOR*	DTHPT		/INCORPORATE BYTE 1
	DAC*	DTHPT		/STORE BACK IN BUFFER
	ISZ	DTHPT
	ISZ	DTBWC		/END OF BUFFER YET?
NDTST	SKP!CLA
	JMP	DTBOUT		/WRITE FULL BUFFER
	SAD	LINEND
	JMP	DT11RT		/RETURN FOR NEXT CHAR IF NOT END OF LINKE
	ISZ	LINEND		/HAVE WE ADDED PDP-11 TERMINATOR YET?
	SKP!CLC
	JMP	DTAPE1		/YES.  NORMAL RETURN
	DAC	LINEND		/SET INDICATOR FOR NEXT PASS THRU
	LAC	(12
	JMP	DTPK1		/APPEND LINE FEED TO LINE
DT11RT	LAC	DTDMOD		/CHECK MODE FOR PROPER RETURN
	SAD	(3
	JMP*	DT11PI		/IMAGE RETURN
	JMP*	DT11PA		/ASCII RETURN
/
DTBOUT	LAC	DTEOF
	SNA
	JMP	DTCOUT		/ IF (DTEOF.EQ.0) REGULAR WRITE
	JMP	DTCOUY		/GAME PLAYING WITH .CLOSE
/
	.EJECT
DTWT5	LAC DTEOF		/EOF?
	SZA
	JMP DTCOUY		/YES, ALWAYS OUTPUT BLOCK
DTMTP4	JMP	DTAPE1		/IOPS WRITE COMPLETE
DTWRCL	JMS	DTBUFC		/CLEAR DTA BUF
	DZM	DTWRWT		/CLEAR I/O BUSY RETURN POINTER
	ISZ	DTARGP		/INDEX TO WC
	JMP	NDTST		/RETURN TO INTERRUPTED SEQUENCE
/
/ERROR ROUTINE
/
DTER16	TAD	DLIT2	/OUTPUT BUFFER OVERFLOW
			/DECTAPE FULL
DTER14	TAD	DLIT2	/DTA DIRECTORY FULL
			/FILE NOT FOUND
DTER12	TAD	DLIT2	/IRREC. DTA ERR. MK. TK., EOT DURING TRANSFER
			/.SEEK, .ENTER NOT EXECUTED
DTER10	TAD	DLIT2	/FILE STILL ACTIVE
			/ILL. DATA MODE
DTER6	TAD	(6		/ILL. HANDLER FUNCTION
/ALL ERRORS COME THRU HERE.
DTEROT	DAC	DTBUFC		/T. STORAGE.
	JMS	DTSTPA		/CLEAR SWITCHES
	DZM	DTUND
	LAC	DTBUFC		/AC=ERROR #.
	JMP*	DLIT4	/KM-9 ERR. LOC (.MED+1=4)
/
/CLEAR I/O BUF. SUBR., POINTERS
DTBUFC	0
	LAW	-377
	DAC	DTBWC		/BUF SIZE
	DZM	DTSWT		/SWITCH FOR BYTE 1 OF PACK-UNPACK
	LAC DTIOSW
	RAR		/INPUT: L=0; OUTPUT: L=1
	LAC	DLTBUF		/BUF. (WD0) POINTER (DTBUF
	SNL!STL		/DO NOT MODIFY DTHPT ON INPUT
	/ALSO SET LINK TO CLEAR 400 CELLS
	JMP	.+3
	DAC	DTHPT		/DTA BUF HEADER POINTER
	ISZ	DTHPT		/POINT TO WORD 1 OF BUFFER
	DAC	DTRHPT		/BUF POINTER FOR READ
	JMS	DTBFC2	/CLEAR BUF
	ISZ	DTRHPT		/POINT TO WORD 1 OF BUFFER
	JMP*	DTBUFC
/
	.EJECT
/CLEAR SPECIFIED AREA SUBR.
DTBFC3=DDIRAL
DTBFC2	0
	DAC	DTBFC3
	LAW	-40
	SZL		/CLEAR 40
	AND	DTUMSK	/CLEAR 400, DTUMSK=777400
	DAC	DTCLCT	/DZM COUNT
	DAC	DTBFCT		/INIT BUF SIZE CT.
	ISZ	DTBFCT
DTBFC1	DZM* DTBFC3
	ISZ	DTBFC3
	ISZ	DTCLCT
	JMP	DTBFC1
	JMP*	DTBFC2
/
/OUTPUT CURR. IOPS BUFFER
DTCOUT	LAC	(DTWRCL		/SET RETURN FROM INT.
	DAC	DTWRWT		/SET OUTPUT WAIT SWITCH
DTCOUY	LAC	DTBUSB
	DAC	DTOUT
DTCOUZ	LAC	DTCNBK		/CURR. BL# TO WRITE
	DAC	DTNXBK
	SPA!CLC
	JMP	DTER16		/DECTAPE FULL (DTER15)
	LAC DTWRWT	/IF DTWRWT NON 0,ALWAYS GET NEXT BLK #
	SNA!CLA
	LAC DTEOF
	JMS DTMAP		/FIND NEXT FREE BLOCK
	SPA
	CLA			/LINK FOR LAST BLOCK OF FILE IS 0
	DAC	DTBUF		/DATA LINK
	XOR	DTDIRA		/CHECK TRANSFER DIRECTION
	SMA!CLC
	JMP	DTCOUA		/FORWARD BLOCK NUMBER IS OK
	TAD	DTBUF		/IF DIRECTION IS REVERSE,
	CMA			/BLOCK NUMBERS MUST BE NEGATIVE
	AND	(177777		/REMEMBER THAT WORD IS ONLY 16 BITS
	DAC	DTBUF
DTCOUA	LAC	DTDTR
	SZA
	JMS	DTNEG		/SCRAMBLE -VE BLOCKS BEFORE WRITING
/
DTCOUB	LAC	DLTBF1		/(DTBUF-1
	JMS	DTWCS		/SETUP WC,CA AND BEGIN TRAN.
DTOUT	JMP	DTAPE1
	.EJECT
/.READ ROUTINE
DTREAD	LAC	DTEOF		/EOF SWITCH SET?
	SZA
	JMP	DTEFX		/YES - IGNORE CALL (AC MUST BE NON-0)
	JMS	DTIOU		/I/O UNDERWAY CHECK
	LAC*	DTARGP		/USER L.B. POINTER
	DAC	DTHPT
	DAC	DTHPTS
	LAC	DTMTP4		/JMP DTAPE1
	DAC	DTOUT
	LAC	(13000
	JMS	DTMCK		/READ/WRITE COMMON SETUP
	LAC	DTRHPT		/DTA BUF HEADER POINTER
/RETURN HERE FOR IOPS OR IMAGE MODES
	DZM	DTDVS		/CLEAR SHORT LINE FLAG
	LAC	(2
	DAC	DTWPC		/INITIALIZE COUNTER FOR WORD PAIR
	DZM	DTCKSM		/CLEAR CHECKSUM
DTRD1	LAW	-5
	DAC	DTCCNT		/COUNTER FOR PACK
	DZM*	DTHPT		/CLEAR HEADER WORD 0
	ISZ	DTHPT
	ISZ	DTHPT		/POINT TO 'U.L.B.+2'
	LAC	DTUWC
	TAD	(2		/INCREMENT WORD COUNT FOR HEADERS
	DAC	DTUWC
	SMA
	JMP	DTAPE1		/WORD COUNT TOO SMALL.  ABORT!
	LAC	DTDMOD		/CHECK MODES
	SAD	(3
	JMP	DTIMGR		/ITS IMAGE MODE
	LAC	DTFCTL
	SAD	(12		/DO NOT RETURN LINE FEEDS TO PDP-9
	SKP
	JMS	DT9PK		/PACK IN APPROPRIATE CARRIAGE CONTROL
DTRD2	JMS	DTGBY		/GET BYTE
DTRD3	AND	(177		/CHOP TO 7 BITS
	SAD	(12		/CHECK FOR LEGAL PDP-11 LINE TERMINATORS
	JMP	DTRD4
	SAD	(13
	JMP	DTRD4
	SAD	(14
	JMP	DTRD4
	SAD	(177
	JMP	DTRD2		/IGNORE RUBOUTS
	SZA
	JMS	DT9PK		/PACK CHARACTER IF NON-ZERO
	JMP	DTRD2
/
DTIMGR	JMS	DTGBY		/GET BYTE FROM USER BUFFER
	AND	(377		/CHOP TO 8 BITS
	JMS	DTUPTR		/PUT IN USER BUFFER
	JMP	DTIMGR
/
DTGBY	XX
	ISZ	DTSWT		/1ST OR 2ND BYTE?
	SKP!CLL!CLC		/1ST.  CLEAR LINK AND
	STL!CLA
	DAC	DTSWT		/PREPARE TO SKIP ON BYTE 2
	LAC*	DTRHPT		/GET WORD FROM BUFFER
	SNL!CLL
	JMP*	DTGBY
	ISZ	DTRHPT
	ISZ	DTBWC		/END OF BUFFER?
	SKP
	JMS	DTGTBK		/YES.  GET NEXT BLOCK
	LRSS	10
	JMP*	DTGBY
/
DT9PK	XX
	DAC	DT11PK		/TEMPORARY STORE
	JMS	DTLLS		/SHIFT 5/7 PAIR FOR NEXT (THIS) CHARACTER
	LLS	7		/EXECUTED FROM SUBROUTINE
	LAC	DT11PK
	OMQ
	DAC	DTTWO		/INSERT NEW CHARACTER
	ISZ	DTCCNT		/END OF CURRENT 5/7 PAIR?
	JMP*	DT9PK		/NO.  PROCESS NEXT CHARACTER
	JMS	DTPASS		/ADD TO CHECKSUM, PASS WORD PAIR TO USER,
	LAW	-5		/INDEX COUNTS, CHECK FOR SHORT LINE.
	DAC	DTCCNT		/RESET CHARACTER COUNTER
	JMP*	DT9PK
/
DTLLS	XX
	LAC	DTTWO
	LMQ
	LAC	DTONE		/LOAD 36 BIT SHIFT REGISTER
	XCT*	DTLLS		/SHIFT IT
	ISZ	DTLLS		/INDEX TO EXIT
	DAC	DTONE
	LACQ
	DAC	DTTWO		/STORE REGISTER
	JMP*	DTLLS
/
DTPASS	XX
	JMS	DTLLS		/SHIFT 5/7 PAIR 1 BIT LEFT
	LLS	1
	LAC	DTONE
	JMS	DTUPTR		/ADD CHECKSUM, ETC.
	LAC	DTTWO
	JMS	DTUPTR
	JMP*	DTPASS
/
/SUBR. TO ADD TO CHKSUM AND INDEX COUNTS
DTUPTR	0
	DAC*	DTHPT
	ISZ	DTHPT
	TAD	DTCKSM		/ADD DATA WD TO CKSM.
	DAC	DTCKSM
	ISZ	DTUDP		/INDEX AREA POINTERS
	ISZ	DTWPC		/GO TO DRDE ON OVERFLOW-DONE
	ISZ	DTUWC		/STOP WHEN USER COUNT SATISFIED
	JMP*	DTUPTR
/
	.EJECT
/END INPUT LINE ROUTINE
	LAC	DTDMOD		/CHECK MODE
	SAD	(3
	JMP	DTRD7		/NO CARRIAGE CONTROL IF IMAGE
	LAC	(60
	JMS	DTDVS		/SET D.V. FOR  SHORT LINE
	LAC	(12
DTRD4	DAC	DTFCTL		/SAVE CARRIAGE CONTROL FOR NEXT LINE
	LAC	(15		/ENSURE THERE IS A CARRIAGE RETURN
DTRD5	JMS	DT9PK
	LAW	-5
	XOR	DTCCNT		/HAS 5/7 PAIR GONE TO USER YET?
	SZA!CLA
	JMP	DTRD5		/NO.  PACK TRAILING BLANK(S)
/
DTRD7	LAC	DTERCT		/PARITY RETRY COUNT	
	SPA
	JMP	DTRD6		/NO PARITY ERROR
	LAC	(20		/PARITY ERROR IN DTA BLOCK, 12,13=01
	JMS	DTDVS		/12,13=01
/
DTRD6	LAC	DTWPC
	ALSS	10		/CHANGE WORDS TO WORD PAIRS
	XOR	DTDMOD		/INSERT DATA MODE
	XOR*	DTHPTS		/INSERT ANY DATA VALIDITY BITS
	DAC*	DTHPTS		/AND GIVE TO USER
	ISZ	DTHPTS
	TAD	DTCKSM
	CMA
	TAD	(1
	DAC*	DTHPTS		/PASS CHECKSUM TO USER
	JMP	DTAPE1		/AND RETURN
/
DTREOF	CLC
	DAC	DTEOF		/SET EOF SWITCH
	LAC	(5
	DAC	DTDMOD		/DATA MODE = END-OF-FILE
	JMP	DTRD6
	.EJECT
DTGTBK	XX
	DAC	DTUPTR		/SAVE AC
	LAC	DTBUF		/GET NEXT BLOCK POINTER
	SNA!CLL			/CLEAR LINK FOR +VE BLOCK #
	JMP	DTREOF		/NO MORE INPUT AVAILABLE
	AND	(100000		/IS IT -VE IN 16 BIT WORD?
	SZA
	STL			/SET LINK IF -VE
	LAC	DTBUF
	SNL
	JMP	DTGT1
	XOR	(600000		/EXTEND SIGN TO 18 BITS
	CMA
	TAD	(1		/CONVERT TO +VE BLK #
DTGT1	DAC	DTNXBK
	XOR	DTBUF
	SZA
	CLC
	DAC	DTDTR		/SET TRANSFER DIRECTION
	LAC	(DTRDR
	DAC	DTWRWT		/SET UP I/O BUSY RETURN
	LAC	DTBUSB
	DAC	DTOUT		/HANG ON CAL UNTIL NEXT BLK READ
DTRNX1	JMS	DTBUFC		/INIT. BUFFER
	JMP	DTCOUB
/
DTRDR	DZM	DTWRWT		/CLEAR I/O BUSY RETURN POINTER
	ISZ	DTARGP		/INCREMENT TO PROPER PLACE
	LAC	DTDTR		/PDP-11 DECTAPE HANDLES REVERSE BLOCKS
	SZA			/DIFFERENTLY THAN PDP-9.
	JMS	DTNEG		/UNSCRAMBLE BLOCK READ BACKWARDS.
	LAC	DTUPTR		/RESTORE AC
	JMP*	DTGTBK
	.EJECT
/  SUBROUTINE TO SCRAMBLE (UNSCRAMBLE) BACKWARDS BLOCKS
/  REF:  PDP-9 USER HANDBOOK, PAGE 5-18.
/
DTNEG	XX
	LAC	DLTBUF		/ (DTBUF
	DAC	DTLLS		/USED AS POINTER
	LAW	-400
	DAC	DTPASS		/COUNTER FOR 1 COMPLETE BLOCK
DTNEG1	LAC*	DTLLS		/PICK UP WORD FROM BUFFER
	CMA
	RCL
	RTL
	DAC	DT11PK
	AND	(007000		/BITS 6,7,8
	DAC	DT9PK
	LAC	DT11PK
	RAL
	DAC	DT11PK
	AND	(000007		/BITS 15,16,17
	XOR	DT9PK
	DAC	DT9PK
	LAC	DT11PK
	RAL
	RTL
	RTL
	DAC	DT11PK
	AND	(070000		/BITS 3,4,5
	XOR	DT9PK
	DAC	DT9PK
	LAC	DT11PK
	RAL
	DAC	DT11PK
	AND	(000070		/BITS 12,13,14
	XOR	DT9PK
	DAC	DT9PK
	LAC	DT11PK
	RAL
	RTL
	RTL
	DAC	DT11PK
	AND	(700000		/BITS 0,1,2
	XOR	DT9PK
	DAC	DT9PK
	LAC	DT11PK
	RAL
	AND	(000700		/BITS 9,10,11
	XOR	DT9PK
	DAC*	DTLLS		/REPLACE SCRAMBLED WORD
	ISZ	DTLLS
	ISZ	DTPASS		/END OF BUFFER YET?
	JMP	DTNEG1
	DZM	DT11PK		/CLEAR IN CASE OF BLOCK 100 SPECIAL
	JMP*	DTNEG
/  DT11PK IS USED AS TEMPORARY STORAGE FOR .TRAN BLK 100 SPECIAL CASE,
/  IN "DT9PK", AND IN "DTNEG".
DT11PK	0
	.EJECT
/SUBR. TO SET DATA VALIDITY BITS
DTDVS	0
	DAC	DTDVSM		/SAVE MASK
	LAC*	DTHPTS
	XOR	DTDVSM
	DAC*	DTHPTS		/HEADER, WD0
	JMP*	DTDVS
DTEFX	ISZ	DTARGP
	JMP	DTAPE1		/EXIT
DTRNOR	TAD	DTBFCT		/DECR. (BY 1) DTFCT
	DAC	DTBFCT		/BUF COUNT
	JMP	DTAPE1		/NORM EXIT
DTNSH1	DAC	DTUWC
	JMP	DTRD2		/TRANSFER LINE
/
/SUBROUTINE TO SAVE NEW D.E. IN DTESAV AREA
DTNTRZ	0
	LAC	DLSAV	/(DTESAV
	DAC	DTFIN	/DTFIN=DTBFC2
	LAW	-3		/SET DTA D.E.
	DAC	DTCT		/TRANSFER COUNTER
DTNTR2	LAC*	DTUDRP		/SAVE USER D.E. (4 WORD ENTRY)
DTNTR3	DAC*	DTFIN
	ISZ	DTFIN
	ISZ	DTUDRP
	ISZ	DTCT
	JMP	DTNTR2
	JMP*	DTNTRZ
/
	.EJECT
/DTA ENTER FILE ROUTINE
DTENTR	LAC	DTIOSW		/I/O SWITCH
	SNA!CLC
	JMP DTER17		/TOO MANY FILES OPEN.
	JMS	DTCKCL		/CHECK DIRECTORY FOR THIS FILE
	SZA			/NOT FOUND UNDER THIS FILE NAME
	JMP	DTNTR1		/FOUND-WILL BE MODIFIED ON .CLOSE
	LAC	DLFAKE		/INIT FOR EMPTY SLOT SEARCH (DTFAKE
	JMS	DTSK1		/D SEARCH FOR EMPTY FILE ENTRY
	DAC	DTCLSS		/CLEAR OR SET CLOSE SWITCH
	SNA			/EMPTY SLOT FOUND
	JMP	DTER14		/DIRECTORY FULL
DTNTR1	LAC*	DTARGP		/USER D.E. POINTER
	JMS	DTRX50		/ .SIXBT TO RADIX 50
	DAC	DTUDRP
	JMS	DTNTRZ		/SAVE USER D.E. IN DTESAV
	LAW	-44		/INIT BIT MAP SEARCH
	DAC DTWMCT	/BIT MAP WORD COUNT
	LAC DLTDIR	/DIRECTORY BIT MAP POINTER
	DAC DTMTRX	/CURR DIR BIT MAP WORD POINTER
	LAC DLMBIT	/FILE BIT MAP POINTER
	DAC DTPONT	/CURR FILE BIT MAP WORD POINTER
	DZM DTRELB	/BLOCK NUMBER FOUND
	LAW -1100
	DAC DTBLOK	/BLOCK COUNT
	LAW -1		/INIT BIT MAP SEARCH TO PICK UP
	DAC DTREM	/FIRST EMPTY BLOCK
	DAC DTSKNT	/SET SEEK,ENTER EXECUTED SWITCH
	LAC DLIT1	/SET BIT MAP DIRECTION SWITCH
	DAC DTDIRA
	DAC DTDIRL	/TO FORWARD (+1)
	JMS DTMPS	/SET UP TO EXAMINE WD 0 OF MAP
	JMS DTMAP	/FIND FREE BLOCK #
	XCT	DTNTR3		/STORE BL#+COMPLETION BIT IN DTESAV+3
	SPA!CLC
	JMP	DTER16		/DECTAPE FULL (DTER15)
	JMS	DTBUFC
	JMP	DTAPE1		/NORM EXIT
DTESAV	0			/NEW FILE ENTRY
	0
	0
	0
DTFAKE	0			/EMPTY SLOT FOR ENTER SEARCH (LAST WD. UNUSED)
	0
	0
DTEOFH	1005			/EOF HEADER FOR CLOSE
/
	.EJECT
DTUDE	.BLOCK	3		/USER DIRECTORY ENTRY TRANSLATED TO RADIX 50
/
DTR50A;DTR50B;DTR50C		/RADIX 50 IMAGE BUFFER
/
DTRX50	XX
	DAC	DTUDRR		/ENTER WITH POINTER TO USER D.E. IN AC
	JMS	DT6250		/CONVERT 1ST WORD TO RADIX 50
	DAC	DTUDE		/SAVE IN HANDLER "U.D.E."
	JMS	DT6250		/2ND WORD
	DAC	DTUDE+1
	JMS	DT6250		/EXTENSION
	DAC	DTUDE+2
	LAC	(DTUDE		/LEAVE WITH POINTER TO HANDLER "U.D.E." IN AC
	JMP*	DTRX50
/
DT6250	XX
	LAC*	DTUDRR		/PICK UP .SIXBT
	ISZ	DTUDRR
	LMQ
	LLSS!1006		/EXTRACT 1ST CHARACTER
	JMS	UTR		/CONVERT TO RADIX 50
	DAC	DTR50A
	LLSS!1006
	JMS	UTR		/2ND CHARACTER
	DAC	DTR50B
	LLSS!1006
	JMS	UTR		/3RD CHARACTER
	DAC	DTR50C
	CLL
	LAC	DTR50A		/NOW CONCATENATE ALL 3 CHARACTERS
	MUL
	50
	LACQ
	TAD	DTR50B
	MUL
	50
	LACQ
	TAD	DTR50C
	JMP*	DT6250
/
UTR	XX
	DAC	DTR50C		/DOES DOUBLE DUTY AS TEMPORARY STORAGE
	AND	(37
	SAD	DTR50C		/0-32 CORRECT ALREADY
	JMP*	UTR
	LAW	-22		/NUMBERS MUST BE CONVERTED
	TAD	DTR50C
	JMP*	UTR
/
	.EJECT
/SUBR TO SET UP FOR EXAM OF NEXT BIT MAP WORD
DTMPS	0
	LAW	-20
	DAC	DTRBIT		/16 BIT COUNT
	LAC*	DTMTRX		/NEXT BIT MAP WD
	CMA!STL
	DAC	DTSBIT
	LAC	DTDIRA		/BIT MAP DIRECTION SWITCH
	SPA!CLA!RAL			/FORWARD-SEARCH BIT 17-2
	LAC	(100000			/REVERSE-SEARCH BIT 2-17
	DAC	DTTBIT		/FORWARD(17=1); REVERSE (2=1)
	JMP*	DTMPS
/
/END OF CURRENT BIT MAP WORD SUBR.
DTMPP	0
DTMPP1	LAC	DTDIRA		/INCR. (IF FORWARD) OR
	TAD	DTMTRX		/DECR. (IF REV) BY 1
	DAC	DTMTRX		/CURR. DIR BIT MAP WD. POINTER
	LAC	DTDIRA
	TAD	DTPONT
	DAC	DTPONT
	JMS	DTMPS		/SETUP FOR NEXT WD
	ISZ	DTWMCT		/BIT MAP WORD CT
	JMP*	DTMPP		/EXIT
	LAW	-1100	/LIT.
	DAC	DTBLOK		/DECTAPE FULL?
	DZM DTBMCT	/CLEAR BIT MAP SEARCH COUNT
	JMS DDIRAL	/FLIP DTDIRA,NEW DTDIRA IN AC ON RETURN
	TAD DTRELB		/REINIT
	DAC DTRELB
/ROUTINE TO SET DTREM FOR TURN AROUND CASE
	LAC DTDIRA
	RAL		/L=1=REV.,L=0=FORW.
	LAC DTNXBK	/LAST BL # RECORDED FOR THIS FILE
	SNL!CMA		/REV
	JMP DTMPP3
	TAD (1100
	CMA
DTMPP3	DAC DTREM		/LAW TO CHECK ENOUGH SPACE BETW. BL
	LAW -45
	DAC	DTWMCT		/MATRIX COUNT
	JMP	DTMPP1		/START REV. SEARCH
/SUBR TO FLIP DTDIRA AT DECTAPE TURNAROUND
DDIRAL	0
	CLA
	ISZ DTDIRA	/1 OR -1
	LAW -2		/SET TO REVERSE
	TAD DLIT1	/SET TO FORW
	DAC DTDIRA	/NEW DTDIRA MUST BE IN AC ON EXIT
	JMP* DDIRAL
	.EJECT
/BLOCK AVAILABILITY BIT MAP SEARCH
DTMAP	0
	DAC DTCLR2	/SAVE AC FOR -1 CASE
	DZM	DTBMCT	/BIT MAP SEARCH COUNT
DTMAP1	LAC	DTTBIT	/TEST BIT
DTMAP2	AND	DTSBIT		/MATRIX WORX
	SZA!CLC
DTMAP3	JMP	DTREM		/BLOCK AVAILABLE
	ISZ	DTBLOK		/INCREMENT DT BLOCK COUNT
	JMP DTMAP4
	DAC DTBLOK
	JMP DTREM5
DTMAP4	ISZ	DTBMCT
	LAC	DTDIRA		/IF FORW, INCR. BL#
	TAD	DTRELB		/IF REV., DECR. BL.# BY1
	DAC	DTRELB
	LAC	DTDIRA
	RAL			/L=0=FORW; L=1=REV.
	LAC	DTTBIT		/SHIFT TEST BIT LEFT IF FORW,
	SZL!CLL!RAL			/RIGHT IF REV.
	RTR
	DAC	DTTBIT
	ISZ	DTRBIT		/INDEX-16 BIT COUNT
	JMP	DTMAP2		/NEXT BIT
	JMS	DTMPP		/END OF MATRIX WD. SUBR.
	JMP	DTMAP1		/NEXT WORD
DTREM	XX		/DELTA BLOCKS IN BETWEEN
	TAD	DTBMCT
	SPA!CLC			/OK-DELTA BLOCKS IN BETWEEN
	JMP	DTMAP4		/CHECK BIT MAP AGAIN
	SAD DTCLR2	/IF ENTRY AC = -1, NO DTCBIT
	JMP DTREM6
	JMS	DTCBIT		/SET BIT IN MAPS.
	CMA
	DAC	DTSBIT
DTREM6	LAW -DELTA	/RESTORE BLOCK DISTANCE TO DELTA
	DAC DTREM
	LAC	DTDIRL		/SET TRANSF DIRECTION  SWITCH
	SPA!CLA
	CMA
	DAC	DTDTR
	LAC	DTDIRA		/UPDATE DTDIRL
	DAC	DTDIRL
	LAC	DTRELB		/T. STORE BL# TO BE  USED
DTREM5	DAC	DTCNBK		/EXIT
	LAW -1		/WAS AC = -1 ON ENTRY?
	SAD DTCLR2
	SKP		/YES, USE - 1 (EOF)
	LAC DTCNBK
	JMP*	DTMAP		/EXIT -BL ! FOUND(777777=DTA FULL)
	.EJECT
/CHANGE BIT IN MAPS SUBR.
DTCBIT	0
	LAC	DTTBIT		/SET BIT IN FILE BIT MAP
	XOR*	DTPONT
	DAC*	DTPONT
	LAC DTTBIT		/SET BIT IN DIRECTORY BIT MAP
	XOR*	DTMTRX
	DAC*	DTMTRX
	JMP*	DTCBIT	/C(*DTMTRX) MUST BE IN AC ON EXIT
/CLEAR DIRECTORY ROUTINE
DTCLR2	XX			/LAC DTBLBT = BLOCK TABLE
	DZM	DTCT
	ISZ	DTCT	/WRITE FORWARD
	JMS	DTSET		/SET BL# ETC
	LAC DLTBF1
	JMS	DTWCS		/SET UP CA,WC+BEGIN TRANSFER
	ISZ	DTCLR2		/INDEX FOR NEXT TRANSFER
DTCLER	JMS	DTIOU		/WAIT FOR I/O TO FINISH
	LAC	DTCLSS		/CLOSE SWITCH CLEAR?
	SZA!CLA			/YES
	JMP	DTER10		/FILE STILL ACTIVE
	LAC	(DTCLR1		/SET RETURN AND
	DAC	DTWRWT		/I/O WAIT SWITCH
	DAC	DTNCOR		/CLEAR DIR IN CORE SWITCH
	LAC	(LAC DTBLBT
	DAC	DTCLR2		/INIT TABLE REF
	JMS	DTBUFC		/CLEAR BUFFER TO ZERO BLK 70-77
	LAW	-11
	DAC	DTREM	/COUNT FOR FILE BIT MAP BLOCKS
DTCLR1	ISZ	DTREM		/FILE BIT MAP BLOCKS CLEARED?
	JMP	DTCLR2
	LAC	(DTCLR3
	DAC	DTWRWT		/MOVE I/O WAIT RETURN POINTER
	LAC	DLT101		/LINKED FILE - 101 NEXT BLOCK
	DAC	DTBUF
	LAC	DLIT4		/INTERLEAVE FACTOR
	DAC	DTBUF+1
	LAC	(104		/MASTER BIT MAP BLOCK #
	DAC	DTBUF+2
	JMP	DTCLR2		/WRITE BLOCK 100
/
DTCLR3	LAC	(DTCLR4
	DAC	DTWRWT		/POINT TO NEXT RETURN
	DZM	DTBUF		/END OF LINKED FILE
	LAC	(100200		/USER [200,200]
	DAC	DTBUF+1
	LAC	(102		/UFD BEGINS IN BLOCK 102
	DAC	DTBUF+2
	LAC	(11		/ 9 WORDS PER U.D.E.
	DAC	DTBUF+3
	JMP	DTCLR2		/WRITE BLOCK 101
/
	.EJECT
DTCLR4	LAC	(DTCLR6
	DAC	DTWRWT		/POINT TO NEXT RETURN
	STL			/SET LINK TO CLEAR 400 WORDS
	LAC	(DTDIRB
	JMS	DTBFC2		/CLEAR BUFFER FOR BLOCK 102
	LAC	DTBFC3		/RETRIEVE POINTER
	JMS	DTBFC2		/CLEAR FOR BLOCK 103
	LAC	DTBFC3
	JMS	DTBFC2		/CLEAR FOR BLOCK 104
	LAC	(103		/LINKED FILE - 103 NEXT BLOCK
	DAC	DTDIRB
	LAC	DLIT1
	DAC	DTBMPA+1	/MAP #
	DAC	DTDIR		/INDICATE BLOCK 0 OCCUPIED
	LAC	(44		/SIZE OF MAP
	DAC	DTBMPA+2
	LAC	(104		/LINK TO FIRST BLOCK OF MAP
	DAC	DTBMPA+3
	LAC	(177400
	DAC	DTDIR+3		/SET BLOCKS 70-104 OCCUPIED
	LAC	(37
	DAC	DTDIR+4
	LAW	-30
	DAC	DTCLCT
	LAC	(DTDIR+44	/BECAUSE OF STANDARD BIT MAP SIZES,
	DAC	DTBFC3		/BECAUSE OF STANDARD BIT MAP SIZES,
	LAC	(177777		/WE INDICATE ALL BLOCKS NOT
DTCLR5	DAC*	DTBFC3		/PHYSICALLY PRESENT ON DEVICE AS OCCUPIED
	ISZ	DTBFC3		/I.E. BLOCKS 1100-2177
	ISZ	DTCLCT
	JMP	DTCLR5
	LAC	(15000
	JMS	DTDRIN		/WRITE OUT FRESH DIRECTORY
	JMS	DTIOU		/WAIT FOR I/O TO FINISH
/
DTCLR6	DZM	DTWRWT		/YES-CLEAR I/O WAIT SWITCH
	JMP	DTDBK
/DTCLER BLOCK TABLE
DTBLBT	70
	74			/BLOCKS 70-77 CONTAIN
	71			/56 BIT MAPS ORDERED ACCORDING
	75		/TO THE FILE NAMES IN THE DIR. ENTRY SECTION
	72
	76
	73
DLIT77	77
DLT100	100			/BLOCK 100 = DIRECTORY
DLT101	101
/
	.EJECT
/
/DTMBIT=FILE BIT MAP, MUST INITIALLY = 0
DTMBIT	0
	.LOC	DTMBIT+44
DTDIRB	0
	.LOC	DTDIRB+1000	/2 BLOCK DIRECTORY
DTBMPA	0			/DIRECTORY BIT MAP PREAMBLE
	.LOC	DTBMPA+4
DTDIR	0			/BIT MAP + PREAMBLE = 64 WORDS
	.LOC	DTDIR+74
DTBUF	0			/DTA BUFFER
	.LOC	DTBUF+400
DLTDIR	DTDIR			/DIRECTORY POINTER
DLTDR1	DTDIR-1			/DIRECTORY POINTER-1 (FOR LOADING C.A.)
DLTSYS	DTDIR+203	/WD 3 OF SYS BIT MAP
DLTBF1	DTBUF-1			/DTA BUFF POINTER-1
DLTBUF	DTBUF			/DTA BUF. POINTER
DLEOFH	DTEOFH			/EOF HEADER POINTER (FOR .CLOSE)
DTLB40	DTBUF+40			/DIR. ENTRY POINTER (.CLOSE)
DLSAV	DTESAV		/POINTER TO 1ST CELL OF NEW DIR. ENTRY
DLFAKE	DTFAKE			/POINTER TO EMPTY FILE NAME
DLMBIT	DTMBIT			/FILE BIT MAP ADDR. POINTER
DTARGP	0			/ENTRANCE ARG. POINTER
DTCCA	0			/CURRENT ADDR. (C.A.) POINTER FOR TRANSFER
DTCALP	0			/USER CAL POINTER
DTCNBK	0			/DATA LINK (NEXT BL.#)
DTCURE	0			/DIR. POINTER TO CURR. FILE ENTRY EXAMINED
DTDIRA	0			/BIT MAP DIRECTION SWITCH (CURR. BL.)+1=F,-1=R
DTDIRL	0			/BIT MAP DIRECTION SWITCH (LAST.BL.),+1=F,-1=R
DTDMOD	0			/DATA MODE (15-17)
DTEOF	0			/EOF SWITCH, NON 0=EOF
DTFPCT	0			/FILE POSITION COUNTER
DTHPT	0			/DTA BUF. LINE HEADER POINTER (INDEXED)
DTHPTS	0			/DTA BUF. LINE HEADER POINTER
DTIOSW	0			/I/O SWITCH, 0=INPUT, 1=OUTPUT
DTMTRX	0			/CURRENT BIT MAP WD. POINTER
DTPONT	0			/CURR. FILE BIT MAP WD. POINTER
DTWREX	0			/0=NO WRITE EXECUTED, NON 0=EXECUTED
DTNCOR	077777			/DIRECTORY IN CORE SWITCH, (0-2)=UNIT=IN
DTRBIT	0			/18 BIT (2'S COMP) COUNTER FOR BIT MAP SEARCH
DTRELB	0			/FREE BL.# AFTER BIT MAP SEARCH
DTRHPT	0			/DTA BUF. LINE HEADER POINTER (.READ)
DTSBIT	0			/-(MATRIX WORD)
DTSKNT	0			/.SEEK,.ENTER EXECUTED SWITCH (NON 0=EXECUTED)
DTTBIT	0			/TEST BIT FOR BIT MAP SEARCH
DTTR	0	/DTA SEARCH-READ(13000) OR SEARCH-WRITE(15000)CONVERSION FACTOR
DTUCKP	0			/USER LINE BUF. CHECKSUM POINTER
DTUDP	0			/USER LINE BUF DATA POINTER (MODIFIED)
DTUND	0			/I/O UNDERWAY SWITCH,-=BUSY,0=NOT BUSY
DTUNIT	0			/(0-2)=DTA UNIT# FOR TRANSFER
DTWC	0			/2'S COMP TRANSFER WORD COUNT
DTWMCT	0			/BIT MAP WORD COUNT
DTWRWT	0			/CONTINUED I/O SWITCH (NON-0=CONT),0=DONE)
DTCKSM	0			/LINE CHECKSUM
DTCLSS	0			/FILE OPEN, CLOSE SWITCH(NON-0=OPEN,0=CLOSED)
DTCT	0			/GEN. PURPOSE COUNTER=T.STORE
DTBFCT	0			/BUFFER COUNT (INIT=-377)
DTEOTS	0			/END ZONE (EOT) ENTERED SWITCH (0=NOEOT. -0=EOT)
DTEOTZ	0			/DOUBLE END ZONE SWITCH (0=SET) (-0=CLEAR)
DTDBPT	0			/DIRECTORY BUFFER POINTER
DTHALF	0			/COUNTER FOR 2-SECTION DIRECTORY SEARCH
DTONE;DTTWO			/2 WORD BUFFER FOR ASCII PACK-UNPACK
DTSWT	0			/SWITCH SET TO -1 AFTER 1ST BYTE
DTBWC	0			/WORD COUNT FOR DTA BUFFER
LINEND	0		/END-OF-LINE FLAG SET TO NON-ZERO ON CR OR ALT MODE
DTFCTL	0			/KEEP FORM CONTROL HERE FOR NEXT LINE
DTKPLB	0			/KEEP LAST BLOCK # HERE DURING CLOSE
DTBLOK	0		/BLOCK COUNT
DATSLT	0			/CURRENT .DAT SLOT
DATPST	0			/PAST .DAT SLOT.
DLIT1	1
DLIT2	2
DLIT3	3
DLIT4	4
DTOLBM	0			/REL. BIT MAP ADDRESS
DTXROL	0			/OLD BIT MAP POINTER
DTUWC	0			/USER BUFFER WORD COUNT
DTUDRR=DTDVS			/USER DIR. ENTRY POINTER (FIXED)
DTUDRP=DTCKSM			/USER DIR. ENTRY POINTER (INDEXED)
DTCTS=DTCCA			/ENTRY COUNT (-3)
DTCT1=DTUPTR			/GEN. PURP. COUNTER AND T. STOR.
DTDATC=DTTABL			/LINE DATA COUNT
DTUHP=DTDRIN			/USER LINE BUF. HEADER POINTER
DTCT1S=DTWC			/MATCH COUNT (-4)
DTDES=DTWCS			/DTA DIR. ENTRY SECTION POINTER (INDEXED)
DTDVSM=DTCALP			/DATA VALIDITY BIT MASK
DTBMCT=DTOLBM			/BIT MAP SEARCH COUNT (MUST BE 5 OR MORE TO EXIT)
DTCLCT=DTMPP			/CLEAR COUNT (INIT=-200)
DTWPC=DTSET			/WORD PR. COUNT FROM HEADER
DTDLUN=DTEOF			/RENAME OR DELETE UNDERWAY
	.END
