          .TITLE DPB.
/	6-22-70 (EDIT 5)
/COPYRIGHT 1969,1970 DIGITAL EQUIPMENT COPR.,MAYNARD, MASS.
/RP09/15 ADAPTATION 8-17-70
/W.A. DESIMONE (RP EDIT 6)10-20-70
/M. SIFNAS
/DPB.=IOPS DISK/DECTAPE HANDLER-READ, WRITE IOPS MODES ONLY, 2 FILES
/LIMITED FUNCTIONS
/2-256 WD. BUF.
/2 DIRECTORY BIT MAPS (32 WDS), 2 FILE BIT MAPS (32 WDS)
/2 FILES ACTIVE AT ANY GIVEN TIME
/CALLING SEQUENCE
/CAL+.DAT SLOT(9-17)+I(7-8)/.INIT
/UNIT (0-2)+1
/RESTART ADDR. (MEANINGFUL FOR TTY HANDLER ONLY)
/BUF SIZE (255)
/CAL+.DAT SLOT (9-17) /.OPER (ILL. FUNCTION)
/DIR TYPE (0-2)=1+CORE ADDR. (3-17)
/UNIT (0-2)+2
/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 (ILL. FUNCTION)
/UNIT(0-2)+5
/CAL+.DAT SLOT(9-17)  /.CLOSE
/UNIT(0-2)+6
/CAL+SUBFUNCTION(5-8)+.DAT SLOT /.MTAPE (0=REWIND) (ILL. FUNCTION)
/UNIT(0-2)+7                               (2=BACKSPACE RECORD)
/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
/BUSY ADDRESS (15 BITS)
/CAL+X(8)+.DAT SLOT (9-17)  /.TRAN (X=0=READ) (ILL FUNCTION)
/UNIT (0-2)+13                  (X=1=WRITE)
/BLOCK#
/CORE ADDRESS
/-WC
/
	.EJECT
          .GLOBL     DPB.
IDX=ISZ
/IOT ASSIGNMENTS
DPCS=706324			/CLEAR STATUS  (BITS 13,17,18 OF ST.A)
				/(BITS 9-15 OF ST.B)
DPSJ=706341			/SKIP ON JOB DONE FLAG
DPSE=706361			/SKIP ON ERROR FLAG
DPLF=706464			/LOAD ST.A (BITS 0-8)
DPLA=706304			/LOAD CYA,HA,SA FROM AC.
DPCA=706344			/LOAD CA REGISTER FROM AC (3-17)
DPWC=706364			/LOAD WC REGISTER FROM AC
DPRSA=706312			/READ ST. A INTO AC
DPRU=706412			/READ CA INTO AC (10-17)
DPCN=706454			/EXECUTE FUNC. REG.-AC CLEARED
DPRA=706432			/READ CYA,HA,SA INTO AC
DPRC=706452			/READ CA REGISTER INTO AC (3-17)
DPRW=706472			/READ WC REGISTER INTO AC
DPRSB=706332			/READ STATUS B INTO AC
DPLO=706444			/LOAD AC ONES INTO ST. A (BITS 0-8)
DPSA=706321			/SKIP ON ATTENTION FLAG
DABSIZ=BLBND-BLAB
	.IFUND	DELTA
DELTA=5
	.ENDC
DPB.      DAC        DTCALP                /CAL POINTER
          DAC        DTARGP                /ARG. POINTER
          ISZ        DTARGP                /INDEX TO FUNCTION (AND UNIT#)
          LAC*       DTARGP
          AND        DTUMSK
          DAC        DTCT1                 /T SAVE UNIT#
/EXTRACT DATA MODE OR SUBFUNCTION
	LAW 7000
	AND* DTCALP
	RAR!CLL
	RTR
	RTR
	RTR
	RTR
	DAC DTCT2
/FILE STORAGE BLOCK SWAP ROUTINE
          LAC*       DTCALP                /GET DAT SLOT (9-17)
          AND        (777
DTSLOT=DTTABL                              /T. STORE FOR NEW DAT SLOT
          DAC        DTSLOT                /T. SAVE
	SAD DTFLS2		/FILE 2 SLOT #
          JMP        DTSWAP                /CURRENT CALL FOR FILE 2
	SAD DTFLS1		/FILE 1 SLOT #
          JMP        DTSLOK                /CURRENT CALL FOR FILE 1
	LAC DTCT2			/MUST BE AN INIT
	XOR DTIOSW		/DOES I/O BIT FOR FILE ONE MATCH NEW ONE?
	SNA			/NO, SWAP
	JMP DTSLOK
/
	.EJECT
/SWAP STORAGE BLOCKS
DTFB1P=DTMPS
DTFB2P=DTMPP
DTSWAP    LAC        DTCT1                 /UNIT # OF CURR. CALL
	XOR	DTUNIT		/UNIT # OF FILE 1
	DAC DTSAM			/SET SAME UNIT SW
	LAW	-DABSIZ		/SAVE FULL BLOCK (A & B)
DTSWP1	DAC	DTCT		/COUNT TO MOVE
	LAC	(DLTDIR		/1ST ADDR. OF FILE BLOCK 1
	DAC	DTFB1P		/FILE BLOCK 1 POINTER
	TAD LDAB			/(DABSIZ
	DAC	DTFB2P		/FILE BLOCK 2 POINTER
DTSWP2	LAC*	DTFB1P		/SAVE BLOCK 1 CELL
DTBLSV=DTWCS			/T. STORE FOR FILE BLOCK SWAP
	DAC	DTBLSV
	LAC*	DTFB2P		/BLOCK 2 CELL INTO BLOCK 1
	DAC*	DTFB1P
	LAC	DTBLSV		/BLOCK 1 CELL INTO BLOCK 2
	DAC*	DTFB2P
	ISZ	DTFB1P
	ISZ	DTFB2P
	ISZ	DTCT
	JMP	DTSWP2		/CONT.
DTSLOK	LAC	DTCT1		/CURR. UNIT
	DAC	DTUNIT		/INTO FILE BLOCK 1
	LAC	DTSLOT		/STORE CURRENT DAT SLOT #
	DAC	DTFLS1		/IN FILE BLOCK 1
	LAC*	DTARGP		/FUNCTION (3-17)=1-13
	ISZ	DTARGP		/INDEX TO ARG.3
	AND	(77
	TAD	(JMP DTTABL
	DAC	DTTABL
	CLA			/AC MUST BE 0 FOR DISPATCH.
DTTABL	XX
	JMP	DTIN		/1=.INIT
	JMP	DTER6		/2=.OPER (ILL)
	JMP	DTSEEK		/3=.SEEK
	JMP	DTENTR		/4=.ENTER
	JMP	DTER6		/5=.CLEAR (ILL.)
	JMP	DTCLOS		/6=.CLOSE
	JMP	DTER6		/7=.MTAPE (ILL)
	JMP	DTREAD		/10=.READ
	JMP	DTWRIT		/11=.WRITE
	JMP	DTWAIT		/12=.WAIT,.WAITR
	JMP	DTER6		/13=.TRAN (ILL.)
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
/DTA-DISK-INTERRUPT SERVICE
DTPIC	DAC	DTAC		/SAVE AC
	LAC*	DLIT0
	DAC	DOUT		/SAVE PC, LINK, EXT. MODE, MEM. PTCT.
	LAC	DTION
	JMP	DTSTON
/
DTINT	JMP	DTPIC		/PIC ENTRY
	DAC	DTAC		/API ENTRY, SAVE AC
	LAC	DTINT		/SAVE PC, ETC.
	DAC	DOUT
	IORS			/CHECK PIC STATUS
	SMA!CLA			/FOR RESTORATION AT DISMISSAL
	LAW	17740		/PIC OFF, BUILD IOF
	TAD	DTION		/PIC ON, BUILD ION
DTSTON	DAC	DTDVSW
/
/RP15 DISK STATUS REGISTER "A" BIT ASSIGNMENTS
/	0-2=SELECTED UNIT
/	3-5=FUNCTION
/	0=IDLE,1=READ,2=WRITE,3=RECALIBRATE
/	4=SEEK,5=READ ALL,6=WRITE ALL, 7=READ COMPARA
/	6=DONE AND ERROR FLAG INTERRUPT ENABLED
/	7=ATTENTION FLAG INTERRUPT ENABLED
/	8=GO
/	9=WRITE PROTECT ERROR
/	10=NON-EXISTENT CYLINDER ADDRESS
/	11=NON-EXISTENT SURFACE ADDRESS
/	12=NON-EXISTENT SECTOR ADDRESS
/	13=HEADER NOT FOUND
/	14=SELECTED UNIT IS WRITE PROTECTED
/	15=SELECTED UNIT IS SEEK INCOMPLETE
/	16=JOB DONE FLAG
/	17=ERROR FLAG
/RP15 DISK STATUS REGISTER "B" BIT ASSIGNMENTS
/	0-7=ATTENTION UNITS 0-7
/	8=SELECTED UNIT IS UNSAFE
/	9=PROGRAM ERROR
/	10=END OF PACK
/	11=TIMING ERROR
/	12=FORMAT ERROR
/	13=WRITE CHECK ERROR
/	14=WORD PARITY ERROR
/	15=LONGITUDINAL PARITY ERROR
/	16=SELECTED UNIT SEEK UNDERWAY
/	17=SLECTED UNIT NOT READY
/
	DPRSA			/READ DISK STATUS
	DAC	DKSET		/TEMP
	CLL!RAR
	SZL
	JMP	DTERT		/ERR. FLAG
RFRDWT	DPCS			/CLEAR DISK STATUS
	LAC DKSET	/GET ST A FOR RP UNIT#
	AND (700000)		/MASK UNIT# AND ISSUE IDLE
	DPLF	/TO CLEAR DONE AND ERR INTERRUPT ENABLE
DTION	ION			/ION TO ALLOW OTHER INTERRUPTS
	DZM	DTUND		/CLEAR I/O UNDERWAY
	LAC	RPCABS		/BASE CYL. ADDR. FROM .INIT
	DAC	RPCACK		/INIT. CYL ADDR. FOR BLK 100 TEST
RPCM10	LAW	-10		/SET COUNTER
	DAC	RPCT1
	LAC	DTBLC
	AND	(1777)		/MASK HA,SA
	SAD	(304)		/IS HA,SA=6,4?
	SKP
	JMP	DTION1
DTION3	LAC	DTBLC
	AND	(776000)	/(776000
	SAD	RPCACK
	JMP	DTION2		/LOG BLK# 100 TRANSF.
	LAC	RPCACK		/ADD 3 TO CYL. ADDR TO
	TAD	(6000		/CHECK ANOTHER LOG. UNIT#
	DAC	RPCACK
	ISZ	RPCT1		/BUMP CNT-CHECK ONLY 8 UNITS
	JMP	DTION3
DTION1	CLC
	JMP	DTDISM
DTION2	LAC	DTDRGT		/CHECK DIR. REQ. SWITCH
	SZA!CLC
	JMP	DTDISM
	DAC	DTDRGT		/CLEAR
	LAC	DTUNIT
	DAC	DTNCOR
	JMP	DTDISM		/DATA OK, DISMISS
DTERT	LAC	DKSET		/RELOAD ST A.
	AND	(24)
	SZA			/AC70 IF SEEK INCOMP. OR HEADER
	JMP	RPRCL		/NOT FOUND-RECALIBRATE + RETRY
	LAC	DKSET
	AND	(340)		/AC70 IF NON-EXISTENT DISK ADDR.
	SZA
	JMP	DTER21
	LAC DKSET	/CHK. FOR WRITE PROT. ERR
	AND (400)	/IF AC>0 WRITE PROT. ERR
	SZA
	JMP DKIPS4
	DPRSB			/LOAD STATUS B
	DAC	RPSTB		/STORE
/CHECK STATUS B.
/
	AND	(34)		/AC>0 IF LONG., WORD PARITY, WRITE CHK.,
	SZA			/WRITE CHECK SHOULD NEVER HAPPEN
	JMP	DPARIT		/RETRY AND PASS DATA ANYWAY
	LAC	RPSTB
	AND	(140)		/AC>0 IF FORMAT ERR OR TIMING ERR.
	SZA			/RETRY.IF FAILS, IOPS 12 PLUS
	JMP	RP12RT		/STATUS B
	LAC	RPSTB
	AND	(200)		/END OF PACK
	SZA			/IF AC>0-IOPS-21
	JMP	DTER21
RPER12	LAC	RPSTB		/FALLS THROUGH HERE
	DAC*	DLIT3		/ON PROGRAM ERROR OR
	CLA			/SELECTED UNIT UNSAFE
	JMP	DTER12		/IOPS 12
DKIPS4	LAC (DRETRY
	DAC* DLIT3
	LAC DLIT4	/IOPS 4
	JMP DTM4
RPRCL	LAC	(30000		/LOAD RECALIBRATE FUNCT.
	XOR	RPUNIT		/AND RETRY.
	DPLF
	DPRSB		/2 INSTRS. FOR 4 MICROSEC. DELAY
	DPRSB
	DPSA			/TEST ATTENTION FLAG
	JMP	.-1
	ISZ	DTERCT
	JMP	DRETRY		/GO RETRY
	JMP	DKER20		/DISK FAILURE
RP12RT	ISZ	DTERCT		/RETRY ROUTINE FOR FORMAT
	JMP	DRETRY		/OR TIMING ERROR
	JMP	RPER12
DKER20	LAC DKSET		/DISK HARDWARE OR ADDR. PARITY.
	DAC* DLIT3		/(.MED
	LAW	20
	JMP	DTM4		/DISK FAILURE.
DTER21	LAC	DKSET		/ILLEGAL DISK ADDRESS.
DTR21A	DAC*	DLIT3
	LAW	21
	JMP DTM4
DPARIT	ISZ	DTERCT		/IF OVERFLOW, TAKE DATA ANYWAY
	SKP
	JMP RFRDWT
DRETRY	JMS	DKSET		/REISSUE  DISK READ
DNRET	LAC DTERCT		/0 IF TRY COUNT OVERFLOWS
	DAC DTUND			/I/O UNDERWAY SW.
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	DTCT2		/I OR O
	DAC	DTIOSW		/OUTPUT=1, INPUT=0
	ISZ	DTARGP		/INDEX TO NORM. EXIT
	SNA!CLL			/L=0 FOR BIT MAP CLEAR
	JMP DTIN3			/INPUT
	LAC	DLMBIT		/(DT2BIT)
	JMS	DTBFC2		/CLEAR FILE BIT MAP (L=0)
DTIN3	LAC	DTSAM		/SAME UNIT-BOTH FILES
	SZA			/YES - CHECK DATSLOT
	JMP DTIN1			/WAIT IF I/O UNDERWAY
	LAC	DTFLS1		/IS CURR. DAT SLOT SAME AS
	SAD	DTCSLT		/THAT FOR I/O UNDERWAY
DJSTOP	JMP	DTSTOP		/YES
	JMP	DTIN2		/NO - WAIT
DTIN1	LAC	DTUND		/IS I/O UNDERWAY FOR
	AND	(700000		/A UNIT OTHER THAN
	XOR	DTUNIT		/CURRENT INIT
	SZA			/NO
DTIN2	JMS	DTIOU		/YES - WAIT
DTONCE	CAL	64		/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
/DTERCT=PARITY COUNTER (INIT. TO-10)
/DTBLC=BL# BEING SEARCHED FOR
/DTEOTS=END ZONE (EOT) ENTERED SWITCH (-=EOT, +=NO EOT)
/DTCSLT=DAT SLOT FOR I/O UNDERWAY
/DTCCA=CURRENT ADDR. (C.A.) POINTER FOR TRANSFER
/RPCABS=STORAGE FOR BASE SUPERUNIT ADDRESS
/RPUNIT=PHYSICAL DISK PACK DRIVE #
/RPSTB=STORAGE FOR STATUS B
/RPCACK=TEMP STORAGE FOR CHECK BLK# 100 ROUTINE
/DTSAFE=BLOCK # SAFE STORAGE DURING TRANSFER.
/DTCKSM=LINE CHECKSUM.
/DTDMOD=DATA MODE. (15-17).
/DTHPTS=DKA BUFFER LINE POINTER POINTER.
/DTTR=READ (13000) OR WRITE (15000)
/DTUCKP=USER LINE BUFFER CHECKSUM POINTER
/DTUDP=USER LINE BUFFER DATA POINTER (MODIFIED).
/DTUHP=USER LINE BUFFER HEADER POINTER.
/DTDIRA=BIT MAP DIRECTION SWITCH (CURR. BLOCK)+1=F,-1=R.
/DTPONT=CURRENT FILE BIT MAP POINTER
/DTBLOK=BLOCK EXAMINED COUNT
/DTDIRL=DTDIRA FOR LAST BLOCK TRANSFERRED.
/DTMTRX=CURRENT BIT MAP WORD POINTER.
/DTRBIT=18 BIT COUNTER FOR BIT MAP SEARCH.
/RPTEMP=TEMP. LOC FOR DKSET ROUT.
DTAC	16			/.SETUP
DOUT	DPSJ			/DISK DONE FLAG SKIP
DTCCA	DTINT			/INT. SERV. ADDR.
RPCABS	CAL	64
RPUNIT	16
RPSTB	DPSE			/SKIP ON ERROR FLAG
RPCACK	DTINT
DTSAFE	JMP	DTEOTS
DTERCT	0
DTBLC	0
DTBLNC	0
DTEOTS	LAC	DJSTOP		/SIGN BIT MUST INITIALLY = 0 FOR DTEOTS
DTCSLT	DAC	DTONCE
DTCKSM	LAS			/READ AC SWITCHES
DTWC	AND	(770)		/DRIVE #(9-11) SUPER UNIT #(12-14)
DKCLR3	DAC	DTCKSM		/MASK BITS 9-14 AND STORE
DKNUM	AND	(700)		/MASK BITS 9-11
DKUNIT	JMS	DTBLOK		/AND SET UP RP UNIT#
DTDMOD	DAC	RPUNIT		/TOTAL ROT LEFT 9 AND STORE
DTHPTS	LAC	DTCKSM
DKBUFP	AND	(70)		/MASK BITS 12-14
DTTR	DAC	DTCKSM		/STR SUPUNT# TIMES 10(8)
DTUCKP	RAL!CLL			/NOW TIMES 20(8)
DTUDP	TAD	DTCKSM		/NOW TIMES 30(8)-THAT IS
DTUHP	JMS	DTBLOK		/30(8)*SUPUNT#=20(8)*SUPUNT#+10(8)*SUPUNT#
	RAL			/TOTAL OF 10 SHFTS
DTDIRA	DAC	RPCABS		/STORE BASE CTL. ADDR.
DTPONT	JMP	DTSTOP
DTBLOK	0
DTDIRL	RAL!CLL
RFMCH4	RTL
DTMTRX	RTL
DTRBIT	RTL
RPTEMP	RTL
RPCT1	JMP*	DTBLOK
DTBMIN=DTFAKE			/BIT MAP BLOCK IN SWITCH (NON0=IN)
DTBMOT=DTFAKE+1			/BIT MAP BLOCK OUT SWITCH (NON0=OUT)
/
/STOP DTA ROUTINE
DTSTOP	DZM	DTWRWT		/CLEAR OUTPUT WAIT SWITCH
	DZM	DTEOF		/CLEAR EOF SWITCH
	DZM	DTCLSS		/SET .CLOSE SWITCH
	DZM DTSKNT		/CLEAR .SEEK,.ENTER SW
	DZM	DTBMIN		/BIT MAP BLOCK IN SWITCH
	DZM	DTBMOT		/BIT MAP BLOCK OUT SWITCH
	LAC	DTMTP4		/JMP DTAPE1
	DAC	DTOUT
	DAC DTNCOR		/CLEAR DIRECTORY IN CORE SWITCH.
	JMP DTDBK-1
/WAIT DTA ROUTINE
DTWAIT	LAC DTCT2			/0 IF .WAIT
	SNA			/1 IF .WAITR
	JMP DTDBK-1
	LAC (700000		/GET LINK,EXT MODE, MEM PTCT
	AND DTCALP
	DAC DTCALP
	LAC* DTARGP		/BUSY ADDR
	AND (77777
	XOR DTCALP
	ISZ DTARGP
	DAC DTCALP
	JMS DTIOU			/CHECK I/O UNDERWAY
DTDBK	DBR
	XCT .+1
	XCT .+1
	JMP*	DTARGP		/NORM. EXIT
/
/CHECK DIRECT. IN CORE SUBR.
DTDRCK	0
	JMS	DTIOU		/I/O UNDERWAY
	LAC	DTNCOR		/D IN 
	SAD	DTUNIT		/NO
	JMP DTDRC1		/YES - CHECK PARITY.
	LAC	(13000		/READ PARAM
	JMS	DTDRIN		/BRING IN DIRECTORY
	JMP	DTDRCK+1		/WAIT FOR DIRECTORY
DTDRC1	LAC DTERCT		/DIRECTORY UNACCEPTABEL WITH PARITY ERROR.
	SZA
	JMP* DTDRCK		/OK.
DTER61	LAW 61			/DIRECTORY OR FILE BIT MAP PARITY ERROR.
	JMP* DLIT4
/
/CALL IN DIRECTORY SUBR.
DTDRIN	0
	DAC	DTTR		/TRANSFER DIRECTION SWITCH
	LAC	(100
	DAC	DTNXBK		/BL# TO TRANSFER
	DZM	DTDTR		/TRANSFER FORWARD
	DZM	DTDRGT		/SET IND. TO SET DIR IN CORE SWITCH
	LAC	DTCLSS		/0 IF SEEK, ENTER
	SZA!CLA
	TAD	(40		/NOT 0 IF CLOSE (DTBUF-1
	TAD	DLTDIR		/(DTRDIR
DTDRN1	JMS	DTWCS		/SETUP WC,CA
	JMP*	DTDRIN
DTDRGT	777777			/GET DIR INDIC. (+0=GET)
/
DTUDRR=DTDVS			/USER DIR. ENTRY POINTER (FIXED)
DTUDRP=DTCKSM			/USER DIR. ENTRY POINTER (INDEXED)
DTCTS=DTCCA			/ENTRY COUNT (-3)
DTCT1S=DTWC			/MATCH COUNT (-4)
DTDES=DTWCS			/DTA DIR. ENTRY SECTION POINTER (INDEXED)
/DIRECTORY SEARCH SUBR.
DTSK1	0
	DAC	DTUDRR		/USER DIR. ENTRY POINTER
	DZM	DTDTR		/SET TRANSF. DIRECTION=FORWARD
DTSK2	CLC			/SYSTEM TAPE?
	XOR* DLTSYS		/WD 3 OF SYS BIT MAP
	SNA!CLA			/NO, 56 FILES
	LAW -30			/YES, 24 FILES
	SMA
	LAW -70
	DAC	DTFPCT
	XOR (777700
	DAC DBLKLC		/50 IF 24; 10 IF 56
	LAC DTIOSW
	SNA!CLA
	LAC (40			/IF INPUT UPDATE POINTER TO DES
	TAD	DLTBUF		/DIR. POINTER=DTDIR+40
DTSK3	DAC	DTDES		/ENTRY SECTION POINTER
	DAC	DTCURE		/CURR. ENTRY, WD0, POINTER
/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 (.E.)
	SAD*	DTUDRP		/USER D.E.
	ISZ	DTCT1S		/WD N OF ENTRY SATCHES
	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	DTCT1S		/MATCH
	SKP			/N
	JMP*	DTSK1		/YES-CURRENT ENTRY POINTER IN AC
	TAD	DLIT4		/INDEX TO NEXT ENTRY
	ISZ	DTFPCT		/INDEX FILE ENTRY CT.
	JMP	DTSK3		/NEXT ENTRY
DLCLA	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
	JMP	DTFEND		/INPUT-CLEAR SWITCHES EXIT
DTCLS2	LAC	DTEOF		/EOF BUF IS OUT
	SPA!CLC
	JMP	DTCLS3
	DAC	DTEOF		/SET EOF SWITCH
	LAC	DTDMOD		/FOR USE OF DTMCK
	DAC	DTCT
	LAC	(15000		/OUTPUT
	JMS	DTMCK
	LAC	DLEOFH		/EOF HEADER POINTER (DTEOFH
	JMP	DTWRT1
DTCLS3	LAC	DTBMIN		/FILE BIT MAP BLOCK IN
	SZA!CLC
	JMP	DTCLS4
	DAC	DTBMIN		/SET BIT MAP IN SWITCH
	LAW -50
	TAD DBLKLC
	SNA!CLA			/NON0 IF 56 FILES
	LAW -4			/24 FILES
	TAD (77
DTCLT	DAC	DTNXBK		/BIT MAP BLOCK #
	LAC	DTFPCT		/FILE COUNT
	TAD	(10
	DAC	DTFPCT
	SMA!CLC
	JMP	DTCLQ		/IN THIS BLOCK
	TAD	DTNXBK		/DECR. BIT MAP BL# BY 1
	JMP	DTCLT
DTCLQ	LAC	DTBUSB
	DAC	DTOUT
	DZM	DTDTR		/SET TRANSF. DIR. SW.=FORW.
	JMP	DTSEK1		/READ BIT MAP BLOCK INTO DIR. BIT MAP
/
DTCLS4	LAC	DTBMOT		/FILE BIT MAP BLOCK OUT
	SZA!CLA
	JMP	DTCLS6
	SAD DTERCT		/PARITY ERROR COUNT.
	JMP DTER61		/ERROR ON FILE BIT MAP.
	LAC	DTFPCT		/REL. BIT MAP POINTER
	CLL!RAL			/X 40
	RTL
	RTL
	TAD	DLTBUF		/(DTBUF
	DAC DTBMOT		/SET BIT MAP OUT SWITCH.
DTOLBM=DTOBCK			/RELATIVE FILE BIT MAP ADDRESS
DTXROL=DTMPS			/OLD BIT MAP ADDRESS
	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	DTSEK2		/OUTPUT BIT MAP BLOCK
/
/SUBROUTINE TO XOR BIT MAP 1 INTO BIT MAP 2
/ALSO CLEARS BIT MAP 1
/
DTXOR	0
DTXRNW=DTMPP			/NEW BIT MAP ADDRESS
	DAC	DTXRNW		/BIT MAP 2 ADDR
	LAW	-40
	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		/FILE CLOSED (AC=0 ON ENTRY).
	JMP	DTFEND		/YES-CLEAR SWITCHES, EXIT
	JMS	DTDRCK		/LOAD DIRECTORY INTO DTBUF
	LAC	DTBMPT		/DT. BIT MAP POINTER
DTCLRP=DTMPS			/COUNTER
	DAC	DTCLRP		/NIT. DIR ENTRY SECT. POINTER
	LAW	-40		/DIR. ENTRY SECTION COUNT
	DAC	DTCT
	LAC	DLTBUF		/(DTBUF)
	DAC	DTCT1
DTCLS5	LAC*	DTCLRP		/TRANSFER DIR. BIT MAP
	DAC*	DTCT1		/TO FRONT OF DIR. ENTRY SECTION
	ISZ	DTCLRP
	ISZ	DTCT1
	ISZ	DTCT
	JMP	DTCLS5
	LAC	DLSAV		/(DTESAV)
DTFIN=DTBFC2			/DT1SAV OR DT2SAV POINTER
	DAC	DTFIN
	LAC	DTCURE		/ADD 40 TO ACCOUNT FOR BLOCK MOVE
	TAD	(40
	DAC	DTCURE
	LAW	-4
	DAC	DTCT
DTCLS7	LAC*	DTFIN		/NEW FILE NAME (4 WDS)
	DAC*	DTCURE		/INTO DIRECTORY ENTRY SECTION
	ISZ	DTFIN
	ISZ	DTCURE
	ISZ	DTCT
	JMP	DTCLS7
	LAC	(15000		/REWRITE DIRECTORY
	JMS	DTDRIN
	DZM	DTCLSS		/CLEAR CLOSE IND.
	JMP	DTCLOS
DTFEND	DZM	DTFLS1		/CLEAR FILE 1 DAT SLOT
	JMP	DTSTOP
/
/SUBR. TO SET UP CA, WC AND TRANSFER
DTWCS	0
	DAC	DTCCA		/ADDR
	LAW	-5
	DAC	DTERCT		/PARITY ERROR RETRY COUNT
	DAC	DTUND		/I/O UNDERWAY
	LAC	DTFLS1		/SAVE CURR. SLOT POINTER
	DAC	DTCSLT
	LAC	DTUNIT		/CHECK FOR LEGALITY OF
	CLL			/
	AND	(700000		/MASK BITS 0-2
	RTR
	RTR
	DAC	RPTEMP		/STORE 2* UNIT# IN BITS 0-7
	RAR
	TAD	RPTEMP		/NOW 3* UNIT# IN BITS 0-7
	TAD	RPCABS		/BASE CYL. ADDR FROM .INIT
	DAC	DTBLC		/ABSOLUTE CYLA IN (0-7)
	LAC	DTNXBK		/LOGICAL BLOCK NUMBER
	TAD	(-1100		/-1100(8)
	SPA			/CHECK FOR ILLEGAL BLOCK NUMBER
	JMP	DTWCS1		/GO ON AND FINISH CONVERSION
	LAC	DTNXBK		/ILLEGAL BLOCK NUMBER
	JMP	DTR21A		/OUTPUT BAD BLOCK# WITH ERROR
DTWCS1	LAC	DTNXBK		/CONVERT LOGICAL BLK# TO
	DAC	RPTEMP		/ABSOLUTE PACK ADDR.
DTWCS2	TAD	(-310
	SPA			/BLK# < 310(8)?
	JMP	DTWCS3		/GO GET HEAD ADDR
	DAC	RPTEMP		/STORE REMAINDER
	LAC	DTBLC
	TAD	(2000)		/ADD ONE TO CA
	DAC	DTBLC
	LAC	RPTEMP
	JMP	DTWCS2
DTWCS3	LAC	RPTEMP
DTWCS4	TAD	(-12
	SPA
	JMP	DTWCS5
	DAC	RPTEMP
	LAC	DTBLC
	TAD	(40)		/BUMP HEAD ADDRESS
	DAC	DTBLC
	LAC	RPTEMP
	JMP	DTWCS4		/RECYCLE
DTWCS5	LAC	DTBLC
	TAD	RPTEMP		/INCLUDE SECTOR ADDRESS
	DAC	DTBLC
	JMS	DKSET
	JMP*	DTWCS
/SUBR TO SET UP DISK I/O AND EXECUTE IOT'S
DKSET	0
DKSET2	LAC	DTCCA
	DPCA			/LOAD CA
DTUMSK	LAW	-400
	DPWC			/LOAD WC
	LAC	DTBLC
	DPLA			/LOAD C-1L. ADDR,HA,SA
	LAC	RPUNIT		/DESELECT CURRENTLY ACTIVE DRIVE
	TAD	(400000		/TO ALLOW READ ONLY SWITCHES
	DPLF			/TO ACTIVATE
	LAC	DTTR
	XOR	(13000
	SZA			/ZERO IF INPUT
	LAC	(10000		/OUTPUT
	TAD	(10000
	XOR	RPUNIT		/LOAD PACK PHYS. UNIT#
	DPCS			/CLEAR STATUS
	DPLF			/LOAD FUNCTION LESS GO BIT TO TEST UNIT
	DPRSB			/READY.
	NOP			/ADDED INSTR. FOR 4 MICRS. DELAY
	DPRSB			/ADDED INSTR. FOR 4 MICRS. DELAY
	RAR
	SZL	/L=1 IF SELECTED UNIT NOT READY
	JMP	RPUOFL		/AC=0 IF WRITE PROT. ERR. -IOPS4
	LAC	(5000		/JAM GO BIT, JB. DONE AND ERR INTERP.
	DPCS			/ENABLE-CLEAR STATUS
	DPLO			/LOAD GO BIT+INTERRUPT ENABLES
	ION			/ALLOW OTHER INTERRUPTS
	JMP*	DKSET
RPUOFL	LAC (DKSET1		/IOPS 4 ON UNIT OFF LINE
	DAC* DLIT3
	LAC DLIT4
	JMP DTM4
DKSET1	LAC DTERCT
	DAC DTUND	/RESET I/O UNDERWAY SWT.
	JMP DKSET2
/
/.READ, .WRITE COMMON SETUP SUBR.
DTUWC=DTXOR			/USER 2'S COMP. WC FOR ARG. LIST
DTWPC=DT2XOR			/WORD PAIR COUNT FROM HEADER
DTMCK	0
	DAC	DTTR		/READ (13000) OR WRITE (15000)
	LAC DTSKNT		/.SEEK OR .ENTER EXECUTED?
	SNA!CLC			/YES, OK FIR READ , WRITE
	JMP DTER12		/NO, IOPS 11
	XCT*	DTMCK		/L.B. OR DTA BUF. L.B. ADDR.
	ISZ	DTMCK		/INDEX TO IMAGE EXIT
	DAC	DTUHP		/HEADER POINTER
	DAC	DTUDP		/DATA POINTER
	ISZ	DTARGP
	LAC*	DTARGP		/USER WC
	DAC	DTUWC
	LAC*	DTUHP		/COMPUTE W.C. FROM L.B.H. W.P.C
	JMS	DTGWPC
	LAC	DTCT2		/DATA MODE
	DAC	DTDMOD
	JMP*	DTMCK		/EXIT,
/
/SUBR. TO TRANSF. WPC FROM HEADER TO DTWPC
DTGWPC	0
	RTR
	RTR
	RTR
	RTR
	AND	(776
	DAC	DTWPC		/T. STORE L.B.W.P.C.
	SNA			/ILL. WPC?
	JMP DTER23		/0 WPC
	AND (400
	SNA!CLA			/WPC GREATER THAN 177
	JMP*	DTGWPC		/L.B.W.C. INAC
DTER23	TAD	(5		/IOPS 23 - ILL. WPC
DTER16	TAD DLIT2
DTER15	TAD DLIT1		/DISK UNIT FULL.
DTER14	TAD	DLIT2		/FILE NOT FOUND (DTER13)
DTER12	TAD	DLIT4		/IRREC. DTA ERROR
				/.SEEK,.ENTER NOT EXECUTED (DTER11)
DTER6	TAD	(6		/ILL. HANDLER FUNCTION
DTM4	DZM DTUND	/CLEAR I/O UNDERWAY IN CASE ^P
	JMP*	DLIT4		/KM-9 ERROR LOC (.MED+1=4)
/SUBR. TO ADD TO CHKSUM AND INDEX COUNTS
DTUPTR	0
	TAD	DTCKSM		/ADD DATA WD TO CKSM.
	DAC	DTCKSM
	ISZ	DTUDP
	ISZ	DTRHPT
	ISZ	DTBFCT		/INCR DTA BUF COUNT
	ISZ	DTWPC
	JMP*	DTUPTR
	JMP	DTRDE		/END LINE
/
/SUBR. TO CHECK ACTIVE FILE
DTCKCL	0
	JMS	DTDRCK		/CHECK FOR DIRECTORY IN CORE
	LAC*	DTARGP		/USER D.E. POINTER
	JMS	DTSK1		/DIR. SEARCH FOR FILE
	DAC	DTCLSS		/CLEAR OR SET CLOSE SWITCH
	JMP*	DTCKCL
/
/DTA SEEK FILE SUBR
DTSEEK	JMS	DTCKCL		/CHECK DIRECTORY FOR THIS FILE
	SNA!CLC
	JMP DTER14		/FILE NOT FOUND
	XCT	DTSK5		/LAC* DTDES(GET 1ST BL.#)
	XOR (400000		/CLEAR FILE COMPLETE BIT.
	DAC	DTNXBK		/BL. TO READ
	DAC DTSKNT		/SET .SEEK EXECUTED SW
DTSEK1	LAC	(13000
DTSEK2	DAC	DTTR		/INPUT
	DAC	DTNCOR		/CLEAR DIR. IN CORE SWITCH
	XOR	(13000
	SNA
	JMP	DTRNX1		/TRANSFER 1ST BLOCK IN
	JMP	DTCOUB		/OUT
/
/L.B. TO DTA BUF (.WRITE) OR DTABUF TO L.B. (.READ)
DTRWT	0
DTWT2	LAC*	DTUDP		/USER L.B.
	DAC*	DTHPT		/TO DTA BUF
	JMS	DTUPTR		/ADD TO CKSUM, INDEX CTS, ETC
	ISZ	DTHPT
	ISZ	DTUWC		/DONE
	JMP	DTWT2
	JMP*	DTRWT
/
/.WRITE ROUTINE
DTWRIT	JMS	DTIOU		/I/O UNDERWAY
	LAC	DTMTP4
	DAC	DTOUT
	LAC	(15000
	JMS	DTMCK		/READ/WRITE COMMON SETUP
	LAC*	DTARGP
DTWRT1	CLC
	TAD	DTWPC		/REMAINING BUF. AREA SIZE
	TAD	DTBFCT		/REMAINING BUF. AREA SIZE
	SMA!CLA
	JMP	DTCOUT		/NO ROOM FOR THIS LINE
DTWRT2	DAC	DTWRWT		/OUTPUT WAIT SWITCH-CLEAR
	LAC*	DTUHP
	AND	(7
	SAD	(5
	JMP	DTWRT4
	LAC*	DTUHP		/USER LBH., WD0
	AND	(377000
	XOR	DTDMOD		/DATA MODE
DTWRT3	DAC*	DTUHP
DTWRT4	ISZ	DTUHP		/CLEAR USER CKSM
	DZM*	DTUHP
	DZM	DTCKSM		/INIT CHECKSUM
	CLC			/EXCLUDE L.B.H.; WD0
DTWTM1	TAD	DTWPC		/FROM COUNT
DTWT	CMA
DTWT1	DAC	DTUWC		/ACTUAL WC (2'S COMP)
	LAC	DTHPT		/SET UP CKSM POINTER
	DAC	DTUCKP		/FOR .WRITE
	ISZ	DTUCKP
	JMS	DTRWT
/
DTWT4	CLC
	TAD	DTCKSM
	CMA
	DAC*	DTUCKP		/STORE 2'S COMP CKSUM IN DTABUF
	LAC	DTEOF
	SZA			/NO EOF
	JMP	DTCOUY		/TRANSFER EOF
	JMP	DTAPE1		/IOPS WRITE COMPLETE
DTWRCL	JMS	DTBUFC		/CLEAR DTA BUF
	ISZ	DTARGP		/INDEX TO WC
	JMP	DTWRT1		/PUT LINE IN DTA BUF
/
/
/CLEAR OUTPUT BUF. SUBR.
/ALSO NEEDED FOR INPUT BECAUSE OF POINTER INITIALIZATION
DTBUFC	0
	STL			/SET LINK TO CLEAR 400 CELLS
	LAC	DLTBUF		/BUF. (WD0) POINTER (DTBUF
	DAC	DTHPT		/DTA BUF HEADER POINTER
	DAC	DTRHPT		/FOR READ
	JMS	DTBFC2		/CLEAR BUF
	JMP*	DTBUFC
/
/CLEAR SPECIFIED AREA SUBR
DTBFC2	0
	DAC	DTCT2
	LAW	-40
	SZL			/CLEAR 40
	AND	DTUMSK		/CLEAR 400, DTUMSK=777400
DTCLCT=DTMPP			/COUNTER
	DAC	DTCLCT		/DTCLCT=DTMPP
	DAC	DTBFCT		/INIT BUF SIZE CT.
	ISZ	DTBFCT
DTBFC1	DZM* DTCT2
	ISZ	DTCT2
	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			/EOF SWITCH SET?
	JMS DTMAP			/FIND NEXT FREE BLK
	DAC* DTLINK		/DATA LINK POINTER
DTCOUB	LAC	DLTBUF		/(DTBUF
	JMS	DTWCS		/SETUP WC,CA AND BEGIN TRAN.
DTOUT	XX			/JMP DTAPE1 OR JMP DTBUSY
/DTA .READ ROUTINE
DTREAD	LAC	DTEOF		/EOF SWITCH SET?
	SZA
	JMP	DTEFX		/YES - IGNORE CALL
	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, RETURN TO .+2
	LAC	DTRHPT		/DTA BUF HEADER POINTER
	CLC
	TAD	DTWPC		/IOPS ASCII OR BIN (AC=777777 ON RETURN)
	TAD	DTUWC
	DZM	DTDVS		/CLEAR SHORT LINE FLAG
	SMA!CLC
	DAC	DTDVS		/SET SHORT LINE FLAG
	TAD	DTWPC
	CMA
	DAC	DTWPC		/2'S COMP HEADER W.C.
DTRD2	DZM	DTCKSM		/CLEAR CHECKSUM
	JMS	DTRWT		/TRANSFER LINE TO USER L.B.
	LAC*	DTUDP		/BYPASS
	JMS	DTUPTR		/EXCESS DATA
	JMP	.-2
/
/END INPUT LINE ROUTINE
DTRDE	LAC*	DTHPTS		/HEADER WD 0-IOPS
	AND	(7
	SAD	(5		/EOF?
	JMP	DTREOF		/YES
	ISZ	DTDVS		/SHORT LINE FLAG SET
	JMP	DTRDE1		/NO
	LAC	(60
	JMS	DTDVS		/SET D.V. BITS FOR SHORT LINE
DTRDE1	LAC	DTERCT		/PARITY RETRY COUNT
	SMA!CLA
	JMP	DTRDP		/SET D.V. BITS=PARITY
	LAC*	DTHPTS		/HEADER, WD 0
	SPA
	JMP	DTRDN		/IGNORE CKSUM ALREADY SET
	LAC	DTCKSM
	SNA			/SET D.V. BITS=CKSUM ERROR
	JMP	DTRDN
DTRDC	LAC	(20		/CHECKSUM ERR. IN LINE, 12,13=10
DTRDP	TAD	(20		/PARITY ERROR IN DTA BLOCK 12,13=01
	JMS	DTDVS		/SET DATA VALIDITY BITS
DTRDN	LAC*	DTUDP
DTRDN1	SNA!CLC
	JMP	DTRNEX		/NO MORE DATA-GET NEXT BL.
	ISZ	DTBFCT		/DATA BUF. CT = GET NEXT BL.
	JMP	DTRNOR		/NORM EXIT
DTRNEX	SAD*	DTLINK		/DATA LINK=-0
	JMP	DTREOF		/LAST BLOCK -SET EOF SWITCH
	LAC	DTNXBK		/LAST BL#
	CMA
	TAD*	DTLINK		/DATA LINK (NEXT BLOCK)
	SPA!CLA			/READ FORW
	CLC			/READ REV.
	DAC	DTDTR		/TRANSF. DIRECTION SWITCH
	LAC*	DTLINK
	DAC	DTNXBK		/DATA LINK INTO NEXT BLOCK
DTRNX1	JMS	DTBUFC		/INIT. BUFFER
	JMP	DTCOUB		/TRANSFER
/
/SUBR. TO SET DATA VALIDITY BITS
DTDVSM=DTTABL			/DATA VALIDITY BIT MASK
DTDVS	0
	DAC	DTDVSM		/SAVE MASK
	LAC*	DTHPTS		/MASK ALL BUT BITS 0, 12,13
	AND	(777717
	XOR	DTDVSM
	DAC*	DTHPTS		/HEADER, WD0
	JMP*	DTDVS
DTEFX	ISZ	DTARGP
DTREOF	DAC	DTEOF		/SET EOF SWITCH+DROP THRU TO EXIT
DTRNOR	TAD	DTBFCT		/DECR. (BY 1) DTFCT
	DAC	DTBFCT		/BUF COUNT
DTAPE1	ISZ	DTARGP
	JMP	DTDBK
DTNSH1	DAC	DTUWC
	JMP	DTRD2		/TRANSFER LINE
	.EJECT
/
/DTA ENTER FILE ROUTINE
DTENTR	JMS	DTCKCL		/CHECK DIRECTORY FOR THIS FILE
	SZA
	JMP	DTNTR6		/FOUND-WILL BE MODIFIED ON .CLOSE
	LAC	DLFAKE		/INIT GOR EMPTY SLOT SEARCH (DTFAKE
	JMS	DTSK1		/D SEARCH FOR EMPTY FILE ENTRY
	DAC	DTCLSS		/CLEAR OR SET CLOSE SWITCH
	SNA
	JMP DTER14		/DIRECTORY FULL DTER14
DTNTR6	LAC*	DTARGP		/SAVE USER D.E POINTER
	DAC	DTUDRP
	JMS	DTNTRZ		/SAVE USER D.E IN DT1SAV OR DT2SAV
	LAW	-40		/INIT BIT MAP SEARCH
	DAC	DTWMCT		/BIT MAP WORD COUNT
	LAC	DLMBIT		/FILE BIT MAP POINTER (DT1BIT) OR (DT2BIT)
	DAC	DTPONT		/CURR. FILE BIT MAP WD. POINTER
	LAC	DLTDIR		/BIT MAP ADDR. POINTER (DTDIR
	DAC	DTMTRX
	DAC	DTBMPT		/SET BIT MAP POINTER
	DZM	DTRELB		/BL. #
DL1100	LAW -1100
	DAC DTBLOK
DLM1	LAW -1			/INIT BIT MAP SEARCH TO FIND
	DAC DTREM			/1ST EMPTY BLK
	DAC DTSKNT		/SET .ENTER EXECUTED SW
	LAC	DLIT1		/(1
	DAC	DTDIRA		/SET BIT MAP DIRECTION SWITCH
	DAC	DTDIRL		/TO FORWARD (+1)
	JMS	DTMPS		/SETUP TO EXAM. MAP, WD0
DTNTR4	JMS	DTMAP		/GET NEXT FREE BL#
	SNA			/DO NOT ALLOW FILE TO BEGIN IN BLOCK ZERO.
	JMP DTER15
	XOR	(400000
	XCT	DTNTR3		/STORE BL#+COMPLETION BIT IN DTESAV+3
	SMA!CLC
	JMP	DTER16		/DECTAPE FULL (DTER15)
	DAC DTNCOR		/CLEAR DIR IN CORE SW
	JMS	DTBUFC
DTMTP4	JMP	DTAPE1		/NORM EXIT
/
	.EJECT
/SUBROUTINE TO SAVE USER D.E
DTNTRZ	0
	LAC	DLSAV		/(DT1SAV) OR (DT2SAV)
	DAC	DTFIN
	LAW	-3		/SET DTA D.E
	DAC	DTCT		/TRANSFER COUNTER
DTNTR2	LAC*	DTUDRP		/SAVE USER D.E
DTNTR3	DAC*	DTFIN
	ISZ	DTFIN
	ISZ	DTUDRP
	ISZ	DTCT
	JMP	DTNTR2
	JMP*	DTNTRZ
/
DT2SAV	0			/ NEW FILE ENTRY SAVED HERE
	0
	0
	0
DTFAKE	0			/EMPTY SLOT FOR ENTER SEARCH (LAST WD. UNUSED)
	0
DLIT0	0			/MUST BE 0
DTEOFH	1005			/EOF HEADER FOR CLOSE
/
/SUBR TO SET UP FOR EXAM OF NEXT BIT MAP WORD
DTMPS	0
	LAW	-22
	DAC	DTRBIT		/18 BIT COUNT
	LAC*	DTMTRX		/NEXT BIT MAP WD
	CMA!STL
	DAC	DTSBIT
	LAC	DTDIRA		/BIT MAP DIRECTION SWITCH
	SMA!CLA!RAL			/REVERSE-SEARCH BIT 18-0
	RTR			/FORWARD-SEARCH BIT 0-18
	DAC	DTTBIT		/FORWARD(0=1); REVERSE (18=1)
	JMP*	DTMPS
/
	.EJECT
/END OF CURRENT BIT MAP WORD SUBROUTINE
DTBMCT=DTOBCK
DTMPP	0
DTMPP1	LAC	DTDIRA		/INCR. (IF FORWARD) OR
	TAD	DTMTRX		/DECR. (IF REV) BY 1
	DAC	DTMTRX		/DT. BIT MAP POINTER
	LAC	DTDIRA
	TAD	DTPONT		/FILE BIT MAP POINTER
	DAC	DTPONT
DTMPP2	JMS	DTMPS		/SET FOR NEXT WD
	ISZ	DTWMCT		/BIT MAP WORD CT
	JMP*	DTMPP		/EXIT
	LAW	-1100
	DAC	DTBLOK		/DECTAPE FULL
	DZM	DTBMCT		/CLEAR BITMAP SEARCH COUNT
	CLA
	ISZ	DTDIRA		/TURN AROUND
	LAW	-2		/REV.
	TAD	DLIT1		/FORWARD
	DAC	DTDIRA		/SET FOR REV. SEARCH
	TAD	DTRELB		/REINIT
	DAC	DTRELB
/ROUTINE TO SET DTREM FOR TURN AROUND
	LAC DTDIRA
	RAL
/L=1=REV,L=0=FORW
	LAC DTNXBK		/LASTT BL # RCORDED FOR THIS FILE
	SNL!CMA			/REV
	JMP DTMPP3
	TAD (1100
	CMA
DTMPP3	DAC DTREM			/LAW TO CHECK ENOUGH SPACE BETW BL
	LAW	-41
	DAC	DTWMCT		/MATRIX COUNT
	JMP	DTMPP1		/START REV. SEARCH
/BIT MAP SEARCH COUNT(DTBMCT) MUST BE >5 TO EXIT
	.EJECT
/BLOCK AVAILABILITY BIT MAP SEARCH, AC=777777 ON ENTRY
DTMAP	0
	DAC* DTLINK		/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		/INCR. DT BLOCK COUNT
	JMP DTMAP4
	DAC DTBLOK		/DECTAPE FULL
	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 RIGHT IF FORW,
	SNL!CLL!RAL			/LEFT IF REV.
	RTR
	DAC	DTTBIT
	ISZ	DTRBIT		/INDEX-18 BIT COUNT
	JMP	DTMAP2		/NEXT BIT
	JMS	DTMPP		/END OF MATRIX WD. SUBR.
	JMP	DTMAP1		/NEXT WORD
DTREM	XX
	TAD	DTBMCT
DTREM3	SPA!CLC			/OK-DELTA BLOCKS IN BETWEEN
	JMP	DTMAP4		/CHECK BIT MAP AGAIN
	SAD* DTLINK		/IF ENTRY AC = -1, NO DTCBIT
	JMP DTREM6
	JMS	DTCBIT		/SET BIT IN MAPS
	CMA
	DAC	DTSBIT
DTREM6	LAW -DELTA		/RESET BLK DIST TO -DELTA
	DAC DTREM
	LAC	DTDIRL		/SET TRANSF DIRECTION  SWITCH
	SPA!CLA
	CMA
	DAC	DTDTR
	LAC	DTDIRA		/UPDATE DTDIRL
	DAC	DTDIRL
DTREM4	LAC	DTRELB		/T. STORE BL# TO BE  USED
DTREM5	DAC	DTCNBK		/EXIT
	LAW -1			/WAS AC = -1 ON ENTRY?
	SAD* DTLINK
	SKP			/YES, USE -1 (EOF)
	LAC DTCNBK
	JMP*	DTMAP		/EXIT -BL ! FOUND(777777=DTA FULL)
/SUBR TO XOR OCCUPE BIT INTO FILE AND DIR BIT MAPS
DTCBIT	0
	LAC	DTTBIT		/SET BIT IN FILE BIT MAP
	XOR*	DTPONT
	DAC*	DTPONT
	LAC	DTTBIT		/SET BIT IN MAP
	XOR*	DTMTRX
	DAC*	DTMTRX
	JMP*	DTCBIT		/C(*DTMTRX) MUST BE IN AC ON EXIT
/
/
/
DT2BIT	0			/FILE 2 BIT MAP
	.LOC	DT2BIT+40
/
DTDIR=.
DTBUF	0			/DTA BUFFER (FILE1)
	.LOC	DTBUF+400
DTDIR2	0			/DTA DIRECTORY (FILE2)
	.LOC	DTDIR2+40
DTBUF2	0			/DTA BUFFER (FILE2)
	.LOC	DTBUF2+400
/FILE 1 BLOCK-SECTION A
BLAB=.
DLTDIR	DTDIR			/DIRECTORY POINTER
DLTSYS	DTDIR+203			/WD 3 OF SYS BIT MAP
DLTBUF	DTBUF			/DTA BUF. POINTER-1
DTLINK	DTBUF+377			/FILE1 DATA LINK POINTER
DTNXBK	0			/BL.# TO BE TRANSFERRED
DTCNBK	0			/DATA LINK (NEXT BL.#)
DTCURE	0			/DIR. POINTER TO CURR. FILE ENTRY EXAMINED
DTEOF	0			/EOF SWITCH, -0=EOF
DTHPT	0			/DTA BUF. LINE HEADER POINTER (INDEXED)
DTIOSW	0			/I/O SWITCH, 0=INPUT, 1=OUTPUT
DTSKNT	0			/NON0=.SEEK OR .ENTER EXECUTED
DTRHPT	0			/DTA BUF. LINE HEADER POINTER (.READ)
DTDTR	0			/TRANSF. DIRECT. SWITCH,0=F,-1=R
DTCLSS	0			/FILE OPEN, CLOSE SWITCH(NON-0=OPEN,0=CLOSED)
DTBFCT	0			/BUFFER COUNT (INIT=-377)
DTFPCT	0			/FILE ENTRY COUNT
DBLKLC	0			/24,56 ENTRY SWITCH(50=24;10=56)
DTFLS1	0			/FILE 1 DAT SLOT
BLAND=.
/
/FILE 1 BLOCK-SECTION B
DTUNIT	0			/(0-2)=DTA UNIT# FOR TRANSFER
DTNCOR	077777			/DIRECT. IN CORE SWITCH (NON-0=OPEN, 0=CLOSED)
BLBND=.
/
/FILE 2 BLOCK - SECTION A
	DTDIR2			/DIRECT 2 POINTER
	DTDIR2+203
	DTBUF2			/DTA BUF 2 POINTER
	DTBUF2+377		/FILE 2 DATA LINK POINTER
	0
	0
	0
	0
	0
	0
	0
	0
	0
	0
	0
	0
	0
DTFLS2	0			/FILE 2 DAT SLOT
/FILE 2 BLOCK - SECTION B
	0
	077777
/
/FOLLOWING =CELLS USED IN COMMON BY BOTH FILES
DLFAKE	DTFAKE			/POINTER TO EMPTY FILE NAME
DTARGP	0			/ENTRANCE ARG. POINTER
DTCALP	0			/USER CAL POINTER
DTCT1	0			/GEN. PURP. COUNTER AND T. STOR.
DTCT2	0			/GEN PURP COUNT AND STORE
DTUND	0			/I/O UNDERWAY SWITCH,-=BUSY,0=NOT BUSY
DTWRWT	0			/CONTINUED I/O SWITCH (NON 0=CONT),0=DONE)
DLEOFH	DTEOFH			/EOF HEADER POINTER (FOR .CLOSE)
DTCT	0			/GEN. PURPOSE COUNTER=T.STORE
DTSAM	-1			/BOTH FILES ON SAME UNIT SWITCH (NON 0 = SAME)
DLIT1	1
DLIT2	2
DLIT3	3
DLIT4	4
DTRELB	0			/FREE BL # AFTER BIT MAP SEARCH
DTSBIT	0			/-(MATRIX WORD)
DTTBIT	0			/TEST BIT FOR BIT MAP SEARCH
DTWMCT	0			/BIT MAP WORD COUNT
DTBMPT	0			/BIT MAP 1 POINTER
DLMBIT	DT2BIT			/OUTPUT FILE BIT MAP POINTER
DLSAV	DT2SAV			/POINTER TO CELL 1 OF NEW DIR ENTRY
DTOBCK	0			/T STORE
DT2XOR	0			/T STORE
LDAB	DABSIZ			/LIT
	.END
