	.SYSID <	.TITLE DTA >,< 129>
/
/COPYRIGHT (C) 1975
/DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
/ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
/THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
/SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
/VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
/EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
/THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
/SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
/
/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
/WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
/MITMENT BY DIGITAL EQUIPMENT CORPORATION.
/
/DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
/OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
	.EJECT
/
/
/ EDIT# 023		DATE OF LAST EDIT 10.13.72
/	024	SK	19-DEC-74	SPR:15-E866 BUG FIX. SEND DT
/					STATUS ON A .WAIT
/	025	EAG	29-JAN-75	FIX BUG IN EDIT #024--DECTAPE
/					STATUS REGISTER B WAS ONLY BEING
/					STORED ON ERRORS.  THUS THE
/					VALUE RETURNED BY .WAIT WAS THAT
/					ASSOCIATED WITH THE LAST ERROR,
/					RATHER THAN THE VALUE ASSOCIATED
/					WITH THE LAST TRANSFER.  ALSO
/					MODIFY BLOCK SEARCH ROUTINE SO
/					THAT SEARCHES FOR ILLEGAL BLOCKS
/					(NON-EXISTENT BLOCKS) WILL CAUSE
/					IOPS21 ERRORS.
/	026	EAG	6-FEB-75	FIX MINOR GLITCH IN EDIT #025
/					HAVING TO DO WITH ONE'S VS. TWO'S
/					COMPLEMENT ARITHMETIC
/ 126	09-JUN-75	MAKE XVM CHANGES.
/ 127	 8-JUL-75 JMW	PUT IN EXTENDED ERROR PROCESSING.
/ 128	07-NOV-75 (RCHM)	FIX UP IOPS67 ERROR PROCESSING.
/ 129	12-NOV-75 (RCHM)	MAKE ANOTHER STAB AT IOPS 67.
/
/DTA.=IOPS DECTAPE HANDLER ALL MODES, 3 FILES
/ALL FUNCTIONS
/3 FILES ACTIVE AT ANY GIVEN TIME
/
	.GLOBL	DTA.
/
.SCOM=100	/PTR TO SYSTEM COMMUNICATION AREA.
NUMBUF=.SCOM+26	/NUMBER OF BUFFERS IN POOL.
BSIZE=.SCOM+27	/#OF WORDS PER BUFFER.
BFPOOL=.SCOM+30	/TABLE OF BUFFER POINTERS.
EXERRS=.SCOM+37 /EXPANDED ERROR MESSAGE ROUTINE POINTER
/
.MED=3
IDX=ISZ			/INDEXER
	.IFUND DT1511
DTCA=707541	/CLEAR STATUS REGISTER A
DTXA=707544	//XOR AC INTO STATUS REGISTER A
DTLA=707545	/LOAD STATUS REGISTER A
DTRA=707552	/READ STATUS REGISTER A INTO AC(0-11)
DTEF=707561	/SKIP ON ERROR FLAG
DTRB=707572	/READ STATUS REGISTER B
DTDF=707601	/SKIP ON DT FLAG
	.ENDC
	.IFDEF DT1511
SIOA=706001	/SKIP ON I/O DATA ACCEPTED
CIOD=706002	/CLEAR I/O DATA FLAG
LIOR=706006	/LOAD I/O DATA REGISTER & CLEAR DONE FLAG
DTEF=700000	/DUMMY IOT FOR .SETUP
DTDF=700000	/	-"-
	.ENDC
DASIZE=BLAND-BLAB	/FILE BLOCK A SIZE
DABSIZ=BLBND-BLAB	/FILE BLOCK A+B SIZE
DBSIZE=DABSIZ-DASIZE
DABSZ2=DABSIZ*2
DELTA=5
/
/
/
DTA.	DAC CALP	/CAL POINTER
	DAC ARGP	/ARG. POINTER
	ISZ ARGP	/INDEX TO FUNCTION (AND UNIT#)
	LAC* ARGP
	AND DTUMSK
	DAC TEMP1	/T SAVE UNIT#
/
/ EXTRACT DATA MODE OR SUBFUNCTION
/
	LAW 7000
	AND* CALP
	RAR!CLL
	RTR
	RTR
	RTR
	RTR
	DAC TEMP2	/T STORE DATA MODE OR SUBFUNCTION
	LAC* ARGP	/CHECK IF FUNCTION IS .WAIT?
	AND (77
	SAD (12
	JMP DISPCH	/YES, GO TO DISPCH, DO NOT GET BUFFER
	.TITLE
/
/FILE STORAGE BLOCK SWAP ROUTINE
/
/THIS HANDLER HAS ONLY THREE FILE CAPACITY. 'FSL1','FSL2'
/ AND 'FSL3' ARE THE THREE DAT SLOTS BEING PROCESSED BY
/THIS HANDLER. WHEN A NEW CAL COMES IN THESE THREE WORDS
/ARE POLED FOR A MATCH. IF NO MATCH THEY ARE POLED AGAIN
/FOR AVAILABILITY. IF NONE OF THEM ARE AVAILABLE 
/EXECUTION IS TERMINATED WITH IOPS17.
/
	LAC* CALP	/GET DAT SLOT (9-17)
	AND (777
	DAC SLOT	/T. SAVE
	DZM SWAPSW	/CLEAR SWAP SW
	SAD FLS2	/FILE 2 SLOT #
	JMP SW2		/CURRENT CALL FOR FILE 2-SET UP SWAP
	SAD FLS3	/FILE 3 SLOT #
	JMP SW3		/CURR. CALL FOR FILE 3- SETUP SWAP
	SAD FLS1	/FILE 1 SLOT #
	JMP SLOK	/ARGUMENT CALL FOR FILE 1.
	LAC FLS1	/FILE 1 SLOT #
	SNA
	JMP SLOK	/EMPTY
	LAC FLS2
	SNA
	JMP SW2		/EMPTY - SWAP.
	LAC FLS3
	SZA		/EMPTY - SWAP
	JMP IOPS17	/TOO MANY FILES OPENED!
	.TITLE CURRENT SET SWAPPER.
/
/
SW3	LAC FLS1	/SLOT 1 INTO SLOT 3
	DAC FLS3
	LAC LDBSZ2
	JMP SW4
/
/ ROUTINE TO SET UP FOR FILE 2 SWAP
/
SW2	LAC FLS1	/FILE 1 SLOT INTO FILE 2 SLOT
	DAC FLS2
	LAC LDBSZ	/(DABSIZ
SW4	DAC DADSIZ	/FILE BLOCK RELAT. POSITION
/
/ SWAP STORAGE BLOCKS
/
	LAW -DABSIZ	/SAVE FULL BLOCK (A & B)
	DAC SWAPSW	/SET SWAP SW
	DAC TEMP0	/COUNT TO MOVE
	LAC (DLTDIR	/1ST ADDR. OF FILE BLOCK 1
	DAC FB1P	/FILE BLOCK 1 POINTER
	TAD DADSIZ
	DAC FB2P	/FILE BLOCK 2 POINTER
SWP2	LAC* FB1P	/SAVE BLOCK 1 CELL
	DAC BLSV
	LAC* FB2P	/BLOCK 2 CELL INTO BLOCK 1
	DAC* FB1P
	LAC BLSV	/BLOCK 1 CELL INTO BLOCK 2
	DAC* FB2P
	ISZ FB1P
	ISZ FB2P
	ISZ TEMP0
	JMP SWP2	/CONT.
	.EJECT
SLOK	LAC TEMP1	/ARGUMENT DECTAPE UNIT.
	DAC UNIT	/INTO FILE BLOCK 1
	LAC SLOT	/STORE CURRENT DAT SLOT #
	DAC FLS1	/IN FILE BLOCK 1
	LAC* ARGP	/IS THIS CALL AN INIT?
	AND (77
	XOR DLIT1
	SZA!CLC		/YES, USE NEW I/O BIT
	JMP SWMD
	DAC SWAPSW	/SET SWAP SW
	LAC TEMP2
	SKP
SWMD	LAC IOSW
	DAC IOSW	/T STORE
	SNA		/OUTPUT?
	JMP GETBUF	/NO
	SAD IOSW.2	/IS FILE 2 OUTPUT?
	JMP D2SAME	/YES, SWAP MORE MAYBE
SWME	SAD IOSW.3	/IS FILE 3 OUTPUT?
	JMP D3SAME	/YES, SWAP MORE MAYBE
	JMP GETBUF
D2SAME	LAC SWAPSW	/SWAP SW SET?
	SZA
	LAC SKNT.2	/ENTER EXECUTED?
	SNA		/YES
	JMP D2SAM1
	LAC UNIT	/OUTOUT ON SAME UNIT?
	XOR UNIT.2
	SNA
	JMP IOPS22	/IOPS 22: 2 0UTPUT FILES ON SAME UNIT
/
/
D2SAM1	LAC IOSW	/CHECK FILE 3
	JMP SWME
D3SAME	LAC SWAPSW	/SWAP SW SET?
	SZA
	LAC SKNT.3	/ENTER EXECUTED?
	SNA		/YES
	JMP GETBUF
	LAC UNIT	/SAME UNIT
	XOR UNIT.3
	SNA
	JMP IOPS22	/2 OUTPUT FILES ON DEVICE.
	.TITLE GET A BUFFER FROM THE POOL.
/
/ THE 'CURRENT SET' IS SET UP AT 'DLTDIR' AS FILE BLOCK 1.
/ IF THE DIRECTORY POINTER IS 0 THERE IS NO BUFFER FOR
/ THIS FILE. IF SO ASK THE MONITOR FOR ONE AND COMPUTE
/ THE BIT MAP AND OTHER FILE POINTERS.
/
GETBUF	LAC DLTDIR	/DOES THIS FILE HAVE A BUFFER?
	SZA		/NO IF 0.
	JMP DISPCH	/YES..POINTERS ALL SET .DISPATCH.
	.GTBUF		/ASK FOR A BUFFER.
	SNA!SPA		/IS ONE AVAILABLE?
	JMP IOPS55	/NO..TERMINATE WITH FATAL IOPS55.
GETPNT	DAC DLTDIR	/YES..SETUP THE OTHER POINTERS.
	TAD MINUS1	/DIRECTORY POINTER-1.(DTDIR-1)
	DAC DLTDR1
	TAD (204	/(DTDIR+203)
	DAC DLTSYS	/SYSTEM TAPE DETERMINATION.
	LAC DLTDIR
	TAD (37		/DATA BLOCK POINTER -1.
	DAC DLTBF1
	TAD DLIT1
	DAC DLTBUF	/DATA BLOCK POINTER.
	TAD DLIT3
	DAC DLB003	/WORD3 OF DATA BLOCK.
	TAD (200
	DAC DLB203	/WORD 203 OF DATA BLOCK.
	TAD (174
	DAC DTLINK	/WORD 377=DATA LINK.
/
/ THE POINTERS ARE ALL SET. SEE THE DESCRIPTION 
/ AND COMMENTS AT 'DTBLBT' THROUGH 'FLS3' FOR SOME
/ SORT OF PICTURE OF THE DATA BLOCK BREAKUP.
/
	.TITLE FUNCTION DISPATCHER AND UNDERWAY CHECK.
/
DISPCH	LAC* ARGP	/FUNCTION (3-17)=1-13
	ISZ ARGP	/INDEX TO ARG.3
	AND (77
	TAD (JMP TABLE
	DAC TABLE
	CLA!CLL		/AC MUST=0 FOR DISPATCH
TABLE	XX
	JMP INIT	/1=.INIT
	JMP OPER	/2=.OPER
	JMP SEEK	/3=.SEEK
	JMP ENTER	/4=.ENTER
	JMP CLEAR	/5=.CLEAR
	JMP CLOSE	/6=.CLOSE
	JMP IOPS6	/7=.MTAPE(ILL)
	JMP READ	/10=.READ
	JMP WRITE	/11=.WRITE
	JMP WAIT	/12=.WAIT,.WAITR
	JMP TRAN	/13=.TRAN
/
/
/
BUSY	LAC CALP	/BUSY-DTA I/O GOING ON
	DAC ARGP	/RETURN TO USER CAL
	JMP DTDBK
/
/I/O UNDERWAY CHECK SUBR.
/
IOU	0
	LAC UND		/I/O UNDERWAY
	SZA		/NO
BUSB	JMP BUSY	/WAIT
	LAC WRWT	/CONTINUE MORE I/O
	SZA!CMA
	JMP* WRWT	/YES
	JMP* IOU	/OK-EXIT
/
	.TITLE DTA INTERRUPT SERVICE
/
/
DTINT	JMP	DTPIC		/PIC ENTRY
	DAC	DTAC		/API ENTRY SAVE AC
	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 PIC AT EXIT
	DAC	DTDVSW
	LAC*	DLIT0		/PIC PC, L,EM,MP DTMBAK=0
DTCOM	DAC	DOUT		/SAVE FOR EXIT
	LAC UND		/I/O UNDERWAY SWITCH STILL ON?
	SZA			/NO-STOP TAPE
	JMP	DTRBB
	.IFUND DT1511
	DTLA
	JMP	DEXIT		/CLEAR CONTROL
/
/
/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
	DAC DTST		/SAVE STATUS REG. B IN DTST
				/<***025:EAG***>
	.ENDC
	.IFDEF DT1511
	DAC DTUNFN
	JMP DEXIT-1	/EXIT
/
/ 11 RETURNS TO 15: 	TCCM IN DTUNFN (LOW ORDER 16 BITS, 2 MSB'S 0
/			TCST IN DTST		-"-
/			TCWC IN DTWC		-"-
/			TCBA IN DTCCA+1		-"-
/
/ BIT 15 MSB, 0 LSB !!
/
/ TCCM: BIT - 15 ERROR	('OR' OF BITS 15 - 8 IN TCST)
/
/ TCST: BIT - 15 ENDZ	SELECTED TAPE UNIT IN END ZONE
/		14 PAR	PARITY ERROR
/		13 MTE	MARK TRACK ERROR
/		12 ILO	ILLEGAL OPERATION
/		11 SELE	SELECTION ERROR
/		10 BLKM	BLOCK MISSED
/		9  DATM	DATA MISSED
/		8  NEXM NONEXISTANT MEMORY
/
DTRBB	LAC DTUNFN	/LOAD CONTROL REGISTER IN TCB
	CLL!RTL		/LEFT JUSTIFY ERROR BIT
	.ENDC
	SMA
/
/
/DTDIS = JMP DTSRCK ON SEARCH
/DTDIS = JMP DTRDWT ON READ OR WRITE
/
/
DTDIS	XX
	.IFUND DT1511
	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.
	.ENDC
	.IFDEF DT1511
	LAC DTST	/LOAD STATUS REGISTER
	AND (163400	/EXTRACT ERROR BIT
	SZA		/SKIP ON SELE ERROR
	JMP DTERRT	/IRRECOVERABLE ERROR, EXIT
	LAC DTUNFN	/LOAD CONTROL REGISTER
	AND (7400	/EXTRACT UNIT# AND DIRECTION
	DAC DTT2	/SAVE IT
	LAC (11		/SET RNUM, DO BITS IN
	XOR DTUNFN	/CONTROL REGISTER
	DAC DTUNFN 	/DEPOSIT IN TCB
	JMS DTXIOT	/GO EXECUTE IOT
	.ENDC
	LAC	(DTRYAG
	DAC SAVMED		/(JMW:127) WILL GO INTO .MED.
	DZM UND		/CLEAR SO CAN ^P RESTART
	LAW 4			/(JMW:127)
	DAC ERRNUM		/(JMW:127)
	JMS ERPRNT		/(JMW:127)
DTRYAG	LAW	-1
	DAC UND		/RESET I/O UNDERWAY SWITCH.
	JMS	DTSRCH		/SET UP FOR SEARCH
	LAC	DTT2
	XOR	(21400
	JMP	DTXIOT		/EXECUTE IOT AGAIN
/
DTST	0		/STORAGE FOR STATUS B REG
	.TITLE ERROR IN SEARCH MODE.
/
	.IFUND DT1511
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		/INTO 15-17
	AND (7
	DTRB-10		/IOR STATUS B
	.ENDC
	.IFDEF DT1511
DTERRT	LAC DTST
	.ENDC
	DAC* DLIT3	/(.MED=3)
	JMP IOPS12
	.TITLE ERROR DURING READ OR WRITE.
	.IFUND DT1511
/
/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 (LINK MUST BE 1)
	ISZ	DTERCT		/INDEX PARITY ERROR CT.
	JMP DTTIM-1		/TRY AGAIN
	LAC* (30		/WC OVERFLOW?
	SMA		/NO, MUST GET REST OF DATA
	JMP DTRDWT	/YES, 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
	DAC DTSAFE	/NEW BLK #
	LAC DTCCA	/RESET WC FOR REMAINDER
	DAC DTWC
	LAC* (31
	DAC DTCCA	/REST CURR ADDR
	LAW -10
	DAC DTERCT	/RESET PARITY TRY COUNT
	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
	.ENDC
DTRDWT	DZM UND		/CLEAR I/O UNDERWAY
	DZM	DTEOTZ		/SET DOUBLE END ZONE SWITCH
L7777	LAW	-100		/WAS DIR. (BL 100) READIN
	TAD	DTBLC
	SNA			/NO
	LAC	DTDRGT		/GET DIR SWITCH SET
	SZA!CLC			/YES-CLEAR
	JMP	DTRWEN
	DAC	DTDRGT
	LAC UNIT
	DAC NCOR		/SET DIR. INCORE SWITCH
	.IFUND DT1511
DTRWEN	LAC	(20000		/CLEAR (SET IF TIMING) GO BIT
	JMP	DTXIOT
	.ENDC
	.IFDEF DT1511
	LAC (11		/SET RNUM, DO IN
	DAC DTUNFN	/CONTROL REGISTER
	JMP DEXIT-1
	.ENDC
/
	.TITLE SEARCH INTERRUPT SERVICE.
	.IFUND DT1511
/
/
/SEARCH INTERRUPT SERVICE
DTSRCK	CLC
	DAC	DTEOTZ		/SET DOUBLE END ZONE SWITCH
	LAC	DTBCA		/BLK# JUST READ
	SAD	DTBLC		/BLK SEARCHED FOR
	JMP	DCHKF		/MAYBE-CHECK DIRECTION
	CMA
	ADD	DTBLC		/BLK# SEARCHED FOR-BL# READ
				/<***026:EAG***> CHANGED TAD TO ADD
DCHKC	SMA!CLA			/OVERSHOOT-FORW; SPA!CLA=REV.
	JMP	DTXIOT		/CONT. SEARCH, SAME DIRECTION
DTEOT	DAC	DTEOTS		/CLEAR (0) OR SET (-) EOT SWITCH
DCHK2	LAC	DTBLNC		/FORW: SUB. 2 FROM BL# TO SEARCH
DCHKC3	TAD	DTSAFE		/REV; AND 2 FROM BL# TO SEARCH
	DAC	DTBLC
	CLC			/CHANGE SIGN OF BLK INCR.
	TAD	DTBLNC		/FOR NEXT DIRECTION CHANGE
	CMA
	DAC	DTBLNC
/
/THIS ROUTINE INSURES CORRECT SETTING OF DTBLC
/ON 1ST ENTRY INTO END ZONE
	LAC	DTEOTS		/END ZONE ENTERED SWITCH
	SMA
	JMP	DCHKC4		/NOT ENTERED
	ISZ	DTEOTZ		/DOUBLE END ZONE SWITCH SET
	JMP	DCHKC4		/NO
	LAW -1			/<***026:EAG***> DO TWO'S COMPLEMENT NEGATE
	TAD DTBCA		/<***025:EAG***> WE ARE AT ENDZONE, YET
	CMA			/<***025:EAG***> HAVE RECEIVED AT LEAST
	TAD DTSAFE		/<***025:EAG***> ONE NORMAL (ERROR-FREE)
	XCT DCHKC		/<***025:EAG***> INTERRUPT.  THEREFORE
	JMP IOPS21		/<***025:EAG***> DTBCA CONTAINS THE
				/<***025:EAG***> BLOCK NUMBER IMMEDIATE-
				/<***025:EAG***> LY PRECEEDING THE END-
				/<***025:EAG***> ZONE.  IF THE BLOCK WE
				/<***025:EAG***> ARE SEARCHING FOR FOL-
				/<***025:EAG***> LOWS THE ONE IN DTBCA,
				/<***025:EAG***> THEN THE BLOCK WE ARE
				/<***025:EAG***> SEARCHING FOR DOES NOT
				/<***025:EAG***> EXIST.
	LAC	DTSAFE		/STORE BL# TO TRANSFER
	DAC	DTBLC		/INTO BL# TO SEARCH FOR
DCHKC4	LAC	DCHKC		/SMA!CLA TO SPA!CLA
	XOR	(1000		/OR VICE VERSA
	DAC	DCHKC
	LAC	DTEOTS		/EOT SWITCH
	SPA!CLA			/EOT?
	LAC (20000		/EOT--SET GO BIT
	XOR (40000		/SET BIT TO CHANGE DIRECTION
	DZM	DTEOTS		/CLEAR EOT SWITCH
	JMP	DTXIOT		/CHANGE SEARCH DIRECTION
/
	.TITLE SET UP FOR SEARCH MODE
/
/
DTSRCH	0
	LAC	(DTBCA		/SET UP CA AND WC
	DAC*	(31		/FOR SEARCH
	DZM*	(30		/WC
	LAC	(JMP DTSRCK	/SET UP INT. SERV.
	DAC	DTDIS		/FOR SEARCH
	LAC	(JMP DTERS
	DAC	DTERJ
	JMP*	DTSRCH
/
/
/
DCHKF	LAC	DTSAFD	/TRANSFER DIRECTION (SAFE)
	XOR	DTBLNC
DLITSM	SMA!CLA
	JMP	DCHKC3		/CHANGE SEARCH DIR. AGAIN
/
/THIS IS IT, SET UP TO READ OR WRITE
	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
	.ENDC
	.IFDEF DT1511
	JMS DTXIOT
	.ENDC
DEXIT	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
	.IFDEF DT1511
DTXIOT	0
	LAC TCBP
	SIOA
	JMP .-1
	LIOR
	JMP* DTXIOT
	.ENDC
/
	.TITLE --(01)--  .INIT
/
INIT	ISZ ARGP	/INDEX TO BUF. SIZE ARG.
	LAC (377	/RETURN 255 AS BUF. SIZE
	DAC* ARGP
	LAC TEMP2	/I OR O
	DAC IOSW	/OUTPUT=1, INPUT=0
	ISZ ARGP	/INDEX TO NORM. EXIT
	JMS IOU		/ANY I/O UNDERAWY?
	LAC DLMBIT	/DTMBIT)=FILE BITMAP POINTER
	JMS BFC2	/CLEAR FILE BIT MAP (L=0)
	JMS STPA	/STOP EVERYTHING!!
ONCE	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.
/DTEOTS=END ZONE (EOT) ENTERED SWITCH (-=EOT, +=NO EOT)
/DTCSLT=DAT SLOT FOR I/O UNDERWAY
/
/
DTAC	16		/.SETUP
DOUT	DTDF		/DONE FLAG
DTT2	DTINT		/DTA INT. SERV. ADDR.
DTBCA	CAL 44		/API CHN. REG. = 44
DTERCT	16
DTBLC	DTEF		/ERR. FLAG
DTBLNC	DTINT
/
/THE EXTERNAL BUFFER SIZE MUST BE AT LEAST 440.
/
XROL	LAW -440	/WORDS PER BUFFER
XRNW	TAD* (BSIZE	/-440
FIN	SZA!SPA		/FATAL ERROR IF NEG.
UDRP	JMP IOPS70
DTEOTS	LAC DJSTOP	/SIGN BIT MUST INITIALLY = 0 FOR DTEOTS
CSLT	DAC ONCE
	.EJECT
STOP	JMS STPA
	JMP DTDBK-1
/
/
IOPS70=.
UDRR	LAC CTS		/PROTECT FROM REENTRANT CTL P.
BMIN	DAC ONCE	/FORCE IOPS 70 EVERY TIME.
BMOT	LAW 70		/(JMW:127)
DES	JMP FATAL		/(JMW:127) USE EXTENDED ERRORS.
CTS	0
SLOT	0
SWAPSW	0
FB1P	0
FB2P	0
BLSV	0
L70=.
CT1S	70
OLBM	0
CLRP	0
UWC	0
WCSV	0
CLCT	0
DVSM	0
BMCT	0
/
/
/STOP DTA ROUTINE
/
STPA	0
	DZM WRWT	/CLEAR OUTPUT WAIT SWITCH
	DZM EOF		/CLEAR EOF SWITCH
	DZM CLSS	/SET .CLOSE SWITCH
	DZM SKNT	/CLEAR .SEEK, .ENTER SWITCH
	DZM WREX	/CLEAR .WRITE EXECUTED SWITCH
	DZM BMIN	/BIT MAP BLOCK IN SWITCH
	DZM BMOT	/BIT MAP BLOCK OUT SWITCH
	LAC DTMTP4	/JMP DTAPE1
	DAC DTOUT
	DAC NCOR	/CLEAR DIR IN CORE SWITCH
	JMP* STPA
/
	.TITLE --(12)-- .WAIT
/
/
/WAIT DTA ROUTINE
/
/
WAIT	SAD TEMP2	/1 IF .WAITR
	JMP DTDBK1	/0 IF .WAIT
	LAC (700000	/GET LINK, ETC.
	AND CALP
	DAC CALP
	LAC* ARGP	/BUSV ADDR.
	AND (77777
	XOR CALP
	ISZ ARGP
	DAC CALP
DTDBK1	JMS IOU		/CHECK I/O UNDERWAY
	LAC	DTST	/LOAD A/C WITH STATUS
DTDBK	DBR
	XCT .+1
	XCT .+1
	JMP* ARGP	/NORM. EXIT
	.TITLE --(02)--  .OPER   OPERATE CAL'S
/
/.OPER ROUTINE TO INTERPRET:
/.DLETE (SUBFUNCTION 1)
/.RENAME (SUBFUNCTION 2)
/.FSTAT (SUBFUNCTION 3)
/
/**********
/
DLUN=EOF	/SHARED
/
/**********
/
OPER	LAC DLUN	/DELETE OR RENAM UNDERWAY
	SZA		/NO, IF 1ST PASS THUR
	JMP DTLET3	/YES
	LAC DLFAKE	/SETUP FOR DELETE
	DAC UDRP
	JMS DTNTRZ	/DZM DT1SAV OR DT2SAV
	CLA
	XCT DTNTR3	/CLEAR LAST WD OF DTNSAV
	JMS DTCKCL	/CHECK DIRECTORY FOR THIS FILE
	DAC DTNXBK	/SAVE FOR AC=0ON NOT FOUND
	SNA
	JMP DTFST	/NOT FOUND-RETURN WITH AC=0
	XCT SK5		/PICK UP 1ST BLK# OF FILE
	XOR (400000	/CLEAR FILE COMPLETE BIT
	DAC DTNXBK	/1ST BLK#
	LAC TEMP2	/SET UP SUBFUNTION DISPATCH
	TAD (JMP DTOPTB
	DAC DTOPTB-1
	LAW -4
	TAD TEMP2	/CHECK SUBFUNCTION.
	SPA!CLA		/1-3 LEGAL ONLY
	XX		/DISPATCH TO SUBFUNCTION
DTOPTB	JMP IOPS6	/ILL. HANDLER FUNCTION
	JMP DTLET	/1=.DLETE
	JMP DTREN	/2=.RENAM
/
/ FALL THROUGH HERE FOR .FSTAT.
/
	.TITLE .FSTAT,.RENAM,.DELET OPERATE FUNCTIONS.
/
DTFST	LAC*  ARGP	/3=.FSTAT
	XOR (100000	/RETURN TYPE (1 IN 0-2)
	DAC*  ARGP	/TO USER
	LAC DTNXBK	/PICK UP BL#, RETURN TO USER IN AC
	DZM CLSS
	JMP DTAPE1
/
/.RENAM ROUTINE
/
DTREN	JMS DTNTRZ	/NEW NAME INTO DTESAV
	XCT SK5		/GET 4TH WD OF OLD ENTRY
	XCT DTNTR3	/SAVE IN DTESAV+3
	DAC BMIN	/NO NEED TO RERECORD
	DAC BMOT	/FILE BIT MAPS
/
/.DELETE ROUTINE
/
DTLET	CLC
	DAC NCOR	/CLEAR DIR IN CORE SWITCH
	DAC DLUN	/SET DELETE UNDERWAY SWITCH
	DAC IOSW	/SIMULATE WRITE
	DAC WREX	/USE .CLOSE TO MODIFY
	LAC DLTDIR	/SETUP FOR TRAN OF
	DAC DTBMPT	/DIR BIT MAP TO DIR ENTRY SECTION
DTLET3	ISZ  ARGP	/INDEX ENTRANCE ARG. POINTER
	JMP CLOSE	/FILE BIT MAP+DIRECTORY
	.TITLE	CHECK DIRECT. IN CORE SUBR.
/
/
DTDRCK	0
	JMS IOU		/I/O UNDERWAY
	LAC NCOR		/D IN 
	SAD UNIT		/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		/OK
DTER61	LAW	61
	JMP FATAL		/(JMW:127)
/
/CALL IN DIRECTORY SUBR.
DTDRIN	0
	DAC	DTTR		/TRANSFER DIRECTION SWITCH
	LAC	DLT100
	DAC	DTNXBK		/BL# TO TRANSFER
	DZM	DTDTR		/TRANSFER FORWARD
	DZM	DTDRGT		/SET IND. TO SET DIR IN CORE SWITCH
	LAC CLSS	/0 IF SEEK, ENTER
	SZA
	LAC (40		/NOT 0 IF CLOSE (DTBUF-1
	TAD	DLTDR1		/(DTRDIR-1
	JMS	DTWCS		/SETUP WC,CA
	JMP*	DTDRIN
/
	.TITLE DIRECTORY SEARCH SUBR.
/
/
SK1	0
	DAC UDRR	/USER DIR. ENTRY POINTER
	DZM DTDTR	/SET TRANSF. DIRECTION=FORWARD
	CLC		/SYSTEM TAPE?
	XOR* DLTSYS	/WD3 OF SYS BIT MAP
	SNA!CLA		/NO,56 FILES
	LAW -30		/YES, 24 FILES
	SMA
	LAW -70
	DAC DTFPCT	/DIR. POINTER=DTDIR+40=DTBUF
	XOR L7777
	DAC DBLKLC	/50 IF 24;10 IF 56
	LAC DLTBUF	/DIR. POINTER=DTDIR+40=DTBUF
SK3	DAC DES		/ENTRY SECTION POINTER
	DAC DTCURE	/CURR. ENTRY, WD0, POINTER
/
/NEXT FILE NAME ENTRY
/
	LAC UDRR	/USER DIR. ENTRY POINTER
	DAC UDRP
	LAW -4
	DAC CT1S	/MATCH COUNT
	DAC CTS		/COUNT OF ENTRY WDS TO CHECK
	ISZ CTS
/
/NEXT WORD OF CURRENT ENTRY
/
SK5	LAC* DES	/DTA DIR. ENTRY (.E.)
	SAD* UDRP	/USER D.E.
	ISZ CT1S	/WD N OF ENTRY SATCHES
	ISZ DES		/NEXT WD OF DTA ENTRY
	ISZ UDRP	/NEXT WD OF USER ENTRY
	ISZ CTS		/ENTRY WD COUNT
	JMP SK5		/CONT. MATCH CHECK
SK6	LAC DTCURE
	ISZ CT1S	/MATCH
	SKP		/N
	JMP* SK1	/YES-CURRENT ENTRY POINTER IN AC
	TAD DLIT4	/INDEX TO NEXT ENTRY
	ISZ DTFPCT	/INDEX FILE ENTRY CT.
	JMP SK3		/NEXT ENTRY
	CLA
	JMP* SK1	/YES-CAN'T FIND FILE NAME
	.TITLE --(06)--  .CLOSE
/
/
CLOSE	JMS IOU	/I/O UNDERWAY WAIT
	LAC IOSW	/I OR O
	SNA
	JMP DTFND1	/INPUT-CLEAR SWITCHES EXIT
	LAC WREX	/WRITE EXECUTED AFTER .ENTER
	SZA
	JMP CLS2	/YES
	JMS DTCBIT	/NO-CLEAR BIT MAP
	JMP DTFND1
CLS2	LAC EOF		/EOF BUF IS OUT
	SPA!CLC
	JMP CLS3
	DAC EOF		/SET EOF SWITCH
	DZM TEMP2	/FAKE DATA MODE=IOPS BIN
	LAC (SKP!CLA)		/(RCHM-129) SET UP DOING CLOSE SWITCH.
	DAC CL.SW		/(RCHM-129)
	LAC (15000		/OUTPUT
	JMS DTMCK
	LAC DLEOFH		/EOF HEADER POINTER (DTEOFH
/
/FAKE ARG FOLLOWS - USED AS VARIABLE
/
MINUS1=.
DTDRGT	LAW -1		/GET DIR IND. (0=GET)
	JMP WRITER
CLS3	LAC BMIN		/FILE BIT MAP BLOCK IN
	SZA!CLC
	JMP	CLS4
	DAC BMIN	/SET BIT MAP IN SWITCH
	LAW -50
	TAD DBLKLC
	SNA!CLA		/NON 0 IF 56 ENTRIES
	LAW -4
	TAD DLIT77
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 BUSB
	DAC	DTOUT
	DZM	DTDTR		/SET TRANSF. DIRECT. SW. = FORW.
	JMP SEK1		/READ BIT MAP BLOCK INTO DIR. BIT MAP
CLS4	LAC BMOT	/FILE BIT MAP BLOCK OUT
	SZA!CLA
	JMP CLS6
	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 BMOT	/SET BIT MAP OUT SWITCH
	DAC	OLBM
	DAC	XROL		/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	XROL
	LAC	OLBM		/OLD BIT MAP ADDR
	JMS	DTXOR		/XOR NEW INTO OLD BIT MAP
	LAC	(15000
	JMP SEK2		/OUTPUT BIT MAP BLOCK
	.TITLE SUBROUTINE TO XOR BIT MAP 1 INTO BIT MAP 2
/
/
/ALSO CLEARS BIT MAP 1 IF LINK = 0
/
DTXOR	0
	DAC XRNW	/BIT MAP 2 ADDR
	LAW -40
	DAC CTS
DTXOR1	LAC* XROL		
	XOR* XRNW	/BIT MAP 2 POINTER
	DAC* XRNW
	SNL!CLC		/DO NOT CLEAR BIT MAP 1, CLC FOR SETTING DTNCOR
	DZM* XROL	/CLEAR BIT MAP 1
	ISZ XROL
	ISZ XRNW
	ISZ CTS
	JMP DTXOR1
	JMP* DTXOR
/
CLS6	LAC CLSS	/FILE CLOSED
	SNA!CLC
	JMP DTFEND	/YES-CLEAR SWITCHES, EXIT
	JMS DTDRCK	/LOAD DIRECTORY INTO DTBUF
	LAC DTBMPT	/DT. BIT MAP POINTER
	DAC CLRP	/NIT. DIR ENTRY SECT. POINTER
	LAW -40		/DIR. ENTRY SECTION COUNT
	DAC TEMP0
	LAC DLTBUF	/(DTBUF)
	DAC TEMP1
CLS5	LAC* CLRP	/TRANSFER DIR. BIT MAP
	DAC* TEMP1	/TO FRONT OF DIR. ENTRY SECTION
	ISZ CLRP
	ISZ TEMP1
	ISZ TEMP0
	JMP CLS5
	LAC DLSAV		/(DTESAV
	DAC FIN
	LAC DTCURE	/ADD 40 TO ACCOUNT FOR BLOCK MOVE
	TAD (40
	DAC DTCURE
	LAW -4
	DAC TEMP0
	.EJECT
CLS7	LAC* FIN	/NEW FILE NAME (4 WDS)
	DAC* DTCURE	/INTO DIRECTORY ENTRY SECTION
	ISZ FIN
	ISZ DTCURE
	ISZ TEMP0
	JMP CLS7
	LAC (15000	/REWRITE DIRECTORY
	JMS DTDRIN
	DZM CLSS	/CLEAR CLOSE IND.
	JMP CLOSE
/
/
DTFEND	DAC NCOR	/CLEAR DIR IN CORE SWITCH
DTFND1	DZM FLS1	/CLEAR FILE 1 SLOT #
/
/ GIVE THE BUFFER BACK TO THE SYSTEM.
/ *** UMULATE THE .GVBUF ***
/
EMUL	LAC* (NUMBUF	/# OF BUFFERS IN POOL.
	JMS TWOS	/2'S COMP.
	DAC TEMP1	/USE AS COUNTER TO END LOOP.
	LAC* (BFPOOL	/FIRST BUFFER POOL POINTER.
	DAC TEMP2
FNDBUF	LAC* TEMP2	/POINTER IN LOW CORE.
	CMA
	SAD DLTDIR	/1'S COMP MATCH?
	DAC* TEMP2	/IF YES..RELEASE IT.
	IDX TEMP2	/POINT TO NEXT POINTER.
	ISZ TEMP1	/DONE LOOP?
	JMP FNDBUF	/NO KEEP LOOKINK.
	DZM DLTDIR	/0 BUFFER POINTER HERE IN HANDLER.
DJSTOP	JMP STOP	/CLEAR OTHER SWITCHES+EXIT
/
/
TWOS	0
	CMA
	TAD DLIT1
	JMP* TWOS
	.TITLE --(13)-- .TRAN
/
/
TRAN	JMS IOU		/I/O UNDERWAY
	LAC* ARGP		/BL#
	JMS DTSET		/SETUP BL#, ETC
	ISZ ARGP
	CLC
	TAD* ARGP 		/CORE ADDR. -1
	ISZ ARGP
	JMS DTWCS		/SETUP CA AND START TRAN.
	LAC* ARGP		/WC
	DAC DTWC
	JMP DTAPE1		/NORM USER EXIT
/
/SUBROUTINE TO SET UP BLOCK #, TRANSFER DIRECTION
DTSET	0
	DAC	DTNXBK
	LAC	TEMP2		/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
	.TITLE SUBR. TO SET UP CA, WC AND TRANSFER
/
DTWCS	0
	DAC	DTCCA		/ADDR.-1
DTUMSK	LAW	-400
	DAC	DTWC		/WORD COUNT (2'S COMP)
	LAW	-10
	.IFUND DT1511
	DAC	DTERCT		/PARITY ERROR RETRY COUNT
	LAC	DTDTR		/TRANS. DIRECT. SWITCH
	AND	(1000		/AND
	XOR	DLITSM		/SMA!CLA=SEARCH FORW.
	DAC	DCHKC		/SPA!CLA=SEARCH REV.
	.ENDC
	.IFDEF DT1511
	DAC DTERCT	/DEPOSIT IN TCB
	.ENDC
	LAC	DTNXBK
	DAC	DTBLC
	DAC	DTSAFE		/BASE REF. FOR BL# DURING INT SERV
	.IFUND DT1511
	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
	.ENDC
	LAC	FLS1	/SAVE DAT SLOT FOR
	DAC CSLT	/WHICH I/O IS NOW UNDERWAY
	LAC	DTDTR		/DIRECTION SWITCH
	DAC DTSAFD		/SAFE FOR INTERR. SERV.
	AND	(40000
	XOR	(21400		/UNIT+21400=SEARCH FORW.
	XOR UNIT		/UNIT+61400=SEARCH REV.
	DAC UND	/SET I/O UNDERWAY
	.IFUND DT1511
	DTLA
	.ENDC
	.IFDEF DT1511
	DAC DTUNFN
	JMS DTXIOT
	.ENDC
	JMP*	DTWCS		/EXIT SUBR
	.TITLE .READ, .WRITE COMMON SETUP SUBR.
/
DTMCK	0
	DAC	DTTR		/READ (13000) OR WRITE (15000)
	.IFDEF DT1511
	DAC DTUNFN
	LAC (JMP DTRDWT
	DAC DTDIS
	.ENDC
	LAC SKNT		/.SEEK, .ENTER SWITCH
	SNA
	JMP IOPS11		/.SEEK, .ENTER NOT EXECUTED (DTER11)
	XCT*	DTMCK		/L.B. OR DTA BUF. L.B. ADDR.
	DAC	DTUHP		/HEADER POINTER
	DAC	DTUDP		/DATA POINTER
	LAC* ARGP		/(RCHM-128) FETCH USER BUFFER ADDRESS.
	DAC DTUBUF		/(RCHM-128) SAVE IN CASE OF DUMP MODE.
	ISZ ARGP
	XCT CL.SW		/(RCHM-129) ARE WE DOING A READ OR WRITE?
	AND (700000)		/(RCHM-126) YES, EXTRACT EXTENDED MEMORY BITS.
	SZA			/(RCHM-126) ARE ANY OF THEM ON?
	JMP IOPS67		/(RCHM-126) YES, GO GENERATE ERROR MESSAGE.
	LAC* ARGP		/USER WC
	DAC	UWC
	LAC	TEMP2		/DATA MODE
	DAC	DTDMOD
	ISZ	DTMCK		/INDEX TO DUMP EXIT
	SAD DLIT4
	JMP	DTMCK2		/DUMP MODE
	LAC (NOP)		/(RCHM-129) RESET TO READ AND WRITE.
	DAC CL.SW		/(RCHM-129)
	LAC*	DTUHP		/COMPUTE W.C. FROM L.B.H. W.P.C
	JMS	DTGWPC
	ISZ	DTMCK		/IOPS, IMAGE EXIT
	JMP*	DTMCK		/EXIT,
/
/DUMP MODE
/
DTMCK2	LAC UWC		/SAVE USER WC
	DAC WCSV
	CMA!IAC			/(RCHM-126) MAKE POSITIVE NUMBER.
	TAD DTUBUF		/(RCHM-128) ADD IN START OF USER BUFFER.
	XCT CL.SW		/(RCHM-129) ARE WE DOING A READ OR WRITE?
	AND (700000)		/(RCHM-126) YES, EXTRACT EXTENDED MEMPRY BITS.
	SZA			/(RCHM-126) ARE ANY OF THEM ON?
	JMP IOPS67		/(RCHM-126) YES, GO GENERATE ERROR MESSAGE.
	LAC (NOP)		/(RCHM-129) RESET TO READ/WRITE.
	DAC CL.SW		/(RCHM-129)
	DZM DTWPC
	XCT* DTMCK	/JMP DTRDUM OR JUMP DTWDUM
DTUBUF	XX			/(RCHM-128) SAVE ADDRESS OF USER I/O BUFFER.
CL.SW	NOP			/(RCHM-129) NON READ WRITE SWITCH. NOP =>
				/(RCHM-128) READ OR WRITE.
				/(RCHM-129) SKP!CLA => OTHERWISE.
/
/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
	JMP IOPS23
	AND (400
	SNA!CLA
	JMP* DTGWPC	/L.B.W.C. INAC
	JMP IOPS23
	.TITLE ADD TO CKSM AND INDEX CNTS, CHECK ACTIVE FILE.
/
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
	LAC CLSS	/PREVIOUS FILE CLOSED
	SZA!CLA
	JMP IOPS10	/NO-FILE STILL ACTIVE
	JMS DTDRCK	/CHECK FOR DIRECTORY IN CORE
	LAC* ARGP		/USER D.E. POINTER
	JMS SK1		/DIR. SEARCH FOR FILE
	DAC CLSS	/CLEAR OR SET CLOSE SWITCH
	JMP* DTCKCL
	.TITLE --(03)--  .SEEK
/
/
/DTA SEEK FILE SUBR
/
SEEK	LAC IOSW
	SZA!CLC
	JMP IOPS7	/ILL. DATA MODE (.SEEK ON OUTPUT FILE) (DTER7)
	JMS DTCKCL	/CHECK DIRECTORY FOR THIS FILE
	SNA!CLC		/DTA DIR. ENTRY POINTER IN AC
	JMP IOPS13	/FILE NOT FOUND (DTER13)
	XCT SK5		/PICK UP 1ST BLK# OF FILE
	XOR (400000	/CLEAR FILE COMPLETE BIT
	DAC DTNXBK	/BLK # TO READ
	DAC SKNT	/SET .SEEK, .ENTER EXECUTED SWITCH
SEK1	LAC (13000
SEK2	DAC DTTR	/INPUT
	DAC NCOR	/CLEAR DIR. IN CORE SWITCH
	XOR (13000
	SZA
	JMP DTCOUB	/OUT
	DZM DTDMOD	/CLEAR DATA MODE TO BYPASS DUMP CHECK
	JMP RNX1
/
/
/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	UWC		/DONE
	JMP	DTWT2
	JMP*	DTRWT
	.TITLE --(11)--  .WRITE
/
/
WRITE	JMS IOU		/I/O UNDERWAY
	LAC DTMTP4
	DAC DTOUT
	DAC WREX	/SET .WRITE EXECUTED SWITCH
	LAC (15000
	JMS DTMCK	/READ/WRITE COMMON SETUP
	LAC* ARGP
	JMP DTWDUM	/DUMP MODE WRITE ROUT.
/
/RETURN HERE FOR IMAGE OR IOPS MODES
/
WRITER	CLC
	TAD DTWPC	/REMAINING BUF. AREA SIZE
	TAD DTBFCT	/REMAINING BUF. AREA SIZE
	SMA!CLA
	JMP OUTBUF	/NO ROOM FOR THIS LINE
	DAC WRWT	/OUTPUT WAIT SWITCH-CLEAR
	LAC* DTUHP
	AND (7
	SAD (5
	JMP WRITE0
	LAC* DTUHP	/USER LBH., WD0
	AND (377000
	XOR DTDMOD	/DATA MODE
	DAC* DTUHP
WRITE0	ISZ DTUHP	/CLEAR USER CKSM
	DZM* DTUHP
	DZM DTCKSM	/INIT CHECKSUM
	LAC DTWPC
	JMS TWOS	/2'S COMP.
WRITE1	DAC UWC		/ACTUAL WC (2'S COMP)
	LAC DTHPT	/SET UP CKSM POINTER
	DAC DTUCKP	/FOR .WRITE
	ISZ DTUCKP
	JMS DTRWT
	LAC DTDMOD
	SAD DLIT4
	JMP DTDUMK	/DUMP MODE, CHECK FULL BOFF
	LAC DTCKSM
	JMS TWOS
	DAC* DTUCKP	/STORE 2'S COMP CKSUM IN DTABUF
WRITE2	LAC EOF
	SZA		/NO EOF
	JMP DTCOUY	/TRANSFER EOF
DTMTP4	JMP DTAPE1	/IOPS WRITE COMPLETE
	.EJECT
/
/CONTROL COMES HERE AFTER SOME I/O IS COMPLETE.
/THE BUFFER HAS JEST BEEN WRITTEN. CLEAR IT OUT
/AND MOVE IN THE NEW LINE.
/
DTWRCL	JMS DTBUFC	/CLEAR THE 400 WORD BUFFET.
	ISZ ARGP	/INDEX TO WC ARG
	JMP WRITER	/PUT LINE IN DTA BUF
	.TITLE 		**ALL ERRORS EXIT HERE**
/
/
/
IOPS67	LAW 67			/(RCHM-126) FETCH ERROR NUMBER.
	JMP FATAL		/(RCHM-126) GO PRINT ERROR MESSAGE. (JMW:127)
IOPS6	LAW 6
	JMP FATAL		/(JMW:127)
IOPS7	LAW 7
	JMP FATAL		/(JMW:127)
IOPS10	LAW 10
	JMP FATAL		/(JMW:127)
IOPS11	LAW 11
	JMP FATAL		/(JMW:127)
IOPS12	LAW 12
	JMP FATAL		/(JMW:127)
IOPS13	LAW 13
	JMP FATAL		/(JMW:127)
IOPS14	LAW 14
	JMP FATAL		/(JMW:127)
IOPS15	LAW 15
	JMP FATAL		/(JMW:127)
IOPS17	LAW 17
	JMP FATAL		/(JMW:127)
IOPS21	LAW 21			/<***025:EAG***> ILLEGAL BLOCK NUMBER
	JMP FATAL		/<***025:EAG***> (JMW:127)
IOPS22	LAW 22
	JMP FATAL		/(JMW:127)
IOPS23	LAW 23
	JMP FATAL		/(JMW:127)
IOPS55	LAW 55
/
/ (JMW:127) FATAL ERROR - THIS WILL LOOP IF USER TYPES CTRL R.
/
FATAL	DAC ERRNUM	/SAVE THE ERROR # FOR LOOPING.
	JMS STPA		/CLEAR SWITCHES SO CAN CTRL P RESTART.
	DZM UND
	LAC* (.MED	/GET GOOD CONTENTS OF .MED
	DAC SAVMED	/FOR POSSIBLE REPEAT.
	JMS ERPRNT	/GO PRINT THE EXTENDED ERROR.
	JMP .-1		/LOOP ON CTRL R.
/
 / (JMW:127) OUTPUT ERROR VIA EXTENDED ERROR PROCESSOR.
/
ERPRNT	0
	LAC UNIT	/OUTPUT UNIT NUMBER (IN BITS 0-2).
	RCR; RTR
	XOR (600000	/MAKE ASCII.
	DAC UNITSP
	LAC SAVMED	/GOOD CONTENTS OF .MED.
	DAC* (.MED
	LAC ERRNUM
	JMS* (EXERRS
	JMP* ERPRNT
	LAW -2
	.SIXBT /DTA/
UNITSP	0
ERRNUM	0		/SAVE ERROR NUMBER AND
SAVMED	0		/CORRECT CONTENTS OF .MED FOR POSSIBLE LOOP.
	.TITLE SUBROUTINES THAT CLEAR BUFFERS.
/
/CLEAR OUTPUT BUF. SUBR.
/ALSO NEEDED FOR INPUT BECAUSE OF POINTER INITIALIZATION
/
DTBUFC	0
	LAC	(377		/INIT DUMP MODE
	DAC	DTROOM		/BUFF SIZE
	LAC IOSW
	RAR
	LAC	DLTBUF		/BUF. (WD0) POINTER (DTBUF
	SZL!STL			/DO NOT MODIFY DTHPT ON INPUT
	DAC	DTHPT		/DTA BUF HEADER POINTER
	DAC	DTRHPT		/FOR READ
	JMS BFC2	/CLEAR BUF, LINK=1
	JMP* DTBUFC
/
/CLEAR SPECIFIED AREA SUBR.
/
BFC2	0
	DAC BFC3
	LAW -40		/CLEAR 40
	SZL
	AND DTUMSK	/CLEAR 400, DTUMSK=777400
	DAC CLCT	/DTCLCT=DTMPP
	DAC DTBFCT		/INIT BUF SIZE CT.
	ISZ DTBFCT
BFC1	DZM* BFC3
	ISZ BFC3
	ISZ CLCT
	JMP BFC1
	JMP* BFC2
BFC3	0			/CLEAR POINTER
/
/OUTPUT CURR. IOPS BUFFER
/
OUTBUF	LAC (DTWRCL		/SET RETURN FROM INT.
	DAC WRWT		/SET OUTPUT WAIT SWITCH
DTCOUY	LAC BUSB
	DAC DTOUT
DTCOUZ	LAC DTCNBK		/CURR. BL# TO WRITE
	DAC DTNXBK
	SPA
	JMP IOPS15
	LAC WRWT
	SNA!CLA		/IF DTWRWT IS NON 0,ALWAYS GET NEXT BLK #
	LAC EOF		/EOF SWITCH SET?
	JMS DTMAP		/FIND NEXT FREE BLOCK
	DAC* DTLINK		/DATA LINK POINTER
DTCOUB	LAC DLTBF1		/(DTBUF-1
	JMS DTWCS		/SETUP WC,CA AND BEGIN TRAN.
DTOUT	XX
	.TITLE DUMP MODE OUPUT
/
DTWDUM	JMS DTDUMB
	XCT DTXXX				/JMS DTBUFC OR NOP
	JMP WRITE1
/
DTDUMB	0
	XCT*	DTDUMB		/JMS DTBUFC (WRITE) OR NOP (READ)
	ISZ	DTDUMB
	LAC	DTWRCL		/SET SWITCH TO CLEAR
	DAC	DTXXX		/OUTPUT BUFF (JMS DTBUFC)
	LAC	DTROOM
	TAD WCSV
	SMA			/MORE THAN 3 7 TO TRANSFER
	JMP	DTDUMZ	/LAST ELEMENT OF TRANSFER
	DAC WCSV	/SAVE REMAINDER
	LAW	-2
	TAD	DTDUMB		/RET. ADDR. FOR TRANS. COMP
	DAC WRWT		/=I/O WAIT SWITCH
	LAC BUSB		/JMP DTBUSY
	DAC	DTOUT
	CLC
	TAD	DTROOM		/FILL IN BUFF
	CMA
DTDUMY	XCT*	DTDUMB		/JMP DTWT1(WRITE) OR JMP DTNSH1
DTDUMZ	DZM WRWT		/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	DTXXX
	LAC	DTMTP4
	DAC	DTOUT
	LAC WCSV	/REMAINDER
	JMP DTDUMY
DTDUMK	LAC	DTROOM		/IF DTROOM=0, BUFF FULL
	SZA!CMA
	LAC WRWT		/IF DTWRWT=0, BUFF NOT FULL
	SZA			/NO
	JMP	DTCOUZ	/YES-OUTPUT
	JMP WRITE2		/CHECK EOF
/
	.TITLE --(10)--  .READ
/
READ	JMS IOU	/ANY I/O ALREADY UNDERWAY?
	LAC EOF		/NO..IF CONTROL COMES BACK.
	SNA		/EOF NOT ENCOUNTERED IF ZERO.
	JMP NOTEOF	/NO..CONTINUE WITH LINE.
/
/ ANOTHER .READ HAS COME IN WHERE THE PREVIOUS
/READ PASSED AN END-OF FILE BACK TO THE USER.
/PASS BACK ANOTHER END OF FILE AND CONTINUE
/TO DO SO EACH TIME A READ IS DONE .
/
	LAC* ARGP	/PTR TO L.B. POINTER
	DAC TEMPD1	/ONE MORE LEVEL OF INDIREDT.
	LAC DTEOFH	/(1005) 1ST EOF WORD.
	DAC* TEMPD1
	IDX TEMPD1	/INDEX PTR TO NEXT RECEIVER WORD.
	CMA		/USE 2'S COMP AS WORD2(CHECKSUM).
	TAD DLIT1
	DAC* TEMPD1	/DONE GO BACK TO USER.
	CLC
	JMP DTEFX	/GO TO IGNORER.
/
NOTEOF	LAC* ARGP	/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
	JMP DTRDUM	/DUMP MODE INPUT
/
/RETURN HERE FOR IOPS OR IMAGE MODES
/
	CLC
	TAD	DTWPC		/IOPS ASCII OR BIN (AC=777777 ON RETURN)
	TAD UWC
	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	DTDMOD
	SAD	DLIT4
	JMP	DTRDM1	/DUMP
	LAC*	DTUDP		/BYPASS
	JMS	DTUPTR		/EXCESS DATA
	JMP	.-2
DTRDM1	LAC	DTROOM		/DUMP MODE BUFF SIZE
	SZA!CMA			/IF DTROOM=0 OR
	LAC WRWT		/DTWRWT=NON 0,
	SZA!CLC
	JMP	DTRNEX		/GET NEXT DUMP BLOCK
	JMP	DTAPE1
/
/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
	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
	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		/MAST 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
RNX1	JMS	DTBUFC		/INIT. BUFFER
	LAC	DTDMOD		/DUMP MODE?
	XOR	DLIT4
	SZA			/YES
	JMP	DTCOUB		/NO
	LAC	DTRHPT		/RESET BUFF POINTER
	DAC	DTUDP
	JMP	DTCOUB		/TRANSFER
	.TITLE SUBR. TO SET DATA VALIDITY BITS
/
DTDVS	0
	DAC DVSM	/SAVE MASK
	LAC*	DTHPTS		/MASK ALL BUT BITS 0, 12,13
	AND	(777717
	XOR DVSM
	DAC*	DTHPTS		/HEADER, WD0
	JMP*	DTDVS
DTEFX	ISZ ARGP
DTREOF	DAC EOF		/SET EOF SWITCH+DROP THRU TO EXIT
DTRNOR	TAD	DTBFCT		/DECR. (BY 1) DTFCT
	DAC	DTBFCT		/BUF COUNT
DTAPE1	ISZ ARGP
	JMP	DTDBK
DTNSH1	DAC UWC
	JMP	DTRD2		/TRANSFER LINE
/
/DUMP MODE INPUT
/
DTRDUM	JMS	DTDUMB		/SET UP FOR DUMP INPUT
DTLNOP	NOP
	JMP	DTNSH1
	.TITLE --(04)--.ENTER
/
/
/DTA ENTER FILE ROUTINE
/
ENTER	LAC IOSW	/WAS FILE INITED FOR OUTPUT?
	SNA		/YES IF NON 0.
	JMP IOPS7	/NO FATAL ERRER.
	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 SK1		/D SEARCH FOR EMPTY FILE ENTRY
	DAC CLSS	/CLEAR OR SET CLOSE SWITCH
	SNA
	JMP IOPS14	/DIRECTORY FULL
DTNTR6	LAC* ARGP	/SAVE USER D.E. POINTER
	DAC UDRP
	JMS DTNTRZ	/SAVE USER D.E. IN DT1SAVOR 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. #
	LAW -1100	/INIT DT BLOCK COUNT
	DAC DTBLOK
	LAW -1		/INIT BIT MAP
	DAC DTREM	/SEARCH TO
	DAC SKNT		/PICK UP
	DAC NCOR	/1ST BLOCK FREE
	LAC DLIT1	/(1
	DAC DTDIRA	/SET BIT MAP DIRECTION SWITCH
	DAC DTDIRL	/TO FORWARD (+1)
	JMS DTMPS	/SETUP TO EXAM. MAP, WD0
	JMS DTMAP	/GET NEXT FREE BL#
	XOR (400000
	XCT DTNTR3	/STORE BL#+COMPLETION BIT IN DTESAV+3
	SMA
	JMP IOPS15	/DECTAPE FULL (DTER15)
	JMS DTBUFC
	LAC DTLNOP
	DAC DTXXX	/SET OUTPUT DUMP SWITCH
	JMP DTAPE1	/NORM EXIT
	.TITLE SUBR. TO SAVE USER D.E.
/
/
DTNTRZ	0
	LAC DLSAV	/(DT1SAV) OR (DT2SAV)
	DAC FIN
	LAW -3		/SET DTA D.E.
	DAC CLCT	/TRANSFER COUNTER
NTR2	LAC* UDRP	/SAVE USER D.E.
DTNTR3	DAC* FIN
	ISZ FIN
	ISZ UDRP
	ISZ CLCT
	JMP NTR2
	JMP* DTNTRZ
DT1SAV	0		/1ST NEW FILE ENTRY SAVED HERE
	0
	0
	0
DT2SAV	0		/2ND NEW FILE ENTRY SAVED HERE
	0
	0
	0
DT3SAV	0		/3RD NEW FILE ENTRY SAVED HERE
	0
	0
	0
DTFAKE	0		/EMPTY SLOT FOR ENTER SEARCH (LAST WD. UNUSED)
	0
	0
DTEOFH	1005		/EOF HEADER FOR CLOSE
	.TITLE 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		/DT. BIT MAP POINTER
	LAC	DTDIRA
	TAD	DTPONT		/FILE BIT MAP POINTER
	DAC	DTPONT
	JMS	DTMPS		/SET FOR NEXT WD
	ISZ	DTWMCT		/BIT MAP WORD CT
	JMP*	DTMPP		/EXIT
	LAW	-1100
	DAC	DTBLOK		/RESET BLK COUNT
	DZM BMCT		/CLEAR BIT MAP 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 CASE
/
	LAC DTDIRA
	RAL		/L=1=REV.,L=0=FORW.
	LAC DTNXBK	/LAST BL # RECORDED FOR THIS FILE
	CMA
	SNL		/REV
	JMP .+3
	TAD (1100
	CMA
	DAC DTREM	/LAW TO CHECK ENOUGH SPACE BETW BL
	LAW	-41
	DAC	DTWMCT		/MATRIX COUNT
	JMP	DTMPP1		/START REV. SEARCH
	.TITLE BLOCK AVAILABILITY BIT MAP SEARCH
/
DTMAP	0
	DAC DTCLR2	/SAVE AC, IF -1, IT WILL BE BLK# ON EXIT
	DZM BMCT	/BIT MAP SEARCH COUNT
DTMAP1	LAC DTTBIT	/TEST BIT
DTMAP2	AND	DTSBIT		/MATRIX WORX
	SZA!CLC
	JMP	DTREM		/BLOCK AVAILABLE
	ISZ	DTBLOK		/INCR. DT BLOCK COUNT
	JMP DTMAP4
	DAC DTBLOK
	JMP DTREM5
DTMAP4	ISZ BMCT
	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 BMCT
	SPA!CLC			/OK-4 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		/RESET BLOCK
	DAC	DTREM		/DISTANCE CHECK TO -DELTA
	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 ON ENTRY = -1?
	SAD DTCLR2
	SKP		/YES, EXIT WITHH AC= -1
	LAC DTCNBK	/NEW BLK #
	JMP*	DTMAP		/EXIT -BL ! FOUND(777777=DTA FULL)
	.TITLE CHANGE BIT IN MAPS SUBR.
/
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
	.TITLE --(05)--  .CLEAR
/
/
/ CONTROL GOES TO 'CLEAR' FROM DISPATCHER.
/
/
DTCLR2	XX		/LAC DTBLBT=BLOCK TABLE
	DZM TEMP2	/PUT (1) IN TEMP2.
	ISZ TEMP2	/WRITE FORWARD
	JMS DTSET	/SET BL# ETC
	LAC DLTBF1	/LDTBUF-1
	JMS DTWCS	/SET UP CA, WC+BEGIN TRANSFER
	ISZ DTCLR2	/INDEX FOR NEXT TRANSFER
/
/
/
CLEAR	JMS IOU		/WAIT FOR I/O TO FINISH
	LAC CLSS	/CLOSE SWITCH CLEAR
	SZA!CLA			/YES
	JMP IOPS10		/FILE STILL ACTIVE
	LAC (DTCLR1	/SET RETURN AND
	DAC WRWT	/I/O WAIT SWITCH
	DAC NCOR	/CLEAR DIR IN CORE SWITCH
	LAC (LAC DTBLBT
	DAC DTCLR2	/INIT TABLE REF
	JMS DTBUFC	/CLEAR BUFF
	LAW -10		/COUNT FOR
	DAC BFC3	/FILE BIT MAP BLOCKS
	LAW -11
	DAC CLCT	/COUNT OF BLOCKS TO CLEAR+1
/
/
/
DTCLR1	ISZ BFC3	/FILE BIT MAP BLOCKS CLEARED?
	JMP .+4
	LAC (77600	/INIT DIRECTORY TO 4 SYSTEM BLKS OCCUPE
	DAC* DLB003
	DAC* DLB203
	ISZ CLCT	/DONE
	JMP DTCLR2
	DZM WRWT	/YES-CLEAR I/O WAIT SWITCH
	JMP DTDBK
/
	.TITLE DTCLER BLOCK TABLE
/
/
DTBLBT	71			/BLOCKS 71-73 CONTAIN
	72			/24 BIT MAPS ORDERED ACCORDING
	73			/TO THE FILE NAMES IN THE DIR. ENTRY SECTION
	74
	75
	76
DLIT77	77
DLT100	100			/BLOCK 100=DIRECTORY
DT1BIT	0			/FILE 1 BIT MAP
	.LOC	DT1BIT+40
DT2BIT	0			/FILE 2 BIT MAP
	.LOC	DT2BIT+40
DT3BIT	0			/FILE 3 BIT MAP
	.LOC	DT3BIT+40
/
/
/ DOS-15 DYNAMICALLY REQUESTS THE FOLLOWING BUFFERS AND
/ RETURNS THEM WHEN DONE. IF ONLY ONE BUFFER IS REQUESTED
/ ONLY ONE IS AKED FOR AT 'GETBUF'
/
/DTDIR	0			/DTA DIRECTORY (FILE1)
/	.LOC	DTDIR+40
/DTBUF	0			/DTA BUFFER (FILE1)
/	.LOC	DTBUF+400
/DTDIR2	0			/DTA DIRECTORY (FILE2)
/	.LOC	DTDIR2+40
/DTBUF2	0			/DTA BUFFER (FILE2)
/	.LOC	DTBUF2+400
/DTDIR3	0
/	.LOC	DTDIR3+40		/DTA DIRECTORY (FILE 3)
/DTBUF3	0
/	.LOC	DTBUF3+400		/DTA BUFFER (FILE 3)
/
/
/
FLS1	0		/SLOT # OF CURRENT DAT SLOT.
FLS2	0		/FILE 2 DAT SLOT
FLS3	0		/FILE 3 DAT SLOT
/
	.TITLE FILE 1 DESCRIPTOR SET (BECOMES CURRENT).
/
/ THE FIRST 8 WORDS IN THE CURRENT SET ARE COMPUTED AT 'GETBUF'
/
/
/
BLAB=.
DLTDIR	/DTDIR		/DIRECTORY POINTER
DLTDR1	/DTDIR-1	/DIRECTORY POINTER-11 (FOR LOADING C.A.)
DLTSYS	/DTDIR+203	/WD3 0F SYS BIT MAP
DLTBF1	/DTBUF-1	/DTA BUFF POINTER-1
DLTBUF	/DTBUF		/DTA BUF. POINTER-1
DLB003	/DTBUF+3	/SYSTEM BLOCK BITS POINTER
DLB203	/DTBUF+203	/BASIC SYSTEM BLOCK BITS POINTER
DTLINK	/DTBUF+377	/FILE1 DATA LINK POINTER
/
DLMBIT	DT1BIT		/FILE1 BIT MAP POINTER
DLSAV	DT1SAV		/POINTER TO 1ST CELL OF NEW DIR. ENTRY
DTROOM	377		/DUMP MODE BUFF SIZE (MODIFIED
DTXXX	XX		/DUMP MODE OUT SWITCH(JMS DTBUFC OR NOP)
DTNXBK	0		/BL.# TO BE TRANSFERRED
DTCNBK	0		/DATA LINK (NEXT BL.#)
DTCURE	0		/DIR. POINTER TTO CURR. FILE ENTRY EXAMINED
EOF	0		/EOF SWITCH, -0=EOF
DTHPT	0		/DTA BUF. LINE HEADER POINTER (INDEXED)
IOSW	0		/I/O SWITCH, 0=INPUT, 1=OUTPUT
DTRHPT	0		/DTA BUF. LINE HEADER POINTER (.READ)
SKNT	0		/.SEEK,.ENTER EXECUTED SWITCH (NON 0=EXECUTED)
DTPONT	0		/CURR. FILE BIT MAP WD POINTER
CLSS	0		/FILE OPEN, CLOSE SWITCH(NON-0=OPEN,0=CLOSED)
DTBFCT	0		/BUFFER COUNT (INIT=-377)
DTDTR	0		/TRANSF. DIRECT. SW.,0=F,-1=R
WREX	0		/WRITE EXECUTED SWITCH (0=NOT, NON 0=EXECUTED)
DTFPCT	0		/FILE ENTRY COUNT
DBLKLC	0		/24-56 FILE ENTRY SWITCH(50=24;10=70)
BLAND=.
/FILE 1 BLOCK-SECTION B
/SECTION B IS NOT SWAPPED WHEN BOTH FILES ARE ON SAME UNIT
UNIT	0		/(0-2)=DTA UNIT# FOR TRANSFER
NCOR	077777		/DIRECT. IN CORE SWITCH
DTDIRA	0		/BIT MAP DIRECTION SWITCH (CURR. BL.)+1=F,-1=R
DTDIRL	0		/BIT MAP DIRECTION SWITCH (LAST.BL.),+1=F,-1=R
DTMTRX	0		/CURRENT BIT MAP WD. POINTER
DTRBIT	0		/18  BIT (2'S COMP)COUNTER FOR BIT MAP SEARCH
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		/DIR. BIT MAP 1 POINTER
DTBLOK	0		/BLOCK EXAMINED COUNT
BLBND=.
	.TITLE FILE 2 DESCRIPTOR SET
/
/
	0	/DTDIR2		DIRECT2 POINTER
	0	/DTDIR2-1	/DIRECT 2 POINTER-1 (FOR LOADING C.A.)
	0	/DTDIR2+203
	0	/DTBUF2-1	/DTA BUF 2 POINTER -1
	0	/DTBUF2		/DTA BUF 2 POINTER
	0	/DTBUF2+3
	0	/DTBUF2+203
	0	/DTBUF2+377	/FILE 2 DATA LINK POINTER
/
/
/
F01	DT2BIT			/FILE 2 BIT MAP POINTER
F02	DT2SAV			/NEW DIR ENTRY POINTER
F03	377
F04	XX
F05	0
F06	0
F07	0
F08	0
F09	0
IOSW.2	0
F11	0
SKNT.2	0
F13	0
	0
	0
	0
	0
	0
	0
/FILE 2 BLOCK - SECTION B
UNIT.2	0
	077777
	0
	0
	0
	0
	0
	0
	0
	0
	0
	0
/
	.TITLE FILE 3 DESCRIPTOR SET.
/
/
	0	/DTDIR3		/DIRECTORY 3 POINTER
	0	/DTDIR3-1		/DIRECTORY 3 POINTERS-1 (FOR LOADING C.A.)
	0	/DTDIR3+203
	0	/DTBUF3-1		/DTA BUF 3 POINTER-1
	0	/DTBUF3		/DTA BUF 3 POINTER
	0	/DTBUF3+3
	0	/DTBUF3+203
	0	/DTBUF3+377		/FILE 3 DATA LINK POINTER
/
/
/
G01	DT3BIT		/FILE 3 BIT MAP POINTER
G02	DT3SAV		/NEW DIRECTORY ENTRY POINTER
G03	377
G04	XX
G05	0
G06	0
G07	0
G08	0
G09	0
IOSW.3	0
G11	0
SKNT.3	0
	0
	0
	0
	0
	0
	0
	0
	0
/
/
/FILE 3 BLOCK - SECTION B
UNIT.3	0
	077777
	0
	0
	0
	0
	0
	0
	0
	0
	0
	0
/
	.TITLE COMMON STORAGE
/
TEMPD1	0	/POINTER TO USER LINE BUFFER USED BY
/THE .READ ROUTINE WHEN AND ONLY WHEN THE USER KEEPS
/.READING AFTER AN EOF( 1005,776773) HAS BEEN PASSED 
/TO HIM
/
/
DLFAKE	DTFAKE			/POINTER TO EMPTY FILE NAME
ARGP	0			/ENTRANCE ARG. POINTER
DTCCA	0			/CURRENT ADDR. (C.A.) POINTER FOR TRANSFER
CALP	0			/USER CAL POINTER
TEMP1	0	/TEMP STORAGE.
TEMP2	0	/TEMP STORE
DTDMOD	0			/DATA MODE (15-17)
DTHPTS	0			/DTA BUF. LINE HEADER POINTER
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)
DTUHP	0			/USER LINE BUF. HEADER POINTER
UND	0			/I/O UNDERWAY SWITCH,NOT 0=BUSY,0=NOT BUSY
DTWC	0			/2'S COMP TRANSFER WORD COUNT
WRWT	0			/CONTINUED I/O SWITCH (NON 0=CONT),0=DONE)
DLEOFH	DTEOFH			/EOF HEADER POINTER (FOR .CLOSE)
DTCKSM	0		/LINE CHECKSUM
TEMP0	0	/TEMP STORE.
DTSAFE	0		/BLOCK # SAFE STORAGE DURING TRANSFER
DADSIZ	0		/FILE BLOCK RELATIVE POSITION
DTEOTZ	0		/DOUBLE END ZONE SWITCH(0=SET,-1=CLEAR)
DTSAFD	0		/SAFE STORAGE FOR DIRECTION SWITCH
DTWPC	0		/WORD PAIR COUNT
DLIT0	0
DLIT1	1
DLIT2	2
DLIT3	3
DLIT4	4
LDASZ	DASIZE		/LIT
LDBSZ	DABSIZ		/LIT
LDBSZ2	DABSZ2		/LIT
/
	.IFDEF DT1511
/
/ TASK CONTROL BLOCK (TCB) FOR  15/11 CONFIG.
/
/ THIS INFORMATION IS PASSED ON TO THE DRIVER IN THE 11
/
TCBP	TCB
TCB	44*400+001	/TRAP ADDRESS =44, API LEVEL =1
	3+0		/DEVICE CODE =3, FUNCTION CODE =0
TEV	000000		/TASK EVENT VARIABLE (NOT USED BY HANDLER)
DTBLN	000000		/BLOCK #
DTSTAD	000000		/STARTING ADDRESS
	000000		/	-"-		(16-LSB)
DTWCT	000000		/WORD COUNT
DTUNFN	000000		/CONTROL REGISTER (DIR.+UNIT+FUN.+GO)
DTST	000000		/STATUS REGISTER
DTERRC	000000		/PARITY/TIMING ERROR RETRY COUNT
	.ENDC
/
	.END
