	.TITLE DPD.
/COPYRIGHT 1969, 1970, DIGITAL EQUIPMENT CORP., MAYNARD MASS.
/	7-3-70	EDIT9
/RP09/15 ADAPTATION-W.A. DESIMONE 9-1-70
/	RP EDIT 3   9-9-70
/M SIFNAS 4-9-68 (IOPS 23 5-8-68)(56 FILES 5-8-68)
/(EOF 5-22-68)
/DPD.=IOPS DISK/DECTAPE HANDLER-READ, WRITE, ALL MODES
/ALL FUNCTIONS
/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)
/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
/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	DPD.
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
	.IFUND	DELTA
DELTA=5
	.ENDC
DPD.	DAC	DTCALP		/CAL POINTER
	DAC	DTARGP		/ARG. POINTER
	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 DLIT77
	TAD	(JMP DTTABL
	DAC	DTTABL
	CLA			/AC MUST = 0 FOR DISPATCH.
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	DTMTAP		/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
/DTA-DISK-INTERRUPT SERVICE
/
DTPIC	DAC DTAC			/SAVE AC
	LAC* (0
	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 STORAGE OF STATUS WORD.
	CLL!RAR
	SZL
	JMP DTERT			/ERR. FLAG
RFRDWT	DPCS			/CLEAR DISK STATUS.
	LAC DKSET	/GET ST. A FOR RP UNIT #
	AND (700000)		/MASK AND ISSUE AND IDLE TO CLEAR
	DPLF	/JOB DONE AND ERR INTERR. ENABLE
DTION	ION			/ION TO ALLOW OTHER INTERRUPTS.
	DZM DTUND			/CLEAR I/O UNDERWAY
	LAC MTFUL		/NON-ZERO IF DOING A "CLOSE" TO GET
	DZM MTFUL
	SZA!CLA		/EOF IN LAST BLOCK OF DISK BECAUSE OUT OF
	JMP DTER15		/ROOM ON MAGTAPE OPERATION.
DTUMSK	LAW -400
	DAC DWORD
	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		/SET DIRIN CORE SW
	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 PROTECT ERR
	AND (400)
	SZA		/AC>0 IF ERR
	JMP DKIPS4
	DPRSB			/LOAD STATUS B
	DAC	RPSTB		/STORE
/CHECK STATUS B.
/
	AND	(64)		/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
RPRCL	LAC	(30000		/LOAD RECALIBRATE FUNCT.
	XOR	RPUNIT		/AND RETRY.
	DPLF
	DPRSB		/2 INSTRS. FOR 4 MICROSECOND DELAY
	DPRSB
	DPSA			/TEST ATTENTION FLAG
	JMP	.-1
	ISZ	DTERCT
	JMP	DRETRY		/GO RETRY
	JMP	DKER20		/DISK FAILURE
DKIPS4	LAC (DRETRY
	DAC* DLIT3
	LAC DLIT4
	JMP DTM4	/IOPS4
RP12RT	ISZ	DTERCT		/RETRY ROUTINE FOR FORMAT
	JMP	DRETRY		/OR TIMING ERROR
	JMP	RPER12
DKER20	LAC DKSET		/DISK STATUS.
	DAC* DLIT3		/(.MED
	LAW 20
	JMP DTM4		/DISK FAILURE.
DTER21	LAC DKSET
DTR21A	DAC* DLIT3
	LAW 21			/ILLEGAL DISK ADDRESS.
	JMP DTM4
DPARIT	ISZ DTERCT		/IF OVERFLOW, TAKE DATA ANYWAY
	SKP
	JMP RFRDWT		/TAKE DATA ANYWAY.
DRETRY	JMS DKSET			/REISSUE DISK READ (TRY 10 TIMES).
	LAC DTERCT		/0 IF RETRY 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
	.EJECT
/
/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	64		/API CORE ADDR.-MODIFIED
/DTONCE+1 TO DTSTOP EXCLUSIVE 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
/DTNXBK=BL.# TO BE TRANSFERRED
/DTDTR=TRANSFER DIRECTION SWITCH, 0=F,-1=R
/DTCCA= CURRENT ADDRESS (CA) 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
/DTCNBK= DATA LINK ( NEXT BLOCK NUMBER).
/DTCURE= DIRECTORU PNTR TO CURRENT FILE ENTRY EXAMINED.
/DTDMOD= DATA MODE (15-17)
/DTEOF= EOF SWITCH: -0=EOF.
/DTFPCT= FILE POSITION COUNTER.
/DTFILE= FILE ORIENTATION SWITCH: 0=FILE, -0=NON-FILE.
/DTHPT= DTA BUFFER LINE HEADER PNTR (INDEXED).
/DTHPTS= DTA BUFFER LINE HEADER PNTR (INDEXED).
/DTMTRX= CURRENT BIT MAP WORD POINTER.
/DTPONT= CURRENT FILE BIT MAP WORD POINTER.
/DTWREX= 0=NO WRITE EXECUTED, NON-0=EXECUTED.
/DTMPAS=PASS COUNT (0-4) ,MTAPE.
/DTSBIT= -(MATRIX WORD).
/WSW - SET TO -1 IF LAST COMMAND = WRITE DOING MAGTAPE OPERATIONS.
/DTCKSM= LINE CHECKSUM.
/DTWMCT=BIT MAP WORD COUNT.
/DKNUM= DISK NUMBER.
/DKUNIT= NUMBER PLATTERS ON SYSTEM.
/DTWRWT= CONTINUED I/O SWITCH (0=DONE, NON-0=CONTINUE).
/DTWC= 2'S COMP TRANSFER WORD COUNT.
/DBLKLC= 24 OR 56 FILE SWITCH (50=24,1=56).
DTAC	16			/.SETUP
DOUT	DPSJ			/DISK DONE FLAG
DTCCA	DTINT			/DKA INT. SERV. ADDR.
RPCABS	CAL	64
RPUNIT	16
RPSTB	DPSE			/SKIP ON ERROR FLAG
RPCACK	DTINT
DTCNBK	JMP DTDMOD
DTERCT	0
DTBLC	0
DTCURE	0
/
DTDMOD	LAC DJSTOP
DTDTR	DAC DTONCE
DTNXBK	LAS			/READ AC SWITCHES
DTWRWT	AND (770)		/DRIVE #(9-11) SUPER UNIT#(12-14)
DKNUM	DAC DTNXBK		/MASK BITS 9-14 AND STORE
DTEOF	AND (700)		/MASK BITS 9-11
DKUNIT	JMS DTSBIT		/AND SET UP RP UNIT#
DTFPCT	DAC RPUNIT		/TOTAL ROT LEFT 9 AND STORE
DTWC	LAC  DTNXBK
DTFILE	AND (70)		/MASK BITS 12-14
DTHPT	DAC DTNXBK		/STR SUPUNT# TIMES 10(8)
DTHPTS	RAL!CLL			/NOW TIMES 20(8)
DBLKLC	TAD DTNXBK		/NOW TIMES 30(8) - THAT IS
DTMTRX	JMS DTSBIT		/30(8)*SUPUNT#=20(8)*SUPUNT#+10(8)*SUPUNT#
DTPONT	RAL			/TOTAL OF 10 SHFTS
DTWREX	DAC RPCABS		/STORE BASE CTL. ADDR.
DTMPAS	JMP DTSTOP
DTSBIT	0
WSW	RAL!CLL
DTCKSM	RTL
DTWMCT	RTL
RPTEMP	RTL
RPCT1	RTL
	JMP* DTSBIT
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 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		/RESET DIRECTORY IN CORE SWITCH.
	LAC	DTWRCL		/INIT DUMP MODE WRITE
	DAC	DTDUMX		/TO CLEAR OUT BUF (JMS DTBUFC)
	JMP DTDBK-1
/
	.EJECT
/WAIT DTA ROUTINE
DTWAIT	SAD DTCT			/1 IF .WAITR.
	JMP DTDBK-1			/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
	JMS	DTIOU		/CHECK I/O UNDERWAY
DTDBK	DBR
	XCT .+1
	XCT .+1
	JMP*	DTARGP		/NORM. EXIT
/.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
	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 BLOCK OF FILE.
	XOR (400000		/CLEAR FILE COMPLETE BIT.
	DAC DTNXBK
	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
	LAC	DTNXBK		/PICK UP BL#, RETURN TO USER IN  AC
	DZM	DTCLSS
	JMP	DTAPE1
/.RENAM ROUTINE
DTREN	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
/.DELETE ROUTINE
DTLET	CLC
	DAC	DTNCOR
	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 ERROR.
	SZA
	JMP* DTDRCK
/
DTER61	LAW 61		/DIRECTORY OR FILE BIT MAP PARITY ERROR.
	JMP* DLIT4
/CALL IN DIRECTORY SUBR.
DTDRIN	0
	DAC	DTTR		/TRANSFER DIRECTION SWITCH
	LAC	DLT100		/(100
	DAC	DTNXBK		/BL# TO TRANSFER
	DZM	DTDTR		/TRANSFER FORWARD
	DZM	DTDRGT
	LAC	DTCLSS		/0 IF SEEK, ENTER
	SZA
	LAC	(40		/NOT 0 IF CLOSE (DTBUF
	TAD	DLTDIR		/(DTRDIR
DTDRN1	JMS	DTWCS		/SETUP WC,CA
	JMP*	DTDRIN
DTDRGT	777777			/GET DIR INDIC. (+0=GET)
/DIRECTORY SEARCH SUBR.
DTSK1	0
	DAC	DTUDRR		/USER DIR. ENTRY POINTER
	DZM	DTDTR		/SET TRANSF. DIRECTION=FORWARD
DTSK2	CLC			/SYSTEM TAPE?
	XOR* DLTSYS		/WD3 0F SYS BIT MAP
	SNA!CLA			/NO, 56 FILES
	LAW -30			/YES, 24 FILES MAX
	SMA
	LAW -70
	DAC	DTFPCT
	XOR (777700		/777700
	DAC DBLKLC		/50 IF 24;10 IF 56
	LAC	DLTBUF		/DIR. POINTER=DTDIR+40=DTBUF
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 (D.E.)
DTSK5A	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	DTCT1S		/MATCH
	SKP			/N
	JMP*	DTSK1		/YES- POINTER TO 1ST BL# IN AC.
	TAD	DLIT4		/INDEX TO NEXT ENTRY
	ISZ	DTFPCT		/INDEX FILE ENTRY CT.
	JMP	DTSK3		/NEXT ENTRY
	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	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 DTFILE		/IF .MTAPE CLOSE, CLEAR BUFFER
	SZA
	JMS DTBUFC
	LAC	(15000		/OUTPUT
	JMS	DTMCK
	LAC	DLEOFH		/EOF HEADER POINTER (DTEOFH
DTROOM	377			/DUMP MODE BUF SIZE(INIT=377)
/PRECEDING LINE=FAKE ARG,USED AS VARIABLE
	JMP	DTWRT1
/
	.EJECT
DTCLS3	LAC DTFILE		/NON-FILE ORIENTED?
	SZA			/NO, CHECK IF FILE BIT MAP IS IN
	JMP DTSTOP
	LAC DTBMIN
	SZA!CLC
	JMP	DTCLS4
	DAC	DTBMIN		/SET BIT MAP IN SWITCH
	LAW -50			/START WITH BLK 77 IF 56 FILES,73 IF 24
	TAD DBLKLC		/50 IF 24;10 IF 56
	SNA!CLA			/56
	LAW -4			/24
	TAD DLIT77
DTCLT	DAC	DTNXBK		/BIT MAP BLOCK #
	LAC	DTFPCT		/FILE COUNT
	TAD	(10
	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
	JMP	DTCLS6
	SAD DTERCT
	JMP DTER61		/PARITY 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			/REL. BIT MAP ADDRESS
DTXROL=DTMPS			/OLD BIT MAP POINTER
	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	-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		/AC=0 ON ENTRY.
	JMP	DTSTOP		/FILE CLOSED, RESET SOFTWARE FLAGS.
	JMS	DTDRCK		/LOAD DIRECTORY INTO DTBUF
	LAC	DTLB40		/(DTBUF+40
	DAC	DTCLCT		/INIT. DIR ENTRY SECT. POINTER
	LAW	-340		/DIR. ENTRY SECTION COUNT
	DAC	DTCT
	LAC	DLTBUF		/(DTDIR+40=DTBUF)
	DAC	DTCT1
DTCLS5	LAC*	DTCLCT		/TRANSF. DIR ENTRY SECTION (+200)
	DAC*	DTCT1		/UP TO BIT MAP
	ISZ	DTCLCT
	ISZ	DTCT1
	ISZ	DTCT
	JMP	DTCLS5
	LAC	DLSAV		/(DTESAV
DTFIN=DTBFC2			/DTESAV POINTER
	DAC	DTFIN
	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
	DZM	DTCLSS		/CLEAR CLOSE IND.
	LAC	(15000		/REWRITE DIRECTORY
	JMS	DTDRIN
	JMP	DTCLOS
/
	.EJECT
/.TRAN ROUTINE
/
DTAPE	JMS	DTIOU		/I/O UNDERWAY
	LAC*	DTARGP		/BL#
	JMS	DTSET		/SETUP BL#, ETC
	ISZ	DTARGP
	LAC*	DTARGP		/CORE ADDR.
	ISZ	DTARGP
	DAC	DTNCOR			/CLEAR
	LAC*	DTARGP		/WC
	DAC	DWORD
	LAC	DTNCOR		/CA
	JMS	DTWCS		/SETUP CA AND START TRAN.
DTAPE1	ISZ	DTARGP
	JMP	DTDBK		/INDEX TO NORM EXIT
/
/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)
	DZM	DTDTR		/TRANSFER DIRECTION SWITCH (ALWAYS FORWARD).
	JMP*	DTSET
/
/.MTAPE ROUTINE
/
DTMTAP	JMS	DTIOU		/I/O UNDERWAY?
	LAC	DTCT		/MTAPE FUNCTION
	SNA
	JMP	DTMREW		/REWIND (MOVE TAPE-BOT)
	SAD	DLIT2		/(2
	SKP			/BACK SPACE
	JMP	DTDBK		/IGNORE OTHER MTAPE FUNCTIONS
/
/MTAPE BACKSPACE
	LAC WSW			/IF LAST COMMAND WAS .WRITE(WSW=-),
	DZM WSW
	CLL!RAL			/DO NOT CHANGE DTNXBK
	LAC	DTNXBK		/DECREASE BL# BY 1
	DAC	DTCNBK
	SZL
	JMP DTMRW1		/DO NOT CHANGE DTNXBK
	TAD DTMRW1		/SUBTRACT 1. (DTMRW1=-1)
	DAC DTNXBK
	SPA
	DZM DTNXBK		/DON'T ALLOW LESS THAN 0.
	JMP DTMRW1
/
/MTAPE REWIND
/
DTMREW	DZM	DTNXBK		/SET BL# TO READ/WRITE=0
	DZM	DTCNBK
	DZM WSW			/CLEAR LAST WRITE SWITCH
	LAW -1
	DAC	DTFILE		/NON FILE ORIENTED DTA.
DTMRW1	LAW -1			/COMPUTE DTARGP FOR PROPER EXIT
	TAD DTARGP
	DAC DTARGP
	JMP DTSEKR
/
/SUBR. TO SET UP CA, WC AND TRANSFER
/
DTWCS	0
	DAC	DTCCA		/ADDR.-1(BIT 0-2 DO NOT MATTER)
	LAW	-5
	DAC	DTERCT		/PARITY ERROR RETRY COUNT
	DAC	DTUND		/SET I/O UNDERWAY
	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
	LAC DWORD	/LOAD WC
	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
	AND	(400)
	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		/IOPS4 ON UNIT OFF LINE
	DAC*	DLIT3
	LAC	DLIT4
	JMP	DTM4
DKSET1	LAC	DTERCT
	DAC	DTUND		/RESET I/O UNDERWAY SWITCH
	JMP	DKSET2
/.READ, .WRITE COMMON SETUP SUBR.
/
DTMCK	0
	DAC	DTTR		/READ (13000) OR WRITE (15000)
	DAC DTNCOR
	LAC DTFILE		/IF FILE ORIENTED, .SEEK OR .ENTER
	TAD DTSKNT		/MUST HAVE BEEN EXECUTED BEFORE READ
	SNA!CLC
	JMP DTER12		/.SEEK OR .ENTER NOT EXECUTED IOPS 11
	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
	ISZ	DTMCK		/INDEX TO DUMP EXIT
	SAD	DLIT4
	JMP	DTMCK2		/DUMP EXIT
	LAC*	DTUHP		/COMPUTE W.C. FROM L.B.H. W.P.C
	JMS	DTGWPC
	ISZ	DTMCK		/INDEX TO IOPS OR IMAGE EXIT
	JMP*	DTMCK		/IOPS OR IMAGE EXIT
DTMCK2	LAC	DTUWC		/SAVE USERWC
	DAC	DTWCSV
	DZM	DTWPC
	XCT*	DTMCK		/JMP DTRDUM OR JMP DTWDUM
/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			/ILLEG. WPC (0 OR GREATER THAN 177)
	JMP DTER23
	AND (400
	SNA!CLA
	JMP*	DTGWPC		/L.B.W.C. INAC
DTER23	TAD	(5		/IOPS 23
	JMP	DTER16
/SUBR. TO CHECK ACTIVE FILE
/
DTCKCL	0
	LAC	DTCLSS		/PREVIOUS FILE CLOSED
	SZA!CLA
	JMP	DTER10		/NO-FILE STILL ACTIVE
	DZM	DTFILE		/FILE ORIENTATION SWITCH
	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
/
/.SEEK ROUTINE
/
DTSEEK	LAC	DTIOSW
	SZA!CLC
	JMP	DTER10		/ILL. DATA MODE (.SEEK ON OUTPUT FILE) (DTER7)
	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 BLOCK OF FILE.
	XOR (400000		/CLEAR FILE COMPLETE BIT.
	DAC DTNXBK
	DAC DTSKNT		/SET .SEEK,.ENTER EXECUTED SWITCH.
DTSEKR	LAC	(13000
	DAC	DTTR		/INPUT
	DAC	DTNCOR		/CLEAR DIRECTORY IN CORE SWITCH
	DZM DTDMOD		/CLEAR DATA MODE TO BYPASS DUMP CHECK
	JMP	DTRNX1		/TRANSFER 1ST BLOCK
	.EJECT
/L.B. TO DTA BUF (.WRITE) OR DTABUF TO L.B. (.READ)
/
DTRWT	0
DTWT2	LAC*	DTUDP		/USER L.B.
	DAC*	DTHPT		/TO DTA BUFOR VICE VERSA
	JMS	DTUPTR		/ADD TO CKSUM, INDEX CTS, ETC
	ISZ	DTDATC		/DATA WORD COUNT
	ISZ	DTHPT
	ISZ	DTUWC		/DONE
	JMP	DTWT2
	JMP*	DTRWT
/.WRITE ROUTINE
/
DTWRIT	JMS	DTIOU		/I/O UNDERWAY
	LAC DTFILE		/NON-FILE ORIENTED?
	SZA
	JMS DTBUFC		/YES, ALWAYS SET UP OUTPUT BUFF
	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
	JMP	DTWDUM		/DUMP
/RETURN HERE FOR IOPS OR IMAGE MODES
/
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 DLIT7
	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
	LAW	-377
	JMS	DTOBCK		/OUTPUT BUF. SIZE CHECK
	CLC			/EXCLUDE L.B.H.; WD0
DTWTM1	TAD	DTWPC		/FROM COUNT
DTWT	CMA
DTWT1	DAC	DTUWC		/ACTUAL WC (2'S COMP)
	LAC	DTHPT		/SETUP CKSM POINTER
	DAC	DTUCKP		/FOR .WRITE
	ISZ	DTUCKP
	JMS	DTRWT
	LAC	DTDMOD
	SAD	DLIT4
	JMP	DTDUMK		/DUMP MODE - CHECK FULL BUFF
DTWT4	CLC
	TAD	DTCKSM
	CMA
	DAC*	DTUCKP		/STORE 2'S COMP CKSUM IN DTABUF
DTWT5	LAC DTEOF	/EOF?
	SZA
	JMP DTCOUY		/YES, ALWAYS OUTPUT BLOCK
	LAC DTFILE		/NON-FILE ORIENTED?
	SZA
	JMP DTCOUZ		/YES,ALWAYS OUTPUT BLOCK
DTMTP4	JMP	DTAPE1		/IOPS WRITE COMPLETE
DTWRCL	JMS	DTBUFC		/CLEAR DTA BUF
	ISZ	DTARGP		/INDEX TO WC
	JMP	DTWRT1		/PUT LINE IN DTA BUF
/
/OUTPUT BUFFER SIZE CHECK
/
DTOBCK	0
	TAD	DTWPC		/L.B. W.C.
	SPA!CLA			/OUTPUT BUF OVERFLOW
	JMP*	DTOBCK
DTER16	TAD	DLIT1		/OUTPUT BUFFER OVERFLOW
DTER15	TAD DLIT1			/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	DLIT6		/ILL. HANDLER FUNCTION
DTM4	DZM DTUND
	JMP* DLIT4
/CLEAR I/O BUF. SUBR., POINTERS
/
DTBUFC	0
	LAC	(377		/INIT DUMP MODE
	DAC	DTROOM		/BUF SIZE
	LAC DTIOSW
	RAR			/INPUT: L=0; OUTPUT: L=1
	LAC	DLTBUF		/BUF. (WD0) POINTER (DTBUF
	SZL!STL			/DO NOT MODIFY DTHPT ON INPUT
	/ALSO SET LINK TO CLEAR 400 CELLS
	DAC	DTHPT		/DTA BUF HEADER POINTER
	DAC	DTRHPT		/FOR READ
	JMS	DTBFC2		/CLEAR BUF
	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 DTFILE		/IF .MTAPE WRITE, FETCH NEXT BLOCK
	DAC WSW		/SET LAST WRITE SWITCH IF MAGTAPE WRITE.
	SNA			/EVEN FOR EOF
	LAC DTWRWT		/IF DTWRWT NON 0,ALWAYS GET NEXT BLK #
	SNA!CLA
	LAC DTEOF
	JMS DTMAP			/FIND NEXT FREE BLOCK
	DAC DTBUF+377		/DATA LINK
DTCOUB	LAC	DLTBUF		/(DTBUF
	JMS	DTWCS		/SETUP WC,CA AND BEGIN TRAN.
DTOUT	XX			/JMP DTAPE1 OR DTBUSY
	.EJECT
/
/DUMP MODE OUPUT
/
DTWDUM	JMS	DTDUMB
DTDUMX	XX			/JMS DTBUFC OR NOP
	JMP	DTWT1
/
DTDUMB	0
	XCT*	DTDUMB		/JMS DTBUFC (WRITE) OR NOP (READ)
	ISZ	DTDUMB
	LAC DTWRCL		/SET SWITCH TO CLEAR
	DAC DTDUMX		/OUTPUT BUFF (JMS DTBUFC)
	LAC	DTROOM
	TAD	DTWCSV
	SMA			/MORE THAN 377 TO TRANSFER
	JMP	DTDUMZ		/LAST ELEMENT OF TRANSFER
	DAC	DTWCSV		/SAVE REMAINDER
	LAW	-2
	TAD	DTDUMB		/RET. ADDR. FOR TRANS. COMP
	DAC	DTWRWT		/=I/O WAIT SWITCH
	LAC	DTBUSB		/JMP DTBUSY
	DAC	DTOUT
	CLC
	TAD	DTROOM		/FILL IN BUFF
	CMA
DTDUMY	XCT*	DTDUMB		/JMP DTWT1(WRITE) OR JMP DTNSH1
DTDUMZ	DZM	DTWRWT		/CLEAR I/O WAIT SWITCH
	DAC	DTROOM		/SPACE LEFT FOR NEXT DUMP
	SNA
	JMP .+3			/FULL BUFF, DO NOT NOP CLEAR BUFF
	LAC DTLNOP		/SET SWITCH NOT TO CLEAR OUTPUT BUFF
	DAC DTDUMX
	LAC	DTMTP4
	DAC	DTOUT
	LAC	DTWCSV		/REMAINDER
	JMP	DTDUMY
DTDUMK	LAC DTROOM		/IF DTROOM=0, BUFF FULL
	SZA!CMA
	LAC DTWRWT		/IF DTWRWT=0,  BUFF NOT FULL
	SZA			/NO
	JMP	DTCOUZ		/YES - OUTPUT
	JMP	DTWT5		/CHECK EOF
/
	.EJECT
/.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
DTRD1	LAC	(13000
	JMS	DTMCK		/READ/WRITE COMMON SETUP
	LAC	DTRHPT		/DTA BUF HEADER POINTER
	JMP	DTRDUM		/DUMP
/RETURN HERE FOR IOPS OR IMAGE MODES
	CLC
	TAD	DTWPC		/IOPS ASCII OR BIN
	TAD	DTUWC
	DZM	DTDVS		/CLEAR SHORT LINE FLAG
	SMA!CLC			/WPC INTO WC, NO SHORT LINE
	DAC	DTDVS		/SET SHORT LINE FLAG
	TAD	DTWPC
	CMA			/2'S COMP HEADER W.C.
	DAC	DTWPC
DTRD2	DZM	DTDATC		/DATA COUNT
	DZM	DTCKSM		/CLEAR CHECKSUM
	JMS	DTRWT		/TRANSFER LINE TO USER L.B.
	LAC	DTDMOD
	SAD	DLIT4
	JMP	DTRDM1		/DUMP
	LAC*	DTUDP		
	JMS	DTUPTR		/BYPASS EXCESS DATA
	JMP	.-2		/MORE
DTRDM1	LAC	DTROOM		/DUMP MODE BUF SIZE
	SZA!CMA			/IF DTROOM=0 OR DTWRWT = NON 0,
	LAC DTWRWT
	SZA!CLC
	JMP	DTRNEX		/GET NEXT DUMP BLOCK
	JMP	DTAPE1		/NORM EXIT
/
/SUBR. TO ADD TO CHKSUM AND INDEX COUNTS
/
DTUPTR	0
	TAD	DTCKSM		/ADD DATA WD TO CKSM.
	DAC	DTCKSM
	ISZ	DTUDP		/INDEX AREA POINTERS
	ISZ	DTRHPT
	ISZ	DTBFCT		/INCR DTA BUF COUNT
	ISZ	DTWPC		/GO TO DRDE ON OVERFLOW-DONE
	JMP*	DTUPTR
	.EJECT
/END INPUT LINE ROUTINE
/
DTRDE	LAC*	DTHPTS		/HEADER WD 0-IOPS
	AND DLIT7
	XOR DTFILE		/IF .MTAPE,DO NOT GO TO DTREOF
	SAD	(5		/EOF?
	JMP	DTREOF		/YES
	ISZ	DTDVS		/SHORT LINE FLAG SET
	JMP	DTRDE1		/NO
	LAC	(60
	JMS	DTDVS		/SET D.V. FOR  SHORT LINE
DTRDE1	LAC	DTERCT		/PARITY RETRY COUNT	
	SMA!CLA
	JMP	DTRDP		/SET D.V. BITS=PARITY
	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		/12,13=10
DTRDN	LAC*	DTUDP		/NEXT WORD IN DTA BUF
DTRDN1	SNA!CLC			/IF NOT 0, OK
	JMP	DTRNEX		/NO MORE DATA-GET NEXT BL.
	LAC DTFILE		/IF .MTAPE, GET NEXT BLOCK
	SZA!CLC
	JMP DTRNEX		/.MTAPE
	ISZ	DTBFCT		/DATA BUF. CT = GET NEXT BL.
	JMP	DTRNOR		/NORM EXIT, AC=777777
DTRNEX	SAD	DTBUF+377		/DATA LINK=-0?
	JMP	DTREOF		/LAST BLOCK -SET EOF SWITCH
	LAC DTFILE		/IF MAGTAPE, GET NEXT BLOCK NUMBER.
	SZA
	JMP DTRNX2
	LAC	DTNXBK
	CMA
	TAD	DTBUF+377
	SPA!CLA			/READ FORW
	CLC			/READ REV.
	SAD DTDTR
	JMP DTRNX2-1
	DAC DTDTR			/TRANSFER DIRECTION SWITCH.
	JMS DDIRAL		/FLIP DTDIRA
	CLC
	TAD DTDECR		/-5 TO +5 OR VICE VERSA
	CMA
	DAC DTDECR
	LAC DTDTR
	DAC DTDTR
DTRNX2	LAC	DTBUF+377
	DAC	DTNXBK		/DATA LINK INTO NEXT BLOCK
	DAC DTCNBK		/SET UP FOR .WRITE AFTER BACKSPACE
DTRNX1	JMS	DTBUFC		/INIT. BUFFER
	LAC DTDMOD		/DUMP?
	XOR DLIT4
	SZA
	JMP DTCOUB		/NO
	LAC DTRHPT		/RESET BUFF POINTER
	DAC DTUDP
	JMP DTCOUB
/
/
/SUBR. TO SET DATA VALIDITY BITS
/
DTDVS	0
	DAC	DTDVSM		/SAVE MASK
	LAW	17717		/MASK ALL BUT BITS 0,12,13
	AND*	DTUHP
	XOR	DTDVSM
	DAC*	DTHPTS		/HEADER, WD0
	JMP*	DTDVS
DTEFX	ISZ	DTARGP
DTREOF	DAC	DTEOF		/SET EOF SWITCH
	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
/
/DUMP MODE INPUT
/
DTRDUM	JMS	DTDUMB		/SET UP FOR DUMP INPUT
DTLNOP	NOP
	JMP	DTNSH1
/
/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	DTER10		/ILL. DATA MODE (.ENTER ON INN PUT FILE) (DTER7)
	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
	DAC	DTUDRP
	JMS	DTNTRZ		/SAVE USER D.E. IN DTESAV
	LAW -40			/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
DL1100	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 #
	SNA			/CANNOT ALLOW FIRST BLOCK NUMBER 
	JMP DTER15		/TO BE ZERO.  DISK UNIT FULL.
	XOR	(400000
	XCT	DTNTR3		/STORE BL#+COMPLETION BIT IN DTESAV+3
	SMA!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
/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
/
/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 -41
	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
	LAC DTFILE		/.MTAPE WRITE?
	SZA!CLC
	JMP DTNFB			/YES, AC=777777 ON ENTRY
	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 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			/DELTA BLOCKS IN BETWEEN
	TAD	DTBMCT
DTREM3	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
DTREMM	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 DTCLR2
	SKP			/YES, USE - 1 (EOF)
	LAC DTCNBK
	JMP*	DTMAP		/EXIT -BL ! FOUND(777777=DTA FULL)
	.EJECT
/.MTAPE FREE BLOCK DETERMINATION
/
DTNFB	LAC DTCNBK
	TAD DLIT1		/INCREASE BY 1 FOR SEQUENTIAL OPERATION.
	SAD (777
	SKP
	JMP DTREM5		/BLOCK # WITHIN LIMITS - GO AHEAD.
	DAC MTFUL		/GO DO CLOSE TO GET EOF IN BLOCK 777 AND 
	DAC DTCNBK
	JMP DTCLOS		/OUTPUT ERROR 15.
/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 DLTBUF
	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 71-77
	LAW -10
	DAC DTREM			/COUNT FOR FILE BIT MAP BLOCKS
	LAW	-11
	DAC	DTCLCT		/COUNT OF BLOCKS TO CLEAR+1
DTCLR1	ISZ DTREM			/FILE BIT MAP BLOCKS CLEARED?
	JMP DTCLR4
	LAC (77600		/YES, INIT DIRECTORY TO 8 SYS BLKS
	DAC DTBUF+3
	DAC DTBUF+203		/BASIC DIRECTORY BIT MAP
DTCLR4	ISZ	DTCLCT		/DONE
	JMP	DTCLR2
	DZM	DTWRWT		/YES-CLEAR I/O WAIT SWITCH
	JMP	DTDBK
/
/DTCLER BLOCK TABLE
/
DTBLBT	71			/BLOCKS 71-73 CONTAIN
	72			/24 BIT MAPS ORDERED ACCORDING
DLIT73	73			/TO THE FILE NAMES IN THE DIR. ENTRY SECTION
	74
	75
	76
DLIT77	77
DLT100	100			/BLOCK 100 = DIRECTORY
/
/DTMBIT=FILE BIT MAP, MUST INITIALLY = 0
/
DTMBIT	0
	.LOC	DTMBIT+40
DTDIR	0			/DTA DIRECTORY
	.LOC	DTDIR+40
DTBUF	0			/DTA BUFFER
	.LOC	DTBUF+400
DJSTOP	JMP	DTSTOP
DLTDIR	DTDIR			/DIRECTORY POINTER
DLTSYS	DTDIR+203			/WD 3 OF SYS BIT MAP
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
DTBLOK	0			/BLOCK COUNT.
DTARGP	0			/ENTRANCE ARG. POINTER
DTCALP	0			/USER CAL POINTER
DTDIRA	0			/BIT MAP DIRECTION SWITCH (CURR. BL.)+1=F,-1=R
DTDIRL	0			/BIT MAP DIRECTION SWITCH (LAST.BL.),+1=F,-1=R
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
DTDECR	0			/BACKSPACE DECR, -5=FORW,+5=REV
DTRHPT	0			/DTA BUF. LINE HEADER POINTER (.READ)
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
DTCLSS	0			/FILE OPEN, CLOSE SWITCH(NON-0=OPEN,0=CLOSED)
DWORD	LAW -400			/WORD COUNT, MODIFIED BY TRAN
DTCT	0			/GENERAL PURPOSE COUNTER = T STORAGE.
DTBFCT	0			/BUFFER COUNT (INIT TO -377).
DTIOSW	0			/I/O SWITCH: 0=INPUT,1=OUTPUT.
DLIT1	1
DLIT2	2
DLIT3	3
DLIT4	4
DLIT6	6
DLIT7	7
MTFUL	0			/NON-0=DOING CLOSE FOR MAGTAPE FULL.
/
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)
DTUWC=DTCCA			/USER 2'S COMP WC FOR ARG. LIST
DTDVSM=DTCALP			/DATA VALIDITY BIT MASK
DTBMCT=DTOBCK			/BIT MAP SEARCH COUNT (MUST BE 5 OR MORE TO EXIT)
DTCLCT=DTMPP			/CLEAR COUNT (INIT=-200)
DTWCSV=DTGWPC
DTWPC=DTSET			/WORD PR. COUNT FROM HEADER
DTDLUN=DTEOF			/RENAME OR DELETE UNDERWAY
	.END
