	.TITLE DKA.
 
/ .... EDIT #11 .... 2 JUN 70
/ .... EDIT #11A .. 19 OCT 70 - BY PHIL M. OLYNYK
 
/M. SIFNAS 
/COPYRIGHT 1969, 1970 DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/BACKGROUND/FOREGROUND RB09 DISK HANDLER
/N FILES OPEN WHERE N MAY BE DEFINED AT ASSEMBLY TIME AS A
/
/PARAMETER ASSIGNMENT: DN=N
/DEFAULT ASSUMPTION: DN=20(OCT)
/
/CALLING SEQUENCE:
	/CAL+.DAT SLOT(9-17)
	/FUNCTION
	/N ARGUMENTS(F OF FUNCTION)
	/NORMAL RETURN
/IF DKA. IS ASSEMBLED WITH RESMON, TTA. WILL BE DEFINED.
	.IFUND TTA.
	.GLOBL	DKA.
DK.PI=0			/CONDITIONALIZE IN BOTH
DK.API=0			/PI AND API CODE.
	.ENDC
	.IFDEF TTA.
	.LOC .+3&77774
	.IFDEF PI
DK.PI=0			/CONDITIONALIZE IN PI CODE ONLY.
	.ENDC
	.IFUND PI
DK.API=0			/CONDITIONALIZE IN API CODE ONLY.
	.ENDC
	.ENDC
.MED=3
/IOT ASSIGNMENTS
DSLW=707124		/CLEAR AND LOAD WC (2'S COMP) FROM AC
DSLM=707142		/CLEAR AND LOAD CORE ADDR. FROM AC
DSLD=707104		/CLEAR AND LOAD TK.,SECT.ADDR FROM AC
DSCS=707141		/CLEAR STATUS
DSLS=707144		/LOAD STATUS(BITS 0-8),9-17=0; 0-5 ALSO=0
DSSF=707121		/SKIP ON DONE OR ERROR FLAG
DSRS=707132		/CLEAR AC, READ STATUS (BITS 0-8) INTO AC
IDX=ISZ
	.IFUND DN
DN=20			/16 FILES OPEN
	.ENDC
DELTA=5
	.IFUND .SCOM
.SCOM=100
	.ENDC
	.EJECT
DKA.	JMS	DKSWAP		/(0) SWAP LIVE AND BACKUP CELLS
	0		/(1) FORE BUSY CELL (NON 0=BUSY:-.DAT SLOT#)
	0		/(2) BACK BUSY CELL
	0		/(3) FORE .CLOSE CELL (NON0=.CLOSE OR .OPER)
			/WHERE DKA. PLACES .OPER "AC"+1 IN .CLOSE CELL
	0		/(4) BACK .CLOSE CELL
DKSWCH	XX		/(5) ION OR IOF (PIC STATE ON INTERRUPT
			/OR CAL ENTRIES)
DKWRD6	XX		/(6) ION, IOF OR DBR (CAL/INTERRUPT LEVEL
			/SWITCH: DBR IF INTER.; SAME AS WD 5
			/IF CAL LEVEL
DKTOUT	XX		/(7) RETURN POINTER (INTER. LEVEL: INTER-
			/RUPTED ADDR.; CAL LEVEL: RETURN CELL
			/AFTER CAL ARGUMENTS
/START OF BACKUP DATA CELLS
DBACK=.
	XX		/(10) JMP FUNCTB
	XX		/(11) USER CAL IN PROGRESS:0=FORE; 1=BACK
	XX		/(12) .DAT SLOT#(18 BIT NEG., IF NEG.)
	XX		/(13) BITS 0-2: UNIT#
			/ BITS 3-17: ADDR OF CAL FOR .MED EXITS
	XX		/(14) .INIT - FILE TYPE:0=INPUT; 1=OUTPUT
			/ .READ,.REALR - DATA MODE
			/ .WRITE,.REALW-  "    "
			/	0=IOPS BIN
			/	1=IMAGE BIN
			/	2=IOPS ASCII
			/	3=IMAGE ALPHA
			/	4=DUMP(5,6,7 MAY APPEAR, BUT ILLEGAL)
			/ .MTAPE-.MTAPE FUNCTION (0-17)
			/ .TRAN - DIRECTION (0-3)
			/ .OPER - SUBFUNC (1-3)
	XX		/(15) .INIT - USER RESTART ADDR.
			/ .READ ,.REALR - LINE BUFFER
			/ .WRITE,.REALW - ADDRESS
			/ .OPER,.ENTER, - ADDR.OF DIRECTORY
			/ .SEEK - ENTRY BLOCK
			/ .TRAN - CORE ADDR.
	XX		/(16) .INIT - ADDR. FOR BUFF. SIZE
			/ .READ,.REALR - LINE BUFFER W.C.(CAL)
			/ .WRITE,.REALN - "     "     "  (FROM
			/ W.P.C. EXCEPT DUMP MODE - (WPC*2)
			/ W.P.C. EXCEPT DUMP MODE - (WPC*2)
			/ .TRAN - WORD COUNT
	XX		/(17) .TRAN - DEVICE ADDR. (BLK.#)
			/ .FSTAT - ADDR. FOR DIRECTORY CODE
			/ .REALR,.REALW - COMPLETION RETURN
			/ ADDR.; BIT 0-2: PRIORITY LEVEL
			/ .READ,.WRITE -0
/BACKUP DATA CELLS END WITH WD.17
	.EJECT
/FUNCTION DISPATCH TABLE
	JMP	DKIN	/(20) .INIT - 1
	JMP	DKOPER	/(21) .OPER -2
	JMP	DKSEEK	/(22) .SEEK - 3
	JMP	DKENTR	/(23) .ENTER - 4
	JMP	DKCLER	/(24) .CLEAR - 5
	JMP	DKCLOS	/(25) .CLOSE - 6
	JMP	DKMTAP	/(26) .MTAPE - 7
DREAD	JMP	DKREAD	/(27) .READ(.REALR)-10
DWRITE	JMP	DKWRIT	/(30) .WRITE(.REALW)-11
	XX		/(31) .WAIT,.WAITR-12(BY CAL HANDLER)
	JMP	DKRAN	/(32) .TRAN-13
DSCM35	XX		/(33) .SCOM+35 STORAGE
	DFSTOP		/(34) 15 BIT ADDR OF SUB TO STOP F I/O
	DBSTOP		/(35) 15 BIT ADDR OF SUB TO STOP B I/O
	-1		/(36) HANDLER I.D. CODE (MUST BE 0)
/I.D. CODE IN CELL (36) IS TEMPORARILY -1 FOR
/FIELD TEST VERSION TO ALLOW .INIT INTO DKA.
/START OF LIVE DATA CELLS (SEE 10-17 ABOVE)
DLIVE	XX		/L10
	XX		/L11
	XX		/L12
	XX		/L13
DKRWAY	XX		/L14
	XX		/L15
	XX		/L16
DKWD17	XX		/L17
DSWCT=DLIVE-.		/LIVE CELL COUNT
DSCM56	0		/.SCOM+56 STORAGE (GETBUF POINTER)
	.EJECT
/END OF LIVE DATA CELLS
DKER06	LAW	6	/ILLEGAL FUNCTION FOR HANDLER:.ERR 006
	STL		/L=1=TERMINAL ERROR
DKEROR	DAC	DERLAW
	SZL		/NON TERMINAL ERROR,
	DSCS		/CLEAR STATUS (TERMINAL)
	LAC	DLIVE+1	/USER:0=F;1=B
	SZA
	LAC	(3000	/BIT7=1=B
	XOR	(1000	/BIT8=1=F
	SZL
	XOR	(4000	/BIT6=1=TERMINAL
	XOR	DERLAW
	DAC	DERLAW
	LAC*	(.SCOM+66	/MONITOR ERROR ROUTINE POINTER
	DAC	DERTEM
	.IFDEF DK.API
	LAC	(400200
	ISA		/RAISE TO LEVEL 0
	.ENDC
	.IFDEF DK.PI
	IOF		/PIC OFF
	.ENDC
	.EJECT
DERLAW	XX		/ERROR CODE
	JMS*	DERTEM
DERPNT	XX		/CAL ADDR.,STATUS,ETC-TO BE PRINTED WITH ERROR
	.IFDEF DK.API
	DBK
	.ENDC
	.IFDEF DK.PI
	ION
	.ENDC
	JMP DKEMPT	/I/O REQ. DONE
DERTEM	0		/TEMP FOR ERROR ROUTINE POINTER
/DKA INTERRUPT SERVICE
DKPIC=.
	.IFDEF DK.PI
	.IFUND DK.API
DKINT=.
	.ENDC
	DAC	DKSVAC		/SAVE AC
	LAC*	(0
	DAC	DKMPOT		/SAVE PC,L,EM,MP IN TEMP.
	LAC	DKION
	.IFDEF DK.API
	JMP	DKSTON
	.ENDC
	.ENDC
	.IFDEF DK.API
DKINT	JMP	DKPIC		/PIC ENTRY
	DAC	DKSVAC		/API  "   ,SAVE AC
	LAC	DKINT		/PC,L,EM,MP
	DAC	DKMPOT		/TEMP.
	.IFDEF DK.PI
	DZM	DKINT		/0=API ENTRY
	.ENDC
	IORS			/READ I/O STATUS
	SMA!CLA
	LAW	17740		/PIC OFF - BUILD IOF
	TAD	DKION		/PIC ON -    "   ION
	.ENDC
DKSTON	DAC DBRLIT+1
	DSRS		/READ DISK STATUS
	DSCS		/CLEAR DISK STATUS
	XCT	DBRLIT+1	/ION OR IOF (STATE BEFORE INTERRUPT) FOR OTHER DEVICES TO INT. IF ION
	DAC	DKSTAT	/TEMP STORE STATUS
	.EJECT
/NOW CHECK SWITCHES: DNOIO (-1 IF IGNORE PHONY INTERRUPT);
/		  DKIGNR (-1 IF BGRD I/O LEFT GOING WHILE
/			FGRD CALL BEING HONORED)
	LAC DKIGNR	/BGRD I/O GOING SW.
	RAR		/SAVE IN LINK
	LAC DNOIO		/IGNORE PHONY INTERR. SW.
	DZM DNOIO
	DZM DKIGNR
	DZM	DKABRT	/MOD BY PMO - 10 19 70
	SNL!SMA		/SKIP ON "OR" CONDITION
	JMP DKSTOY	/NEITHER SET: NORMAL INTERR.
	SNL!CLA		/L=1 IF DKIGNR WAS SET
	JMP DBDSET	/GET OUT; ONLY DNOIO WAS SET
/IF STATUS INDICATES NO ERRORS,
/DBDONE WILL BE SET (NON-0)
/TO TAKE ADVANTAGE OF TRANSFER DONE RATHER THAN AUTOMATICALLY
/RESTARTING BGRD I/O
	LAC	DKSTAT	/EF SET?
	SPA!CLC		/NO
	CLA		/YES, IGNORE TRANSFER
DBDSET	DAC DBDONE	/0(CLEAR) IF ERROR;NON 0 IF DONE AND OK
	LAC DKSVAC	/RESTORE INTERRUPTED AC
DBRLIT	DBR
	XX		/ION OR IOF (STATE BEFORE INTERRUPT)
	XCT .+1
	XCT .+1
	JMP* DKMPOT	/EXIT
	.EJECT
/CONTROL COMES HERE FOR NORMAL INTERRUPT
DKSTOY	LAC	DKMPOT		/PC, ETC
	DAC	DKTOUT		/REAL EXIT = DKA.+7
	LAC	DBRLIT+1		/ION OR IOF
	DAC	DKSWCH		/.DKA+5
	LAC*	(.SCOM+35
	DAC	DSCM35
	CLA!CMA
	DAC*	(.SCOM+35
	.IFDEF DK.PI
	.IFDEF DK.API
	LAC	DKINT
	SZA			/API ENTRY
	.ENDC
	DZM*	(0		/PIC ENTRY
	.ENDC
	LAC	DBRLIT
	DAC	DKWRD6		/SETUP WD6 (DBR) FOR EXIT
	LAC	DKSTAT		/DISK STATUS
	SPA!RTL			/DONE. OK
	JMP	DTERT		/ERROR
/RB09 STATUS REGISTER:
/	0=ERROR FLAG (OR OF BITS 1,2,3,4)
/	1=PARITY ERROR (ONLY ERROR WHICH DOES NOT RESET BUSY BIT(7)
/	2=ILLEGAL DISK ADDR. (NON-EXISTENT OR PROTECTED)
/	3=TIMING OR DATA MISS
/	4=NOT READY (HARDWARE FAILURE)
/	5=DONE FLAG
/	6=INTERRUPT ENABLE (1)
/	7=BUSY OR GO (1)
/	8=READ/WRITE BIT (0=READ, 1=WRITE)
/PHYSICAL DATA TRANSFER IS COMPLETED, TOTAL I/O REQ. MAY NOT BE
/CHECK TO SEE IF BLOCK WAS DIRECTORY
/WE ALSO COME HERE FROM DKNORS
DKRDWT	LAC	DKSAFE		/BLK 100? (TK3, SECT.13)
	AND	(7777
	TAD	(-1426)
	SNA			/NO
	LAC	DKDRGT		/GET DIR SWITCH SET
	SZA!CLC			/YES-CLEAR
	JMP	DKRWEN
	DAC	DKDRGT
	LAC	DLIVE+3		/UNIT#(BITS 0-2)
	AND	(700000
	DAC	DKNCOR		/SET DIR. INCORE SWITCH
	.EJECT
/SEE IF THERE IS ANY MORE TO DO FOR THIS REQUEST
DKRWEN	LAC DKWRWT	/MORE TO DO FOR THIS REQUEST?
	DZM DBDONE	/CLEAR BGRD DONE SW.
	SNA
	JMP DKEMPT	/REQUEST COMPLETED
	XCT DKWRWT	/CONTINUE PRESENT REQ. (JMP X)
/SUBR. TO CLEAR OUT TABLE DBPT AND .BFTAB,CLEAR BUSY, AND CLOSE SW.
/L=0=FGRD STOP
/L=1=BGRD STOP
DZSTOP	0
	CLA!RAL
	DAC DZT3		/0=F;1=B
	LAC DBPT		/DBPT TABLE COUNT
	DAC DZCNT
	LAC LDBPT1	/DBPT TABLE POINTER
	DAC DZPNT
DZCK	LAC DZT3
	RAR		/USER INTO LINK
	LAC* DZPNT	/PICK UP DBPT ENTRY
	SNA		/MAY NEED CLEARING
	JMP DZNDEX	/NEXT ENTRY
	DAC DZT1		/BUFFER POINTER
	TAD (2
	DAC DZT2		/.BFTAB POINTER
	LAC* DZT2
	DAC DZT2
	LAC* DZT2		/.BFTAB ENTRY (BIT0=0=F;0=1=B)
	SZL!SPA		/(AND SKIP)
	CML!CMA
	SZL!SPA
	JMP DZNDEX	/NO, ONLY CLEARED IF F+F OR B+B
	LAC* DZT2
	AND (200000
	SNA		/IN USE, CLEAR IT
	JMP DZNDEX
	XOR* DZT2
	DAC* DZT2
	DZM* DZT1		/CLEAR .DAT SLOT
	IDX DZT1
	DZM* DZT1		/CLEAR USER
	IDX DZT1
	DZM* DZT1		/CLEAR .BFTAB POINTER
	DZM* DZPNT	/CLEAR DBPT POINTER
	.EJECT
DZNDEX	IDX DZPNT
	ISZ DZCNT
	JMP DZCK		/CHECK NEXT ENTRY
	LAC DZT3		/0=F; 1=B
	TAD (DZM DKA.+1	/DIRECTLY CLEAR BUSY FLAG
	DAC .+3
	TAD (2
	DAC .+2
	XX
	XX		/DIRECTLY CLEAR CLOSE SWITCH
	JMP* DZSTOP
DZCNT	0
DZPNT	0
DZT1	0
DZT2	0
DZT3	0
/ERROR FLAG CODE
DTERT	SZL!SPA
	JMP DPART		/PARITY OR ILL. DISK ADDR.
	RTL
	SMA		/NOT READY, DISK FAILURE
	JMP DRETRY	/TIMING ERROR
	LAC DKSTAT	/DISK STATUS
	DAC DERPNT	/IN DERPNT INSTEAD OF CAL ADDR
	LAW 20		/DISK FAILURE
	JMP DKEROR-1
DPART	SMA		/ILL. DISK ADDR.
	JMP DPARIT
	LAW 21		/ILL. DISK ADDR.
	JMP DKEROR-1
DPARIT	ISZ DKERCT	/IF OVERFLOW, TAKE DATA ANYWAY
	SKP
	JMP DKRDWT	/ACCEPT DATA AFTER 8 TRIES
DRETRY	JMS DKSIOT	/REISSUE DISK TRANSFER
	JMP DKNOR		/INTERR SERV. EXIT TO CONT. I/O
	.EJECT
/STOP I/O SUBR'S
/FOREGROUND STOP SUBR.
DFSTOP	0
	.IFDEF DK.API
	LAC (400200	/RAISE TO API LEVEL 0
	ISA
	.ENDC
	.IFDEF DK.PI
	IOF		/PIC OFF
	.ENDC
	LAC DKA.+1	/F BUSY?
	SNA!CLL
	JMP DFSTP1	/NO
	JMS DKSTOP	/STOP F I/O
DFSTP1	JMS DZSTOP	/CLEAR F BUFFERS (LINK MUST=0)
	.IFDEF DK.API
	DBK
	.ENDC
	.IFDEF DK.PI
	ION
	.ENDC
	JMP* DFSTOP
/BACKGROUND STOP SUBR
/ONLY IF BUSY AND RUNNING
DBSTOP	0
	.IFDEF DK.API
	LAC (400200
	ISA
	.ENDC
	.IFDEF DK.PI
	IOF
	.ENDC
	LAC DKA.+2	/B BUSY?
	SNA!STL
	JMP DBSTP1	/NO
	LAC DLIVE+1	/B RUNNING?
	SNA!CLA!STL
	JMP DBSTP1	/NO,
	JMS DKSTOP	/STOP B I/O IF UNDERWAY
DBSTP1	JMS DZSTOP	/CLEAR B BUFFERS (LINK MUST=1)
	.IFDEF DK.API
	DBK
	.ENDC
	.IFDEF DK.PI
	ION
	.ENDC
	JMP* DBSTOP
	.EJECT
/DBEX: SUBR. TO SEE IF ACTIVE BUFF. IS ONE WANTED
/IF NOT, DBEX SWAPS IN RIGHT ONE USING SUBR. DRESBF
/AND SWAPS OUT WRONG ONE
/CALLING SEQUENCE:
/	JMS	DBEX
/	XX			/BUFFER OK RETURN
/	XX			/NOT FOUND RETURN
/DBEX USES DKEMP, DKEMP1, DKEMP2, DKEMP3, DKEMP4
/WHERE DKEMP3 POINTS TO FOUND ENTRY
/DKEMP4 POINTS TO AVAILABLE ENTRY SLOT IF NO ENTRY FOUND
DBEX	0
	LAC	DLIVE+2		/IS .DAT SLOT SAME AS ACTIVE ONE?
	SAD	DSLOT
	SKP!CLL			/YES, CHECK B/F
	JMP	DBCHEK		/NO, CHECK BUFFER ASSIGNMENT
	LAC	DLIVE+1		/0=F; 1=B
	SAD	DUSER
	JMP*	DBEX		/SAME USER, SAME .DAT SLOT, NO SWAP
DBCHEK	LAC	DLIVE+1		/L ALREADY=0
	RTR			/S=1 IF B
	TAD	(DBUFSZ+500
	DAC	DGBUF+1		/SET UP BUFF SIZE FOR CALL TO GETBUF
	LAC	DBPT
	DAC	DKEMP		/SET UP BUFF TABLE COUNT
	LAC	LDBPT1
	DAC	DKEMP1
	LAC	(JMP DBC4		/JMP DBC4- UNTIL EMPTY SLOT IS FOUND
	DAC	DBC2
	DZM	DKEMP4		/CLEAR EMPTY SLOT POINTER
DBC1	LAC*	DKEMP1
	SNA
DBC2	XX			/JMP DBC4 OR JMP DBC3
	DAC	DKEMP2		/BUFF. ADDR. POINTER
	DAC	DKEMP3
	LAC*	DKEMP2		/SAME .DAT SLOT?
	SAD	DLIVE+2
	SKP			/YES, CHECK B/F
LJDBC3	JMP	DBC3		/NO
	IDX	DKEMP2		/INDEX TO BF CELL
	LAC*	DKEMP2		/SAME USER?
	SAD	DLIVE+1
	JMP	DBSWAP		/ALREADY HAVE BUFFER, SWAP IN
DBC3	IDX	DKEMP1
	ISZ	DKEMP
	JMP	DBC1
	LAC	DKEMP4		/FREE ENTRY POINTER
	IDX	DBEX
	SZA			/FILE CAPACITY OVERFLOW
	JMP*	DBEX		/NOT FOUND
	JMP	DKER17		/.ERR 17
	.EJECT
/FREE ENTRY SLOT FOUND
DBC4	LAC	DKEMP1		/SAVE FREE ENTRY POINTER
	DAC	DKEMP4
	LAC	LJDBC3		/JMP DBC3
	DAC	DBC2
	JMP	DBC3
DBSWAP	LAC	DKEMP3		/POINTER TO INCOMING BUFFER
	JMS	DRESBF
	JMP*	DBEX
/DRESBF=SUBR. TO SWAP IN APPROP. BUFF. AREA
/AND SWAP OUT ACTIVE AREA IF MEANINGFUL
/CALLING SEQUENC:
/	AC=NEW BUFF. AREA POINTER
/	JMS	DRESBF
/LINK USED IN SUBR. TO DETERMINE SWAP OUT
/DRESBF USES DKEMP4, DKEMP1, DKEMP2, DKEMP3
DRESBF	0
	DAC	DKEMP4		/TEMP. STORE NEW BUFF. POINTER
	LAC	DBUFAD		/ACTIVE AREA MEANINGFUL?
	SZA!CLL
	STL			/L=1=MEANINGFUL, SO SWAP
	DAC	DKEMP1
	LAC	DBPNT		/(DBUFF
	DAC	DKEMP2
	LAW	-DBUFSZ
	DAC	DKEMP3
DRES1	LAC*	DKEMP2		/ACTIVE AREA
	SZL			/DO NOT SWAP OUT
	DAC*	DKEMP1		/DO SWAP OUT
	LAC*	DKEMP4		/SWAP NEW AREA IN
	DAC*	DKEMP2		/ACTIVE AREA
	IDX	DKEMP4
	IDX	DKEMP1
	IDX	DKEMP2
	ISZ	DKEMP3
	JMP	DRES1
	JMP*	DRESBF
	.EJECT
/DDZM=SUBR. TO ZERO OUT BLOCK OF CELLS
/CALLING SEQUENCE
/	AC=-BLOCK COUNT
/	JMS	DDZM
/	XX			/BLOCK POINTER
/SUBR. USES DKEMP2, DKEMP1
DDZM	0
	DAC	DKEMP2		/COUNT
	LAC*	DDZM		/GET BLOCK POINTER
	IDX	DDZM		/INDEX TO EXIT
	DAC	DKEMP1
	DZM*	DKEMP1
	IDX	DKEMP1
	ISZ	DKEMP2
	JMP	.-3
	JMP*	DDZM
/.INIT DISK ROUTINE
DKIN	LAC	(377		/255(10)--RETURN STANDARD LINE BUFFER SIZE
	DAC*	DLIVE+6		/TO USER (CELL 16)
/
/ONCE ONLY CODE TO .SETUP API CH. ADDR. AND SKIP CHAIN
/AFTER 1ST .INIT THESE CELLS ARE USED FOR TEMP STORAGE
DKONCE	LAC*	(.SCOM+55		/.SETUP POINTER
DKERCT	DAC	DKEMP
DKMPOT	JMS*	DKEMP		/.SETUP API CH. REG. 47
DKSVAC		DSSF		/RB09 DISK DONE OR ERROR FLAG
DKIOAC		DKINT		/INTERR. SERV. ADDR.
DKSTAT	LAC	DBPT		/-DN
DKBCA	JMS	DDZM		/INIT BUFFER TABLE TOO
LDBPT1	.DSA	DBPT+1
DKCT	LAC* (.SCOM+56		/GETBUF POINTER
DKCT1	DAC DSCM56
DKCT2	LAC (JMP .+2
DKSAFE	DAC	DKONCE
/
/ONCE ONLY CODE ENDS HERE
	JMS DBEXAB		/GET A BUFFER FOR THIS FILE
	LAC DLIVE+4
	DAC DKIOSW		/INPUT=0;OUTPUT=1
	JMP DKEMPT		/DONE, EXIT
DBUFFX	LAC	D.BFTP		/.BFTAB ENTRY ADDR.
	DAC	DKEMP
	IDX	DKEMP
	JMP	DBUFCR		/INIT NEW BUFF
	.EJECT
/CALL MONITOR GETBUF SUBR.
/CALLING SEQ.:
/	JMS DBRBUF
/	XX			/RETURN WITH BUFF. INITIALIZED
/AUTO INIT SUBR.
DBEXAB=.
DBRBUF	0
	JMS	DBEX		/SUBR. TO SWAP IN BUFF. IF NECESSARY
	JMP	DBUFFX		/EXIT FORBUFFER IN, SET UP TO INIT IT
/NO BUFF ASSIGNED, GET ONE
/DKEMP4 POINTS TO EMPTY DBPT SLOT
	.IFDEF DK.API
	LAC	(400200		/RAISE TO API LEVEL 0
	ISA
	.ENDC
	IOF			/PIC OFF
DGBUF	JMS*	DSCM56		/.GETBUF
	XX			/REQUIRED BUFF SIZE; S=1=B,S=0=F;SET IN DBEX
	SNA			/BUFFER AVAILABLE FROM MONITOR
	JMP DKEMPZ		/NO BUFF, EXIT (MSG ALREADY OUT)
	DAC	DKEMP		/AC=ADDR OF BFTAB ENTRY ON RETURN
	IDX	DKEMP		/POINTER TO BUFFER ADDR.
	LAC*	DKEMP
	DAC*	DKEMP4		/STORE IN DBPT
	.IFDEF DK.API
	DBK			/DEBREAK FROM LEVEL 0
	.ENDC
DKION	ION			/PIC ON
/SWAP IN APPROP. BUFF. TO ACTIVE BUFF. AREA+INITIALIZE
	JMS	DRESBF
	.EJECT
/ROUTINE TO CLEAR AND INITIALIZE BUFFER POINTERS
DBUFCR	LAW	-DBUFSZ
	JMS	DDZM		/CLEAR NEW BUFFER AREA VARIABLES
DBPNT	.DSA	DBUFF
/INIT. BUFFER VARIABLES
	LAC	DLIVE+2		/.DAT SLOT
	DAC	DSLOT
	LAC	DLIVE+1		/USER
	DAC	DUSER
	LAC*	DKEMP		/BUFFER ADDR.(EXTERNAL)
	DAC	DBUFAD
	TAD	(DBUFSZ		/POINTER TABLE SIZE
	DAC	DLMBIT		/FILE BIT MAP POINTER
	DAC DLMCL		/DDZM POINTER
	TAD	(40
	DAC	DLTDIR		/DIRECTORY BIT MAP POINTER(DKDIR)
	TAD	(40
	DAC	DLTBUF		/DATA BUFFER POINTER(DKBUF)
	TAD (3
	DAC DLB003	/DKBUF+3
	TAD (35		/DKBUF+40
	DAC DKLB40
	TAD (337		/DKBUF+377
	DAC DKLINK
	LAC DLTDIR
	TAD (203
	DAC DLTSYS	/DKDIR+203
	TAD (40
	DAC DLB203	/DKBUF+203
	LAC (377
	DAC DKROOM	/INIT DUMP PARAMETER
	LAW -40
	JMS DDZM		/DZM FILE BIT MAP
DLMCL	XX			/POINTER TO AREA TO BE CLEARED
	CLC
	DAC DKDRGT	/CLEAR DIR. SEARCH SW.
	TAD	DKEMP		/.BFTAB ENTRY ADDRESS
	DAC	D.BFTP
	DAC	DKNCOR		/CLEAR DIR IN CORE SWITCH
	LAC	DBUFAD		/BE SURE REAL BUFFER (POINTERS)
	JMS	DRESBF		/MATCH INTERNAL DKA. BUFFER
	JMP*	DBEXAB
	.EJECT
/FOR SHARED DEVICES, WHEN I/O REQUEST COMPLETED,
/CONTROL COMES HERE TO DETERMINE WHETHER SWAP OF
/BACKUP AND LIVE CELLS IS REQUIRED;
/BGD I/O WILL BE STARTEDIF WAITING TO START (BOTH DKIGNR AND DBDONE=0)
/IF BGRD I/O GOING BUT NO INT. YET (DKIGNR=-1), DKNOR (COMMON CAL AND INTERR. EXIT)
/IF BGRD I/0 GOING AND DONE (DBDONE=NON-0), GO TO DKRDWT
/		TO FINISH BGRD INT. SERV.
DKNORS	LAC	DKA.+2		/B BUSY FLAG ON?
	SNA			/YES
	JMP	DKNOR		/NO
	LAC	DKBCLR		/IS IT SET UP TO CLEARED(DKBCLR=NOP)?
	SAD	DKLNOP		/NO
	JMP	DKNOR		/YES
/BGRD I/O HAS BEEN DEFERRED UNTIL COMPLETION OF FGRD I/O
/BACKUP (BGRD) DATA CELLS MUST BE SWAPPED INTO LIVE DATA CELLS
	JMS DSWON		/JUST SWAP LIVE AND BACKUP CELLS
DKNORT	JMS DBEXAC	/SWAP BUFFERS
/BGRD I/O WILL NOT BE STOPPED UNLESS FGRD MUST ACCESS DISK
	.IFDEF DK.API
	LAC	(400200		/RAISE TO API LEVEL0
	ISA			/PROTECTED HERE ONLY BECAUSE DKSWAP UNPROTECTS
	.ENDC
	IOF			/PIC OFF
	LAC	DKIGNR		/BGRD I/O SW. GOING SET?
	DZM	DKIGNR
	SZA			/NO, EITHER DONE OR NOT STARTED
	JMP	DKNOR		/YES, GOING AND STILL TRANSFERRING
	.IFDEF DK.API
	DBK			/DEBREAK FROM LEVEL 0
	.ENDC
	ION
	LAC	DBDONE		/BGRD DONE SW. SET?
	SZA			/NO, START IT UP
	JMP	DKRDWT		/YES, FINISH INTERR. SERVICE FOR BGRD.
	XCT	DLIVE		/START BGRD I/O (JMP FUNCTB)
DKNOR	LAC*	(.SCOM+54		/ADDR OF CALL4
	DAC	DKTMP1
	.IFDEF DK.API
	LAC	(400200		/RAISE TO API LEVEL 0.
	ISA
	.ENDC
DKIOF	IOF
	LAC	DKWRD6
	SAD	DBRLIT
	SKP			/INTERR.
	JMP	DKT.6		/CAL
	JMS*	DKTMP1
	.DSA	DKA.+7		/DKTOUT
	.DSA	DSCM35		/TEMP FOR .SCOM+35
DKT.6	LAC	DSCM35		/RESTORE IN INTERRUPT
	DAC*	(.SCOM+35		/HANDLER FLAG.
DKFCLR	SKP			/NOP IF FLAG TO BE CLEARED
	DZM	DKA.+1		/FOREGROUND BUSY FLAG.
DKBCLR	SKP			/NOP IF FLAG TO BE CLEARED
	DZM	DKA.+2		/BACKGROUND BUSY FLAG.
	LAC	DLSKP		/RESET
	DAC	DKFCLR		/SWITCHES.
	DAC	DKBCLR
	LAC	DKIOAC		/AC FOR IOT
	.EJECT
DKIOT	XX			/IOF OR IOT(DSCS!DSLS)
	LAC	DKSVAC		/RESTORE AC.
	.IFDEF DK.API
	DBK			/FROM LEVEL 0.
	.ENDC
	XCT	DKA.+5		/ION OR IOF
	XCT	DKA.+6		/ION OR IOF OR DBR
	XCT .+1
	XCT .+1
	JMP*	DKA.+7		/RETURN POINTER.
DKTMP1	0			/TEMP
/.OPER ROUTINE TO INTERPRET:
/.DLETE (SUBFUNCTION 1)
/.RENAME (SUBFUNCTION 2)
/.FSTAT (SUBFUNCTION 3)
DKOPER	JMS	DBEXAB		/SWAP BUFF CHECK - AUTO .INIT IF NOT DONE
	JMS	DKCKCL		/CHECK DIRECTORY FOR THIS FILE
	DAC	DKNXBK		/SAVE FOR AC=0ON NOT FOUND
	SNA
	JMP	DKFST		/NOT FOUND-RETURN WITH AC=0
	XCT	DKSK5		/PICK UP 1ST BLK OF FILE
	XOR	(400000
	DAC	DKNXBK		/CLEAR FILE COMPLETE BIT
	LAC	DLIVE+4		/SET UP SUBFUNTION DISPATCH(1-3)
	TAD	(JMP DKOPTB
	DAC	DKOPTB
	LAC	DLTDIR		/SETUP FOR TRAN OF
	DAC	DKBMPT		/DIR BIT MAP TO DIR ENTRY SECTION
	DAC	DKNCOR		/CLEAR DIR.IN CORE SW.
DKOPTB	XX
	JMP	DKLET		/1=.DLETE
	JMP	DKREN		/2=.RENAM
DKFST	LAC*	DKWD17		/3=.FSTAT
	XOR	(100000		/RETURN TYPE (1 IN 0-2)
	DAC*	DKWD17		/TO USER
	DZM	DKCLSS		/CLEAR FILE ACTIVE SW.
	LAC	DLIVE+1		/USER: F=0; B=1
	TAD	(DAC DKA.+3
	DAC	DKFSTX		/SETUP AC RETURN FOR .OPER IN .CLOSE SW
	LAC	(1		/ULTIMATELY:0 IF NOT FOUND OR 1ST BLK#
	TAD	DKNXBK 
DKFSTX	XX			/DAC DKA.+3 OR DKA.+4
	JMP	DKFEND		/I/O REQ. DONE - RELEASE BUFFER
/.RENAM ROUTINE
DKREN	DAC	DRENSW		/SET RENAME SW. FOR PROPER CLOSE
				/DKUDRP ALREADY SET UP IN DKSK1
	XCT	DKSK5		/GET 4TH WD OF OLD ENTRY
	XCT	DKNTR3		/SAVE IN DKESAV+6
	JMP	DKCLS6		/WRITE OUT NEW DIRECTORY
/.DELETE ROUTINE
DKLET	LAW	-4		/SETUP FOR DELETE
	JMS	DDZM		/DZM DK1SAV
DLSAV	.DSA	DK1SAV
	JMP	DKCLS3		/FILE BIT MAP+DIRECTORY
	.EJECT
/CHECK DIRECT. IN CORE SUBR.
/IF DIRECTORY IS NOT IN,INTERR.SERV. WILL RETURN
/TO DRET1 AFTER IT IS IN
DKDRCK	0
DRET1	LAC	DLIVE+3		/D IN ? (DKNCOR MUST MATCH UNIT # IN DLIVE+3, 0-2)
	AND	(700000
	SAD	DKNCOR		/NO
	JMP	DKDRC1		/YES - CHECK PARITY
	LAC	(JMP DRET1	/SET UP
	DAC	DKWRWT		/INTERRUPT RETURN
	JMS	DCALST		/SET UP CAL RETURN
	LAC	(13000		/READ PARAM
	JMS	DKDRIN		/BRING IN DIRECTORY
	JMP	DKNOR		/I/O REQ STARTED
DKDRC1	LAC	DKERCT		/DIRECTORY UNACCEPTABLE
	SZA			/WITH PARITY ERROR.
	JMP*	DKDRCK		/OK
DSET61	LAC	DLIVE+3		/PRINT UNIT # +
	AND	(700000		/OFFENDING BLK # (71 - 100)
	XOR	DKNXBK
	DAC	DERPNT
	LAW	61		/DIRECTORY OR FILE BIT MAP
	JMP	DKEROR-1		/TERMINAL ERROR.
/CALL IN DIRECTORY SUBR.
DKDRIN	0
	DAC	DKTR		/TRANSFER DIRECTION SWITCH
	LAC	DLT100
	DAC	DKNXBK		/BL# TO TRANSFER
	DZM	DKDTR		/TRANSFER FORWARD
	DZM	DKDRGT		/SET IND. TO SET DIR IN CORE SWITCH
	LAC	DKCLSS		/0 IF SEEK, ENTER
	SZA
	LAC	(40		/NOT 0 IF CLOSE (DKBUF
	TAD	DLTDIR		/(DKRDIR
DKDRN1	JMS	DKWCS		/SETUP WC,CA
	JMP*	DKDRIN
/DIRECTORY SEARCH SUBR.
DKSK1	0
	DAC	DKUDRR		/USER DIR. ENTRY POINTER
	DZM	DKDTR		/SET TRANSF. DIRECTION=FORWARD
DKSK2	CLC			/SYSTEM TAPE?
	XOR*	DLTSYS		/WD3 OF SYS BIT MAP
	SNA!CLA			/NO,56 FILES
	LAW	-30		/YES, 24 FILES
	SMA
	LAW	-70
	DAC	DKFPCT		/DIR. POINTER=DKDIR+40=DKBUF
	XOR	(777700
	DAC	DBLKLC		/50 IF 24;10 IF 56
	LAC	DLTBUF		/DIR. POINTER=DKDIR+40=DKBUF
DKSK3	DAC	DKDES		/ENTRY SECTION POINTER
	DAC	DKCURE		/CURR. ENTRY, WD0, POINTER
/NEXT FILE NAME ENTRY
	LAC	DKUDRR		/USER DIR. ENTRY POINTER
	DAC	DKUDRP
	LAW	-4
	DAC	DKCT1S		/MATCH COUNT
	DAC	DKCTS		/COUNT OF ENTRY WDS TO CHECK
	ISZ	DKCTS
	.EJECT
/NEXT WORD OF CURRENT ENTRY
DKSK5	LAC*	DKDES		/DKA DIR. ENTRY (.E.)
	SAD*	DKUDRP		/USER D.E.
	ISZ	DKCT1S		/WD N OF ENTRY SATCHES
	ISZ	DKDES		/NEXT WD OF DKA ENTRY
	ISZ	DKUDRP		/NEXT WD OF USER ENTRY
	ISZ	DKCTS		/ENTRY WD COUNT
	JMP	DKSK5		/CONT. MATCH CHECK
DKSK6	LAC	DKCURE
	ISZ	DKCT1S		/MATCH
	SKP			/N
	JMP*	DKSK1		/YES-CURRENT ENTRY POINTER IN AC
	TAD	(4		/INDEX TO NEXT ENTRY
	ISZ	DKFPCT		/INDEX FILE ENTRY CT.
	JMP	DKSK3		/NEXT ENTRY
	CLA
	JMP*	DKSK1		/YES-CAN'T FIND FILE NAME
/CLOSE FILE SUBR
DKCLOS	JMS	DBEX		/HAVE BUFFER?
	SKP			/YES. SWAPPED IN.
	JMS	DBEXAB		/XCT .GETBUF IN CASE OF .TRAN CLOSE
				/(NORMALLY, BUFFER PRESENT).
	LAC	DKIOSW		/I OR O
	SNA!CLC
DLFEND	JMP	DKFEND		/INPUT-CLEAR SWITCHES EXIT
	LAC	DKWREX		/WRITE EXECUTED AFTER .ENTER
	SZA!CLC			/CLC TO SET DKEOF
	JMP	DKCLS2		/YES
	JMS	DKCBIT		/NO-CLEAR BIT MAP
	JMP	DKFEND
DKCLS2	DAC	DKEOF		/SET EOF SWITCH(-1)
	DAC	DLIVE+6		/WC=-1
	LAC	(JMP DKCLS3
	DAC	DKWRWT		/SET UP INTERR. RETURN
	DZM	DLIVE+4		/FAKE DATA MODE = IOPS BIN
	LAC	DKFILE		/IF .MTAPE .CLOSE,
	SZA
	JMS	DKBUFC		/CLEAR BUFFER.
	LAC	(15000		/OUTPUT
	JMS	DKMCK
	LAC	DLEOFH		/EOF HEADER POINTER (DKEOFH
/FAKE ARG FOLLOWS
	LAW -1			/GET DIR IND. (0=GET)
	JMP	DKWRT1
DKCLS3	LAC	DKFILE		/IF .MTAPE,
	SZA
	JMP	DKFND1		/RELEASE BUFFER.
	LAC	(JMP DKCLS4	/SET INTERR. RETURN
	DAC	DKWRWT
	LAW	-50
	TAD	DBLKLC
	SNA!CLA			/NON 0 IF 56 ENTRIES
	LAW	-4
	TAD	DLIT77
	.EJECT
DKCLT	DAC	DKNXBK		/BIT MAP BLOCK #
	LAC	DKFPCT		/FILE COUNT
	TAD	(10
	DAC	DKFPCT
	SMA!CLC
	JMP	DKCLQ		/FILE BIT MAP IS IN THIS BLOCK
	TAD	DKNXBK		/DECR. BIT MAP BL# BY 1
	JMP	DKCLT		/TRY NEXT BLOCK BACK
DKCLQ	DZM	DKDTR		/SET TRANSF. DIRECT. SW. = FORW.
	JMP	DKSEK1		/READ BIT MAP BLOCK INTO DIR. BIT MAP
DKCLS4	LAC	(JMP DKCLS6	/SET INTER. RETURN
	DAC	DKWRWT
	LAC	DKERCT		/RETRY COUNT
	SNA			/OK IF SKIP
	JMP	DSET61		/PAR ERR IN FILE BIT MAP
	LAC	DKFPCT		/REL. BIT MAP POINTER
	CLL!RAL			/X 40
	RTL
	RTL
	TAD	DLTBUF		/(DKBUF
	DAC	DKOLBM
	DAC	DKXROL		/OLD BIT MAP ADDR.
	LAC	DLTDIR		/DIR. BIT MAP ADDR.
	JMS	DKXOR		/XOR OLD FILE BIT MAP INTO DIR. BIT MAP
	LAC	DLMBIT		/NEW FILE BIT MAP ADDR
	DAC	DKXROL
	LAC	DKOLBM		/OLD BIT MAP ADDR
	JMS	DKXOR		/XOR NEW INTO OLD BIT MAP
	LAC	(15000
	JMP	DKSEK2		/OUTPUT BIT MAP BLOCK
/SUBROUTINE TO XOR BIT MAP 1 INTO BIT MAP 2
/ALSO CLEARS BIT MAP 1 IF LINK = 0 ON ENTRY
DKXOR	0
	DAC	DKXRNW		/BIT MAP 2 ADDR
	LAW	-40
	DAC	DKCTS
DKXOR1	LAC*	DKXROL		/BIT MAP 1 POINTER
	XOR*	DKXRNW		/BIT MAP 2 POINTER
	DAC*	DKXRNW
	SNL!CLC			/DO NOT CLEAR BIT MAP 1, CLC FOR SETTING DKNCOR
	DZM*	DKXROL		/CLEAR BIT MAP 1
	ISZ	DKXROL
	ISZ	DKXRNW
	ISZ	DKCTS
	JMP	DKXOR1
	JMP*	DKXOR
	.EJECT
DKCLS6	JMS	DKDRCK		/LOAD DIRECTORY INTO DKBUF
	LAC	DKBMPT		/DK. BIT MAP POINTER
	DAC	DKCLRP		/NIT. DIR ENTRY SECT. POINTER
	LAW	-40		/DIR. ENTRY SECTION COUNT
	DAC	DKCT
	LAC	DLTBUF		/(DKBUF)
	DAC	DKCT1
DKCLS5	LAC*	DKCLRP		/TRANSFER DIR. BIT MAP
	DAC*	DKCT1		/TO FRONT OF DIR. ENTRY SECTION
	ISZ	DKCLRP
	ISZ	DKCT1
	ISZ	DKCT
	JMP	DKCLS5
	LAC	DRENSW		/RENAME SWITCH SET?
	SZA
	LAC	(3		/YES, PICK UP NEW NAME
	TAD	DLSAV		/(DK1SAV
	DAC	DKFIN
	LAC	DKCURE		/ADD 40 TO ACCOUNT FOR BLOCK MOVE
	TAD	(40
	DAC	DKCURE
	LAW	-4
	DAC	DKCT
DKCLS7	LAC*	DKFIN		/NEW FILE NAME (4 WDS)
	DAC*	DKCURE		/INTO DIRECTORY ENTRY SECTION
	ISZ	DKFIN
	ISZ	DKCURE
	ISZ	DKCT
	JMP	DKCLS7
	LAC	DLFEND		/SET INTERR. RETURN (JMP DKFEND
	DAC	DKWRWT
DKCL7A	LAC	(15000		/REWRITE DIRECTORY
	JMS	DKDRIN
	LAC	(JMP DKCL7A
	JMS	DCALST		/SET UP CAL RETURN
	JMP	DKNOR		/CONTINUE I/O EXIT
	.EJECT
DKFEND	LAC DKFILE	/IF .MTAPE,
	SNA!CLC		/NO DIRECTORY.
	DAC DKNCOR	/CLEAR DIR IN CORE SWITCH
/RELEASE BUFFER
DKFND1	LAC DKFILE	/IF .MTAPE,
	SZA
	JMP DKEMPT	/DON'T RELEASE BUFFER AFTER .CLOSE.
	LAC DBPT		/MAX FILE COUNT
	DAC DKEMP
	LAC LDBPT1	/BUFFER TABLE POINTER
	DAC DKEMP1
	LAC DBUFAD	/CLEAR BUFFER ADDR FROM DBPT
DKFSAD	SAD* DKEMP1
	DZM* DKEMP1	/MATCH - CLEAR
	IDX DKEMP1
	ISZ DKEMP
	JMP DKFSAD
	DZM DSLOT		/CLEAR .DAT SLOT POINTER
	DZM DBUFAD	/CLEAR BUFFER ADDR
	LAC* D.BFTP
	AND (577777
	DAC* D.BFTP	/CLEAR BIT 1 IN BUFTAB ENTRY
	JMP DKEMPT	/I/O REQ. DONE
/.TRAN ROUTINE
DKRAN	JMS DBEXAB	/BUFFERSWAP CHECK - AUTO .INIT
	LAC DLIVE+7	/BLK #
	JMS DKSET		/SETUP BL#, ETC
	LAC DLIVE+5	/CORE ADDR.
	JMS DKWCS		/SETUP CA AND START SEARCH.
	LAC DLIVE+6	/WC
	DAC DKWC		/SAVE IN CASE RETRY IS NECESSARY AT INT. LEVEL
	DSLW		/OVERRIDE -400 SET IN DKWCS
	LAC (JMP DKRAN+1	/SET UP CAL LEVEL RETURN
	JMS DCALST
	LAC DLFEND	/(JMP DKFEND
	DAC DKWRWT	/SET UP INTERR. RETURN TO RELEASE BUFFER
	JMP DKNOR		/COMMON EXIT - I/O STARTED
	.EJECT
/SUBROUTINE TO SET UP BLOCK #, TRANSFER DIRECTION
DKSET	0
	DAC DKNXBK
	LAC	DKRWAY		/TRANSFER DIRECTION(DLIVE+4)
	RTR
	SMA!CLC			/OUTPUT
	LAC	(11000		/INPUT
	XOR (2000
	AND (17000
	DAC	DKTR		/WRITE (15000) OR READ (13000)
	SZL!CLA			/FORWARD
DLM1	LAW -1
	DAC	DKDTR		/TRANSFER DIRECTION SWITCH
	JMP* DKSET
/SUBR TO SET .REALR OR .REALW SWITCH
DRLXEK	0
	LAC DKWD17	/REAL TIME READ OR WRITE?
	SNA		/YES, SET SW.
	JMP* DRLXEK
	LAC DLIVE+1	/0=F;1=B
	TAD (DRELR	/2 CELL SAVE AREA
	DAC DRELT		/TRMP
	DAC* DRELT
	JMP* DRLXEK
/SUBR. TO SET UP CAL LEVEL RETURN TO HANDLER
/FOR BGRD ONLY
/CALLING SEQUENCE
/	AC=JMP XX		/XX=RETURN POINT
/	JMS DCALST
DCALST	0
	DAC DCALTP	/TEMP
	LAC DLIVE+1	/0=F;1=B
	SNA
	JMP* DCALST	/F
	LAC DCALTP
	DAC DBCALR+1
	LAC (JMP DBCALR
	DAC DLIVE
	JMP* DCALST
DBCALR	JMS DBEXAC	/CHECK FOR BUFF. PRESENT
	XX		/JMP HANDLER CAL LEVEL RETURN
DCALTP	0		/TEMP
	.EJECT
/.MTAPE ROUTINE
 
DKMTAP	LAC	DLIVE+4		/.MTAPE FUNCTION
	SNA
	JMP	DKMREW		/REWIND (MOVE TAPE-BOT)
	SAD	(2
	JMP	DKBKSP		/BACKSPACE
	JMS	DBEX		/HAVE BUFFER?
/IGNORE OTHER .MTAPE FUNCTIONS.
	JMP	DKEMPT		/YES. EXIT.
	JMP	DKCLOS		/NO. GET ONE; THEN, RELEASE IT.
 
/.MTAPE BACKSPACE
 
DKBKSP	JMS	DBEXAC		/NO AUTO INIT
	LAC	WSW		/WSW=- IF LAST COMMAND WAS .WRITE
	DZM	WSW
	CLL!RAL			/DON'T CHANGE DKNXBK
	LAC	DKNXBK		/DECREASE BLK # BY 5
	SZL
	JMP	DKMRW1		/DON'T CHANGE DKNXBK
	TAD	DKDECR		/-5 IF FORW.; +5 IF REV.
	SAD	(2		/IF BLK 1,2,1075, TURN AROUND
	SKP
	SAD	(1
	SKP
	SAD	(1075
	SKP
	SPA			/IF <0, ASSUME TURN AROUND
	JMP	DKMTP2
	DAC	DKCT		/TEMP STORE
	TAD	(-1100
	SMA
	JMP	DKMTP2		/IF -, ASSUME TURN AROUND
	LAC	DKCT		/OK
	DAC	DKNXBK
	JMP	DKMRW1
DKMTP2	LAC	DKMPAS		/LAST BLK # OF LAST PASS
	TAD	(LAC DKMBAK
	DAC	.+1
	XX
	DAC	DKNXBK		/RESET CURRENT BLK #
	SNA
	JMP	DKMRW1
DFLPLT	JMS	DKMFLP
	LAC	DKDTR		/FLIP TRANSFER DIRECTION SWITCH
	CMA
	DAC	DKDTR
	LAW	-2
	TAD	DKMPAS
	DAC	DKMPAS
	JMP	DKMRW1
DKMFLP	0
	DAC	DKWCS		/SAVE ENTRY AC
	IDX	DKMPAS		/INDEX .MTAPE PASS COUNT
	JMS	DDIRAL		/FLIP DKDIRA
	CLC
	TAD	DKDECR		/-5 TO +5 OR VICE VERSA
	CMA
	DAC	DKDECR
	LAC	DKWCS		/RESTORE AC ON EXIT
	JMP*	DKMFLP
 
DKMBAK	0			/BACKSPACE TURN TABLE
	1077
	4
	1073
	3
DKMBAC	1076			/.MTAPE WRITE TURN TABLE
	6
	1070
	7
	777777			/EOF AFTER 1075 BLOCKS
 
/.MTAPE REWIND
 
DKMREW	JMS	DBEXAB		/AUTO INIT
	DZM	DKNXBK		/SET BLK # TO READ/WRITE=0
	DZM	DKCNBK
	DZM	DKMPAS		/INIT PASS COUNT
	DZM	WSW		/CLEAR LAST WRITE SWITCH
	DZM	DKDTR		/SET TRANSFER DIRECTION=FORWARD
	LAC	(1		/INIT TRANSFER DIRECTION SW'S=FORWARD
	DAC	DKDIRL
	DAC	DKDIRA		/FOR NEXT FREE BLOCK SEARCH
	DAC	DKSKNT		/SET SEEK/ENTER/REWIND EXECUTED SW.
	LAW	-5
	DAC	DKDECR
	DAC	DKFILE		/NON FILE ORIENTED DKA
DKMRW1	LAC	(13000
	JMP	DKSEK3		/READ FIRST DATA BLOCK (0)
 
	.EJECT
/SUBR. TO SET UP CA, WC AND TRANSFER
/ALL DISK I/O MACROS USE THIS ROUTINE TO ACTUALLY INITIATE I/O
/ONLY AT THIS POINT IS THE DECISION MADE TO STOP BGRD I/O;I.E.,
/ONLY IF FGRD IS REALLY GOING TO ISSUE AN IOT
/AC=CORE ADDR. OF TRANSFER ON ENTRY
DKWCS	0
	DAC DCALTP	/TEMP. STORE C.A.
	.IFDEF DK.API
	LAC (400200	/RAISE TO LEVEL 0
	ISA
	.ENDC
	.IFDEF DK.PI
	IOF
	.ENDC
	JMS DKSTOP	/STOP I/O ROUTINE
	.IFDEF DK.API
	DBK
	.ENDC
	.IFDEF DK.PI
	ION
	.ENDC
	LAC	DCALTP
	DAC	DKCCA		/CORE ADDR
DKUMSK	LAW	-400
	DAC	DKWC		/WORD COUNT (2'S COMP)
	LAW	-10
	DAC	DKERCT		/PARITY ERROR RETRY COUNT
	CLA!STL			/CONVERT UNIT TO TRACK.
	RTR
	DAC	DKBLC		/INIT TO DISK SIDE 2
	LAC	DLIVE+3		/UNIT #
	AND	(700000
	SAD	(300000		/UNIT 3 ILL.
	JMP	DKER27
	SAD	(700000		/UNIT 7 ILL.
	JMP	DKER27
	SMA!RTL			/UNIT 4-6 (SIDE 2)
	DZM	DKBLC		/UNIT 0-2(SIDE 1)
	SNL!RAL			/UNIT 2 OR 6
	SZL!CLA!STL		/UNIT 0 OR 4
	LAC	(30000		/2,6
	SNL			/0,4
	TAD	(30000
	TAD	DKBLC		/SIDE
	DAC	DKSAFE		/CONVERTED UNIT
	LAC	DKNXBK		/LOGICAL BL. #
	DZM	TRACK
	AND	(3777		/LOGICAL BLOCK
FINDT	TAD	(-24		/20 BLOCKS PER TRACK
	SPA!STL
	JMP	FINDS		/TRACK FOUND
	ISZ	TRACK
	JMP	FINDT		/STILL LOOKING
	.EJECT
FINDS	TAD	(24
	RTL
	JMS	.TOBCD
	DAC	SECTOR
	LAC	TRACK
	JMS	.TOBCD
	RTL
	RTL
	RTL
	RTL
	XOR	SECTOR
	TAD	DKSAFE		/UNIT
	DAC	DKSAFE		/SAVE
	LAC	DKABRT
	SNA	/ABORT IN PROGRESSS
	JMP	.+3
	ISZ	DKABTM	/HAVE WE TIMED OUT?
	JMP	.-4
/LAST 5 LINES ARE PMO MOD 20 OCT 70
	JMS	DKSIOT		/SET UP DISK IOT'S
	JMP*	DKWCS		/EXIT SUBR
/OCTAL TO BCD CONV.
.TOBCD	0
	DZM HOD		/QUOTIENT
	SKP
NXT	ISZ	HOD
	DAC OCTN		/REMAINDER
	TAD (-12)
	SMA!CLL
	JMP	NXT
	LAC	HOD	/COMBINE DIGITS
	RTL
	RTL
	XOR OCTN
	JMP*	.TOBCD
HOD	0
OCTN	0
/SUBR TO SET UP DISK IOT'S
DKSIOT	0
	LAC	DKCCA
	DSLM		/CORE ADDR.
	LAC	DKWC
	DSLW		/W.C.
	LAC	DKSAFE
	DSLD		/TRACK. SECTOR ADDR.
	LAC	DKTR
	XOR	(13000
	SZA		/INPUT
	LAC	(1000		/OUTPUT
	TAD	(6000		/LOAD STATUS: READ, GO, INIT, ENABLE
	DAC	DKIOAC		/SET UP AC FOR IOT EXECUTION
	LAC	(DSCS!DSLS	/CLEAR AND LOAD STATUS IOT
	DAC	DKIOT		/EXECUTE DURING DKNOR COMMON EXIT
	DZM	DNOIO		/CLEAR IGNORE PHONY INT. SW.
	JMP*	DKSIOT
	.EJECT
/.READ, .WRITE COMMON SETUP SUBR.
DKMCK	0
	DAC	DKTR		/READ (13000) OR WRITE (15000)
	LAC	DKSKNT		/.SEEK, .ENTER SWITCH
	SNA!CLC
	JMP	DKER12		/.SEEK, .ENTER NOT EXECUTED (DKER11)
	XCT*	DKMCK		/L.B. OR DKA BUF. L.B. ADDR.
	DAC	DKUHP		/HEADER POINTER
	DAC	DKUDP		/DATA POINTER
	LAC	DLIVE+6		/USER WC(OR WPC IF WRITE)
	DAC	DKUWC
	LAC	DLIVE+4		/DATA MODE
	DAC	DKDMOD
	IDX	DKMCK		/INDEX TO DUMP EXIT
	SAD	(4
	JMP	DKMCK2		/DUMP MODE
	LAC*	DKUHP		/COMPUTE W.C. FROM L.B.H. W.P.C
	JMS	DKGWPC
	ISZ	DKMCK		/IOPS, IMAGE EXIT
	JMP*	DKMCK		/EXIT,
/DUMP MODE
DKMCK2	LAC	DKUWC		/SAVE USER WC
	DAC	DKWCSV
	DZM	DKWPC
	XCT*	DKMCK		/JMP DKRDUM OR JUMP DKWDUM
/SUBR. TO TRANSF. WPC FROM HEADER TO DKWPC
DKGWPC	0
	RTR
	RTR
	RTR
	RTR
	AND	(776
	DAC	DKWPC		/T. STORE L.B.W.P.C.
	SNA
	JMP	DKER23
	AND	(400
	SNA!CLA
	JMP*	DKGWPC		/L.B.W.C. IN AC
DKER23	LAC	DLIVE+3		/UNIT #, CAL ADDRESS.
	AND	(700000		/PRINT UNIT # +
	XOR	DKNXBK		/OFFENDING BLK #
	DAC	DERPNT
	LAC	(4		/.ERR 23-ILL. WPC.(0 OR GREATER THAN 177)
	JMP	DKER17
/SUBR. TO ADD TO CHKSUM AND INDEX COUNTS
DKUPTR	0
	TAD	DKCKSM		/ADD DATA WD TO CKSM.
	DAC	DKCKSM
	ISZ	DKUDP
	ISZ	DKRHPT
	ISZ	DKBFCT		/INCR DKA BUF COUNT
	ISZ	DKWPC
	JMP*	DKUPTR		/ALWAYS EXITS HERE ON OUTPUT
	JMP	DKRDE		/END LINE ON INPUT
	.EJECT
/SUBR. TO CHECK ACTIVE FILE
DKCKCL	0
	LAC	DKCLSS		/PREVIOUS FILE CLOSED
	DZM	DKWRWT		/CLEAR I/O RETURN SW
	SZA!CLA
	JMP	DKER10		/NO-FILE STILL ACTIVE
	DZM	DKFILE		/SET SWITCH TO FILE-ORIENTED.
	LAC	DLIVE+5		/SAVE USER D.E. POINTER
	DAC	DKUDRP		/1ST TIME IN ON CAL
	JMS	DKNTRZ
	JMS	DKDRCK		/CHECK FOR DIRECTORY IN CORE
	LAC	DLSAV		/USER D.E. POINTER
	JMS	DKSK1		/DIR. SEARCH FOR FILE
	DAC	DKCLSS		/CLEAR OR SET CLOSE SWITCH
	JMP*	DKCKCL
/COMMON SUBR. TO CHECK ACTIVE CELL SWAP; INIT NOT EXECUTED
/IF NO BUFF ASSIGNED, .ERR 60
DBEXAC	0
	JMS	DBEX		/ACTIVE AREA SWAP
	JMP*	DBEXAC		/OK
	LAC DBEXAC		/CHECK CALLER
	AND (77777		/IF OUT OF DKNORS,IGNORE ERR.
	SAD (DKNORT+1
	JMP* DBEXAC		/IGNORE* WILL DO XCT DLIVE CODE
	LAW	60		/.INIT NOT EXECUTED: IOPS
	JMP	DKEROR-1		/TERMINAL ERROR
/DKA SEEK FILE SUBR
DKSEEK	JMS	DBEXAB		/BUFFER SWAP CHECK - AUTO .INIT IF NOT DONE
				/I/O SW=0 BY VIRTUE OF DBUFCR
	JMS	DKCKCL		/CHECK DIRECTORY FOR THIS FILE
	SNA!CLC			/DKA DIR. ENTRY POINTER IN AC
	JMP	DKER14		/FILE NOT FOUND (DKER13)
	XCT	DKSK5		/PICK UP 1ST BLK # OF FILE
	XOR	(400000		/CLEAR FILE COMPLETE BIT
	DAC	DKNXBK		/1ST BLK # READ
	DAC	DKSKNT		/SET .SEEK, .ENTER EXECUTED SWITCH
	DZM	DKWRWT
DKSEK1	LAC	(13000
DKSEK2	DAC	DKNCOR		/CLEAR DIR. IN CORE SWITCH
DKSEK3	DAC	DKTR		/INPUT
	XOR	(13000
	SZA
DLCOUB	JMP	DKCOUB		/OUT
	DZM	DKDMOD		/CLEAR DATA MODE TO BYPASS DUMP CHECK
	JMP	DKRNX1
	.EJECT
/L.B. TO DKA BUF (.WRITE) OR DKABUF TO L.B. (.READ)
DKRWT	0
DKWT2	LAC*	DKUDP		/USER L.B.
	DAC*	DKHPT		/TO DKA BUF
	JMS	DKUPTR		/ADD TO CKSUM, INDEX CTS, ETC
	ISZ	DKDATC		/DATA WORD COUNT
	ISZ	DKHPT
	ISZ	DKUWC		/DONE
	JMP	DKWT2
	JMP*	DKRWT
/.WRITE ROUTINE
DKWRIT	JMS	DBEXAC		/BUFFERSWAP CHECK NO AUTO .INIT
	JMS	DRLXEK		/CHECK IF .REALW AND SET SW.
	LAC	DKFILE		/IF .MTAPE,
	SNA
	JMP	DKWRET
	LAC	(1		/SET I/O SWITCH FOR
	DAC	DKIOSW		/OUTPUT (WRITE) AND
	JMS	DKBUFC		/CLEAR BUFFER.
DKWRET	LAC	(15000		/RETURN POINT FOR INTERRUPTED BACK CAL
	DAC	DKWREX
	JMS	DKMCK		/READ/WRITE COMMON SETUP
	LAC	DLIVE+5		/LINE BUFF POINTER
	JMP	DKWDUM		/DUMP MODE WRITE ROUT.
/RETURN HERE FOR IMAGE OR IOPS MODES
DKWRT1	CLC
	TAD	DKWPC		/REMAINING BUF. AREA SIZE
	TAD	DKBFCT		/REMAINING BUF. AREA SIZE
	SMA!CLA
	JMP	DKCOUT		/NO ROOM FOR THIS LINE
	LAC	DKEOF	 	/IF EOF SW SET, LEAVE DKWRWT ALONE
	SZA
	LAC	(JMP DKCLS3
	DAC	DKWRWT
	LAC*	DKUHP
	AND	(7
	SAD	(5
	JMP	DKWRT4
	LAC*	DKUHP		/USER LBH., WD0
	AND	(377000
	XOR	DKDMOD		/DATA MODE
	DAC*	DKUHP
DKWRT4	ISZ	DKUHP		/CLEAR USER CKSM
	DZM*	DKUHP
	DZM	DKCKSM		/INIT CHECKSUM
	CLC			/EXCLUDE L.B.H.; WD0
	TAD	DKWPC		/FROM COUNT
	CMA
	DAC	DKUWC		/ACTUAL WC (2'S COMP)
DKWT1	LAC	DKHPT		/SET UP CKSM POINTER
	DAC	DKUCKP		/FOR .WRITE
	ISZ	DKUCKP
	JMS	DKRWT
	LAC	DKDMOD
	SAD	(4
	JMP	DKDUMK		/DUMP MODE, CHECK FULL BOFF
	CLC
	TAD	DKCKSM
	CMA
	DAC*	DKUCKP		/STORE 2'S COMP CKSUM IN DKABUF
	.EJECT
DKWT5	LAC	DKFILE		/NON-FILE-ORIENTED; ALWAYS OUTPUT
	SNA			/BLOCK FOR EVERY .WRITE.
	LAC	DKEOF
	SZA			/NO EOF
	JMP	DKCOUZ		/TRANSFER EOF
	JMP	DKEMPT		/DATA TRANSFER FROM USER AREA TO
				/DK CORE BUFFER IS DONE.
DKWRCL	JMS	DKBUFC		/CLEAR DKA BUF
	LAC	DKEOF
	SNA!CLC
	JMP	DKWRET		/PUT LINE IN DKA BUF
	JMP	DKCLS2		/THIS WAS A .CLOSE
DKER17	TAD	(1		/TOO MANY FILES REFERENCED
DKER16	TAD	(2		/OUTPUT BUFFER OVERFLOW
				/DISK UNIT FULL (DKER15)
DKER14	TAD	(2		/DKA DIRECTORY FULL
DKER12	TAD	(2		/IRREC. DKA ERR. MK. TK., EOT DURING TRANSFER
				/.SEEK, .ENTER NOT EXECUTED (DKER11)
DKER10	TAD	(2		/FILE STILL ACTIVE
	TAD	DKER06		/ILL HANDLER FUNCTION
	JMP	DKEROR-1
DKER27	LAW	27		/ILLEGAL DISK UNIT (3,7)
	JMP	DKEROR-1
/CLEAR OUTPUT BUF. SUBR.
/ALSO NEEDED FOR INPUT BECAUSE OF POINTER INITIALIZATION
DKBUFC	0
	LAC	(377		/INIT DUMP MODE
	DAC	DKROOM		/BUFF SIZE
	LAC	DKIOSW
	RAR
	LAC	DLTBUF		/BUF. (WD0) POINTER (DKBUF
	SZL!STL			/DO NOT MODIFY DKHPT ON INPUT
	DAC	DKHPT		/DKA BUF HEADER POINTER
	DAC	DKRHPT		/FOR READ
	JMS	DKBFC2		/CLEAR BUF, LINK=1
	JMP*	DKBUFC
/CLEAR SPECIFIED AREA SUBR.
DKBFC2	0
	DAC	DKBFC3
	LAW	-40		/CLEAR 40
	SZL
	AND	DKUMSK		/CLEAR 400, DKUMSK=777400
	DAC	DKBFCT		/INIT OUTPUT BUFF SIZE FOR WRITE
	IDX	DKBFCT		/777401
	JMS	DDZM		/AC=COUNT TO CLEAR (40 OR 400)
DKBFC3	XX			/CLEAR POINTER
	JMP*	DKBFC2
	.EJECT
/OUTPUT CURR. IOPS BUFFER
DKCOUT	LAC	(JMP DKWRCL	/SET RETURN FROM INT.
	DAC	DKWRWT		/SET OUTPUT WAIT SWITCH
DKCOUZ	LAC	DKCNBK		/CURR. BL# TO WRITE
	DAC	DKNXBK
	SPA!CLC
	JMP	DKER16		/DISK FULL (DKER15)
	LAC	DKFILE		/IF .MTAPE .WRITE, GET NEXT BLOCK.
	DAC	WSW		/SET LAST .WRITE SW IF .MTAPE WRITE
	SZA!CLA			/EVEN FOR EOF.
	JMP	DKCOUG
	LAC	DKWRWT
	SAD	(JMP DKCLS3
	JMP	DKCOUF
	SNA!CLA			/IF DKWRWT IS NON 0 AND NOT JMP DKCLS3,
				/ALWAYS GET NEXT BLK #.
DKCOUF	LAC	DKEOF		/EOF SWITCH SET?
DKCOUG	JMS	DKMAP		/FIND NEXT FREE BLOCK
	DAC*	DKLINK		/DATA LINK POINTER
DKCOUB	LAC	DLTBUF		/(DKBUF
	JMS	DKWCS		/SETUP WC,CA AND BEGIN TRAN.
	LAC	DLCOUB		/SET UP CAL RETURN
	JMS	DCALST		/SET CAL RETURN
	JMP	DKNOR		/EXIT FOR I/O BEGUN
	.EJECT
/DUMP MODE OUTPUT
DKWDUM	JMS	DKDUMB
	XCT	DKXXX		/JMS DKBUFC OR NOP
	JMP	DKWT1
DKDUMB	0
	XCT*	DKDUMB		/JMS DKBUFC (WRITE) OR NOP (READ)
	ISZ	DKDUMB
	LAC	DKWRCL		/SET SWITCH TO CLEAR
	DAC	DKXXX		/OUTPUT BUFF (JMS DKBUFC)
	LAC	DKROOM
	TAD	DKWCSV
	SMA			/MORE THAN 3 7 TO TRANSFER
	JMP	DKDUMZ		/LAST ELEMENT OF TRANSFER
	DAC	DKWCSV		/SAVE REMAINDER
	LAW	-2
	TAD	DKDUMB		/RET. ADDR. FOR TRANS. COMP
	AND	(17777		/13 BIT ADDR.
	TAD	(JMP
	DAC	DKWRWT		/=I/O WAIT SWITCH
	CLC
	TAD	DKROOM		/FILL IN BUFF
	CMA
DKDUMY	DAC	DKUWC		/SET WORD COUNT
	XCT*	DKDUMB		/JMP DKWT1(WRITE) OR JMP DKNSH1
DKDUMZ	DZM	DKWRWT		/CLEAR I/O WAIT SWITCH
	DAC	DKROOM		/SPACE LEFT FOR NEXT DUMP
	SNA
	JMP	.+3		/FULL BUFF, DO NOT NOP CLEAR BUFF
	LAC	DKLNOP		/SET SWITCH NOT TO CLEAR OUTPUT BUFF
	DAC	DKXXX
	LAC	DKWCSV		/REMAINDER
	JMP	DKDUMY
DKDUMK	LAC	DKROOM		/IF DKROOM=0, BUFF FULL
	SZA!CMA
	LAC	DKWRWT		/IF DKWRWT=0, BUFF NOT FULL
	SZA			/NO
	JMP	DKCOUZ		/YES-OUTPUT
	JMP	DKWT5		/CHECK EOF
	.EJECT
/DKA .READ ROUTINE
DKREAD	JMS	DBEXAC		/BUFFERSWAP CHECK NO AUTO .INIT
	JMS DRLXEK		/CHECK IF .REALR AND SET SW.
	LAC	DKEOF		/EOF SWITCH SET?
	SZA!CLC
	JMP	DKRNOR		/YES - IGNORE CALL
	LAC	DLIVE+5		/USER L.B. POINTER
	DAC	DKHPT
	DAC	DKHPTS
	DZM	DKIOSW		/SET I/O SWITCH FOR INPUT (READ).
	LAC	(13000
	JMS	DKMCK		/READ/WRITE COMMON SETUP, RETURN TO .+2
	LAC	DKRHPT		/DKA BUF HEADER POINTER
	JMP DKRDUM		/DUMP MODE INPUT
/RETURN HERE FOR IOPS OR IMAGE MODES
	CLC
	TAD	DKWPC		/IOPS ASCII OR BIN (AC=777777 ON RETURN)
	TAD	DKUWC
	DZM	DKDVS		/CLEAR SHORT LINE FLAG
	SMA!CLC
	DAC	DKDVS		/SET SHORT LINE FLAG
	TAD	DKWPC
	CMA
	DAC	DKWPC		/2'S COMP HEADER W.C.
DKRD2	DZM	DKDATC		/DATA COUNT
	DZM	DKCKSM		/CLEAR CHECKSUM
	JMS	DKRWT		/TRANSFER LINE TO USER L.B.
/RETURN HERE ONLY IF SHORT LINE OR DUMP MODE
	LAC	DKDMOD
	SAD	(4
	JMP	DKRDM1		/DUMP
	LAC*	DKUDP		/SHORT LINE BYPASS
	JMS	DKUPTR		/EXCESS DATA
	JMP	.-2
DKRDM1	LAC	DKROOM		/DUMP MODE BUFF SIZE
	SZA!CMA			/IF DKROOM=0 OR
	LAC	DKWRWT		/DKWRWT=NON 0,
	SZA!CLC
	JMP	DKRNEX		/GET NEXT DUMP BLOCK
	JMP DKEMPT		/I/O REQ. DONE
	.EJECT
/END INPUT LINE ROUTINE
DKRDE	LAC*	DKHPTS		/HEADER WD 0-IOPS
	AND	(7
	XOR	DKFILE		/IF .MTAPE, DON'T GO TO DKREOF.
	SAD	(5		/EOF?
	JMP	DKREOF		/YES
	ISZ	DKDVS		/SHORT LINE FLAG SET
	JMP	DKRDE1		/NO
	LAC	(60
	JMS	DKDVS		/SET D.V. BITS FOR SHORT LINE
DKRDE1	LAC	DKERCT		/PARITY RETRY COUNT
	SMA!CLA
	JMP	DKRDP		/SET D.V. BITS=PARITY
	LAC*	DKHPTS		/HEADER, WD 0
	SPA
	JMP	DKRDN		/IGNORE CKSUM ALREADY SET
	LAC	DKCKSM
	SNA			/SET D.V. BITS=CKSUM ERROR
	JMP	DKRDN
DKRDC	LAC	(20		/CHECKSUM ERR. IN LINE, 12,13=10
DKRDP	TAD	(20		/PARITY ERROR IN DKA BLOCK 12,13=01
	JMS	DKDVS		/SET DATA VALIDITY BITS
DKRDN	LAC*	DKUDP
	SNA!CLC
	JMP	DKRNEX		/NO MORE DATA-GET NEXT BL.
	LAC	DKFILE		/IF .MTAPE,
	SZA!CLC
	JMP	DKRNEX		/GET NEXT BLK.
	ISZ	DKBFCT		/DATA BUF. CT = GET NEXT BL.
	JMP	DKRNOR		/NORM EXIT
DKRNEX	SAD*	DKLINK		/DATA LINK=-0
	JMP	DKREOF		/LAST BLOCK -SET EOF SWITCH
	LAC	DKNXBK		/LAST BL# (READ)
	CMA
	TAD*	DKLINK		/DATA LINK (NEXT BLOCK)
	SPA!CLA			/READ FORW
	CLC			/READ REV.
	SAD	DKDTR		/IF TURN AROUND,
	SKP
	JMS	DKMFLP		/INDEX .MTAPE PASS COUNT.
	DAC	DKDTR		/TRANSF. DIRECTION SWITCH
	LAC*	DKLINK
	DAC	DKNXBK		/DATA LINK INTO NEXT BLOCK
	DAC	DKCNBK		/SET UP FOR .WRITE AFTER BACKSPACE.
DKRNX1	JMS	DKBUFC		/INIT. BUFFER
	LAC	DKDMOD		/DUMP MODE?
	XOR	(4
	SZA			/YES
	JMP	DKCOUB		/NO
	LAC	DKRHPT		/RESET BUFF POINTER
	DAC	DKUDP
	JMP	DKCOUB		/TRANSFER
	.EJECT
/SUBR. TO SET DATA VALIDITY BITS
DKDVS	0
	DAC	DKDVSM		/SAVE MASK
	LAW	17717		/MASK ALL BUT BITS 0, 12,13
	AND*	DKHPTS
	XOR	DKDVSM
	DAC*	DKHPTS		/HEADER, WD0
	JMP*	DKDVS
DKREOF	DAC	DKEOF		/SET EOF SWITCH+DROP THRU TO EXIT
DKRNOR	TAD	DKBFCT		/DECR. (BY 1) DKFCT
	DAC	DKBFCT		/BUF COUNT
	JMP DKEMPT		/I/O REQ. DONE
/DUMP MODE INPUT
DKRDUM	JMS	DKDUMB		/SET UP FOR DUMP INPUT
DKLNOP	NOP
	JMP DKRD2			/INPUT DUMP AREA
/DKA ENTER FILE ROUTINE
DKENTR	JMS	DBEXAB		/BUFFERSWAP CHECK - AUTO .INIT IF NOT DONE
	LAC (1			/SET I/O SW. TO 1 (OUTPUT)
	DAC DKIOSW
	JMS	DKCKCL		/CHECK DIRECTORY FOR THIS FILE
	DAC DESAME		/NON 0 = SAME NAME FOUND,
				/WILL NOT BE CHANGED IF IOPS15
	SZA
	JMP	DKNTR6		/FOUND-WILL BE MODIFIED ON .CLOSE
	LAC	DLFAKE		/INIT GOR EMPTY SLOT SEARCH (DKFAKE
	JMS	DKSK1		/D SEARCH FOR EMPTY FILE ENTRY
	DAC	DKCLSS		/CLEAR OR SET CLOSE SWITCH
	SNA
	JMP	DKER14		/DIRECTORY FULL
DKNTR6	LAW	-40		/INIT BIT MAP SEARCH
	DAC	DKWMCT		/BIT MAP WORD COUNT
	LAC	DLMBIT		/FILE BIT MAP POINTER (DK1BIT) OR (DK2BIT)
	DAC	DKPONT		/CURR. FILE BIT MAP WD. POINTER
	LAC	DLTDIR		/BIT MAP ADDR. POINTER (DKDIR
	DAC	DKMTRX
	DAC	DKBMPT		/SET BIT MAP POINTER
	DZM	DKRELB		/BL. #
	LAW -1100			/INIT DK BLOCK COUNT
	DAC DKBLOK
	LAW	-1		/INIT BIT MAP
	DAC	DKREM		/SEARCH TO
	DAC	DKSKNT		/PICK UP
	DAC	DKNCOR		/1ST BLOCK FREE
	LAC	(1		/(1
	DAC	DKDIRA		/SET BIT MAP DIRECTION SWITCH
	DAC	DKDIRL		/TO FORWARD (+1)
	JMS	DKMPS		/SETUP TO EXAM. MAP, WD0
	.EJECT
	LAW	-3		/CORRECT FILE NAME POINTER
	TAD	DKFIN
	DAC	DKFIN
	JMS	DKMAP		/GET NEXT FREE BL#
	XOR	(400000
	XCT	DKNTR3		/STORE BL#+COMPLETION BIT IN DKESAV+3
	SMA!CLC
	JMP	DKER16		/DECTAPE FULL (DKER15)
	JMS	DKBUFC
	LAC DKLNOP
	DAC DKXXX			/SET OUTPUT DUMP SWITCH
	JMP DKEMPT		/I/O REQ. DONE
/SUBR. TO SAVE USER D.E.
/DKUDRP SET UP BEFORE ENTRY
DKNTRZ	0
	LAC DLSAV			/(DK1SAV
	DAC	DKFIN
	LAW	-6		/SET DKA D.E.
	DAC	DKCLCT		/TRANSFER COUNTER
DKNTR2	LAC*	DKUDRP		/SAVE USER D.E.
DKNTR3	DAC*	DKFIN
	ISZ	DKFIN
	ISZ	DKUDRP
	ISZ	DKCLCT
	JMP	DKNTR2
	JMP*	DKNTRZ
/EMPTY SLOT FOR ENTER SEARCH (LAST WD. UNUSED)
DKFAKE	0
	0
	0
DKEOFH	1005			/EOF HEADER FOR CLOSE
/SUBR TO SET UP FOR EXAM OF NEXT BIT MAP WORD
DKMPS	0
	LAW	-22
	DAC	DKRBIT		/18 BIT COUNT
	LAC*	DKMTRX		/NEXT BIT MAP WD
	CMA!STL
	DAC	DKSBIT
	LAC	DKDIRA		/BIT MAP DIRECTION SWITCH
	SMA!CLA!RAL		/REVERSE-SEARCH BIT 18-0
	RTR			/FORWARD-SEARCH BIT 0-18
	DAC	DKTBIT		/FORWARD(0=1); REVERSE (18=1)
	JMP*	DKMPS
	.EJECT
/END OF CURRENT BIT MAP WORD SUBR.
DKMPP	0
DKMPP1	LAC	DKDIRA		/INCR. (IF FORWARD) OR
	TAD	DKMTRX		/DECR. (IF REV) BY 1
	DAC	DKMTRX		/DK. BIT MAP POINTER
	LAC	DKDIRA
	TAD	DKPONT		/FILE BIT MAP POINTER
	DAC	DKPONT
	JMS	DKMPS		/SET FOR NEXT WD
	ISZ	DKWMCT		/BIT MAP WORD CT
	JMP*	DKMPP		/EXIT
	LAW	-1100
	DAC	DKBLOK		/RESET BLK COUNT
	DZM	DKBMCT		/CLEAR BIT MAP SEARCH COUNT
	JMS	DDIRAL
	TAD	DKRELB		/REINIT
	DAC	DKRELB
/ROUTINE TO SET DKREM FOR TURN AROUND CASE
	LAC DKDIRA
	RAL			/L=1=REV.,L=0=FORW.
	LAC DKNXBK		/LAST BL # RECORDED FOR THIS FILE
	CMA
	SNL			/REV
	JMP .+3
	TAD (1100
	CMA
	DAC DKREM			/LAW TO CHECK ENOUGH SPACE BETW BL
	LAW	-41
	DAC	DKWMCT		/MATRIX COUNT
	JMP	DKMPP1		/START REV. SEARCH
 
/SUBR TO FLIP DKDIRA AT TURNAROUND.
 
DDIRAL	0
 
	CLA
	ISZ	DKDIRA		/1 OR -1
	LAW	-2		/REV
	TAD	(1		/FWD
	DAC	DKDIRA
	JMP*	DDIRAL
 
	.EJECT
/BLOCK AVAILABILITY BIT MAP SEARCH
DKMAP	0
	DAC DKMAPT		/SAVE AC, IF -1, IT WILL BE BLK# ON EXIT
	LAC	DKFILE		/.MTAPE .WRITE?
	SZA!CLC
	JMP	DKNFB		/YES.
	DZM	DKBMCT		/BIT MAP SEARCH COUNT
DKMAP1	LAC	DKTBIT		/TEST BIT
DKMAP2	AND	DKSBIT		/MATRIX WORD
	SZA!CLC
	JMP	DKREM		/BLOCK AVAILABLE
	ISZ	DKBLOK		/INCR. DK BLOCK COUNT
	JMP DKMAP4
	DAC DKBLOK
	JMP DKREM5
DKMAP4	ISZ	DKBMCT
	LAC	DKDIRA		/IF FORW, INCR. BL#
	TAD	DKRELB		/IF REV., DECR. BL.# BY1
	DAC	DKRELB
	LAC	DKDIRA
	RAL			/L=0=FORW; L=1=REV.
	LAC	DKTBIT		/SHIFT TEST BIT RIGHT IF FORW,
	SNL!CLL!RAL		/LEFT IF REV.
	RTR
	DAC	DKTBIT
	ISZ	DKRBIT		/INDEX-18 BIT COUNT
	JMP	DKMAP2		/NEXT BIT
	JMS	DKMPP		/END OF MATRIX WD. SUBR.
	JMP	DKMAP1		/NEXT WORD
DKREM	XX			/DELTA BLOCKS IN BETWEEN
	TAD	DKBMCT
	SPA!CLC			/OK-4 BLOCKS IN BETWEEN
	JMP	DKMAP4		/CHECK BIT MAP AGAIN
	SAD DKMAPT		/IF ENTRY AC = -1, NO DKCBIT
	JMP DKREM6
	JMS	DKCBIT		/SET BIT IN MAPS
	CMA
	DAC	DKSBIT
DKREM6	LAW	-DELTA		/RESET BLOCK
	DAC	DKREM		/DISTANCE CHECK TO -DELTA
DKREMM	LAC	DKDIRL		/SET TRANSF DIRECTION  SWITCH
	SPA!CLA
	CMA
	DAC	DKDTR
	LAC	DKDIRA		/UPDATE DKDIRL
	DAC	DKDIRL
	LAC	DKRELB		/T. STORE BL# TO BE  USED
DKREM5	DAC	DKCNBK		/EXIT
	LAW -1			/WAS AC ON ENTRY = -1?
	SAD DKMAPT
DLSKP	SKP			/YES, EXIT WITHH AC= -1
	LAC DKCNBK		/NEW BLK #
	JMP*	DKMAP		/EXIT -BL ! FOUND(777777=DKA FULL)
DKMAPT	0			/TEMP
	.EJECT
/.MTAPE FREE BLOCK DETERMINATION. AC=-1 ON ENTRY.
 
DKNFB	TAD	DKDECR		/NEXT BLK MUST BE +5(FWD) OR -5 (REV)
	CMA
	TAD	DKCNBK		/CURRENT BLK #
	SPA
	JMP	DKNFBT		/TURN AROUND CORNER
	DAC	DKRELB		/TEMP STORE
	TAD	(-1100
	SPA			/TURN AROUND
	JMP	DKREMM		/PICK UP NEW BLK # AND EXIT
DKNFBT	LAC	DKMPAS
	TAD	(LAC DKMBAC
	DAC	.+2
	JMS	DKMFLP		/FLIP SWITCHES
	XX			/LAC DKMBAC+PASS COUNT
	DAC	DKRELB		/NEW BLK #
	JMP	DKREMM		/AC=1ST BLK # OF NEXT PASS
 
	.EJECT
/CHANGE BIT IN MAPS SUBR.
DKCBIT	0
	LAC	DKTBIT		/SET BIT IN FILE BIT MAP
	XOR*	DKPONT
	DAC*	DKPONT
	LAC	DKTBIT		/SET BIT IN MAP
	XOR*	DKMTRX
	DAC*	DKMTRX
	JMP*	DKCBIT		/C(*DKMTRX) MUST BE IN AC ON EXIT
/CLEAR DIRECTORY ROUTINE
DKCLR2	LAC DKCLRZ		/BLOCK POINTER (71-100)
	DZM DKRWAY
	IDX DKRWAY		/WRITE FORW. (DLIVE+4=DKRWAY)
	JMS DKSET			/SET BLK #, ETC.
	LAC DLTBUF		/DKBUF
	JMS	DKWCS		/SET UP CA, WC+BEGIN TRANSFER
	JMP	DKNOR		/EXIT FOR CONTINUED I/O
DKCLER	JMS	DBEXAB		/BUFFERSWAP CHECK - AUTO .INIT IF NOT DONE
	LAC	DKCLSS		/CLOSE SWITCH CLEAR
	SZA!CLA			/YES
	JMP	DKER10		/FILE STILL ACTIVE
	LAC	(JMP DKCLR1	/SET RETURN AND
	DAC	DKWRWT		/I/O WAIT SWITCH
	LAC DLCLR2		/SET UP CAL RETURN
	JMS DCALST		/SET UP CAL RETURN
	LAC DLIT70
	DAC	DKCLRZ		/INIT TABLE REF
	JMS	DKBUFC		/CLEAR BUFF
	LAW	-10		/COUNT FOR
	DAC	DKCLR3		/FILE BIT MAP BLOCKS
	LAW	-11
	DAC	DKCLR4		/COUNT OF BLOCKS TO CLEAR+1
DKCLR1	DAC DKNCOR		/CLEAR DIR. IN CORE SW.
	IDX DKCLRZ		/INDEX BLOCK #
	ISZ	DKCLR3		/FILE BIT MAP BLOCKS CLEARED?
	JMP	.+4
	LAC	(77600		/INIT DIR TO 10(OCT) SYSTEM BLKS OCCUPE
	DAC*	DLB003
	DAC*	DLB203
	ISZ	DKCLR4		/DONE - FALL THRU TO DKEMPT
DLCLR2	JMP	DKCLR2
	.EJECT
/CONTROL COMES TO DKEMPT
/WHEN I/O REQUEST IS COMPLETED
/SET UP SWITCH IN EXIT ROUTINE TO
/CLEAR FOREGROUND OR BACKGROUND BUSY REGISTER AS
/A FUNCTION OF WORD11 (DLIVE+1), AND PLACE IOF IN DKA
/IOT REGISTER SO THAT NO NEW I/O WILL BE STARTED.
DKEMPT	DZM DKWRWT		/CLEAR I/O RETURN SW.
DKEMPZ	JMS	DFLAG
/IS THIS DEVICE INVOLVED IN I/O BUSY SITUATION.
DKT31	LAC*	(.SCOM+52		/ADDR. OF
	DAC	DKTMP1		/I/O BUSY TESTER
	.IFDEF DK.API
	LAC	(400200		/API LEVEL 0
	ISA
	.ENDC
	.IFDEF DK.PI
	IOF
	.ENDC
	LAC	(DKA.
	JMS*	DKTMP1		/I/O BUSY TEST
	.IFDEF DK.API
	DBK
	.ENDC
	.IFDEF DK.PI
	ION
	.ENDC
	JMS	DKREAL		/CHECK FOR REAL-TIME REQUEST
	JMP	DKNORS		/NOT REAL TIME REQUEST.
	LAC*	(.SCOM+51		/ADDR. OF
	DAC	DKTMP1		/REAL-TIME PROCESSOR
	.IFDEF DK.API
	LAC	(400200
	ISA
	.ENDC
	.IFDEF DK.PI
	IOF
	.ENDC
	LAC	DKWD17		/REAL-TIME RETURN ADDRESS
	JMS*	DKTMP1		/REAL-TIME PROCESSOR
	.IFDEF DK.API
	DBK
	.ENDC
	.IFDEF DK.PI
	ION
	.ENDC
	JMP	DKNORS
	.EJECT
/SUBROUTINE TO DETERMINE IF THIS I/O
/WAS A REAL TIME REQUEST OR NOT.
/CALLING SEQUENCE:	JMS	DKREAL
/		(NOT REAL)
/		(REAL)
DKREAL	0
	LAC DLIVE+1	/0=F;1=B
	TAD (DRELR
	DAC DRELT
	LAC* DRELT
	SNA		/REAL TIME? (YES IF SW. NON-0)
	JMP* DKREAL
	IDX DKREAL	/INDEX EXIT FOR REAL TIME
	DZM* DRELT	/CLEAR REAL TIME SW
	JMP* DKREAL
DRELR	0		/F REAL TIME SW.
	0		/B REAL TIME SW
DRELT	0		/TEMP
	.EJECT
/SUBROUTINE TO SET UP CLEARING OF THE
/APPROPRIATE BUSY FLAG (AT PROTECTED EXIT TIME)
/AND NULLIFY (IOF) IOT REGISTER.
DFLAG	0
	LAC	DKIOF		/IOF
	DAC	DKIOT
	LAC	DLIVE+1		/WORD 1 OF LIVE REGS.
	SZA			/0=FGRD, 1=BGRD
	JMP	.+4
	LAC	DKLNOP		/FOREGROUND
	DAC	DKFCLR
	JMP*	DFLAG
	LAC	DKLNOP		/BACKGROUND
	DAC	DKBCLR
	JMP*	DFLAG
/DKERR	JMS	DFLAG		/CLEAR BUSY FLAG.
/MULTI UNIT HANDLERS ONLY:
/FLOW CHART: BOX 33 (DKNORS)
/IGNORED FUNCTIONS
/DKIGN	JMS	DFLAG		/CLEAR BUSY FLAG
/MULTI UNIT HANDLERS ONLY:
/FLOW CHART: BOX 33 (DKNORS)
/THIS SUBROUTINE IS EXECUTED (XCT) BY THE
/CAL HANDLER VIA WORD 0 OF THIS I/O
/HANDLER JUST PRIOR TO GIVING CONTROL
/TO THE HANDLER AT THE APPROPRIATE
/ENTRY IN THE FUNCTION DISPATCH TABLE.
DKSWAP	0
/MULTI-UNIT DEVICES ONLY:
/	STOP  I/O IN PROGRESS ONLY IF BACKUP AND LIVE CELLS ARE BOTH
/	BGRD OR BOTH FGRD (TO ALLOW .INITS)
	LAC DLIVE+1	/USER (0=F;1=B)
	XOR DBACK+1
	SNA		/DIFFER
	JMS DKSTOP	/SAME USERS; STOP I/O
	CLA
	.EJECT
/IF BOTH FGRD AND BGRD BUSY FLAGS ARE ON,FGRD TAKING OVER.
/BGRD DATA TRANSFER IS ALLOWED TO CONTINUE UNLESS AND UNTIL
/FGRD MUST ISSUE AN IOT VIA ROUTINE DKWCS. IN THE MEANTIME,
/BGRD I/O GOING SW.(DKIGNR) IS SET IN CASE OF INTERRUPT.
	SAD DKA.+1	/FGRD BUSY SW.
	SKP		/NOT ON
	SAD DKA.+2	/BGRD BUSY SW.
	SKP		/NOT ON (AC STILL 0)
	CLC		/BOTH ARE ON, SET DKIGNR
	DAC DKIGNR
	XCT DKA.+5	/ION OR IOF
	.IFDEF DK.API
	DBK		/FROM LEVEL 0
	.ENDC
	JMS DSWON		/SWAP LIVE AND BACKUP CELLS
	JMP* DKSWAP
	.EJECT
/MULTI-UNIT DEVICES ONLY:
/	SWAP BACKUP AND
/	LIVE DATA REGISTERS.
DSWON	0
	LAW	DSWCT	/COUNT OF CELLS IN LIVE OR BACK-UP
	DAC	DKEMP
	LAC	(DBACK	/BACK-UP CELL POINTER
	DAC	DKEMP1
	LAC	(DLIVE	/LIVE CELL POINTER
	DAC	DKEMP2
DKSWP	LAC*	DKEMP1
	DAC	DKEMP3
	LAC*	DKEMP2
	DAC*	DKEMP1
	LAC	DKEMP3
	DAC*	DKEMP2
	ISZ	DKEMP1
	ISZ	DKEMP2
	ISZ	DKEMP
	JMP	DKSWP
	LAC	DLIVE+3	/SET UP UNIT #, CAL ADDR. IN ERROR POINTER
	DAC	DERPNT
	JMP*	DSWON
DKEMP	0
DKEMP1	0
DKEMP2	0
DKEMP3	0
DKEMP4	0
	.EJECT
/SUBR TO STOP I/O AND SAVE STATUS A IN DKRASV
/THE LINK MUST NOT CHANGE DURING DKSTOP
DKSTOP	0
	DZM DKIGNR	/CLEAR BGRD I/O GOING SW.
	LAW	-106	/SET UP TIME OUT FOR ABORT -PMO
	DAC DNOIO		/SET IGNORE INTERR. SW.
	DAC	DKABRT	/ABORT IN PROGRESS -PMO
	DAC	DKABTM	/TIME OUT AFTER 420 USEC -PMO 20 OCT 70
	DSCS		/CLEAR STATUS TO STOP DISK I/O IF UNDERWAY
	JMP* DKSTOP
/DBPT=BUFFER POINTER TABLE
/	WD0=-DN WHERE DN = TOTAL FILE CAPACITY
/	WD 1-N CONTAIN BUFFER ADDRESSES
/ENTRY ESTABLISHED AT .INIT
/	CLEARED AT .CLOSE
DBPT		-DN
	.BLOCK	DN
	.EJECT
/DKCLER BLOCK TABLE
DLIT70	70		/FILE BIT MAPS IN BLK 71-77
DLIT77	77
DLT100	100		/BLOCK 100=DIRECTORY
/ACTIVE FILE CELLS AND BUFFER POINTERS
DBUFF=.
/NOTE: DSLOT, DUSER, AND D.BFTP MUST REMAIN AS 1ST 3 WORDS IN BUFFER.
DSLOT	0		/.DAT SLOT (DLIVE+2)
DUSER	0		/USER: 0=F; 1=B (DLIVE+1)
D.BFTP	0		/.BFTAB ENTRY ADDR.
DKMPAS	0		/.MTAPE PASS COUNT (0-4)
DKDECR	0		/BACKSPACE DECR: -5(FWD) +5(REV)
WSW	0		/"LAST CMD = WRITE" SWITCH (IF -)
DLTBUF	0		/DKBUF
DBUFAD	0		/EXT. BUFF. ADDR.
DLTDIR	0		/DIRECTORY POINTER(DKDIR)
DLTSYS	0		/WD3 0F SYS BIT MAP(DKDIR+203)
DLB003	0		/SYSTEM BLOCK BITS POINTER(DKBUF+3)
DLB203	0		/BASIC SYSTEM BLOCK BITS POINTER(DKBUF+203)
DKLB40	0		/DIR. ENTRY POINTER (.CLOSE)(DKBUF+40)
DKLINK	0		/FILE1 DATA LINK POINTER(DKBUF+377)
DLMBIT	0		/FILE1 BIT MAP POINTER
DKROOM	0		/DUMP MODE BUFF SIZE (MODIFIED-INITAILLY 377
DKXXX	0		/DUMP MODE OUT SWITCH(JMS DKBUFC OR NOP)
DKNXBK	0		/BL.# TO BE TRANSFERRED
DKCNBK	0		/DATA LINK (NEXT BL.#)
DKCURE	0		/DIR. POINTER TTO CURR. FILE ENTRY EXAMINED
DKEOF	0		/EOF SWITCH, -0=EOF
DKHPT	0		/DKA BUF. LINE HEADER POINTER (INDEXED)
DKIOSW	0		/I/O SWITCH, 0=INPUT, 1=OUTPUT
DKRHPT	0		/DKA BUF. LINE HEADER POINTER (.READ)
DKSKNT	0		/.SEEK,.ENTER,REWIND EXECUTED SWITCH (NON 0=EXECUTED)
DKPONT	0		/CURR. FILE BIT MAP WD POINTER
DKCLSS	0		/FILE OPEN, CLOSE SWITCH(NON-0=OPEN,0=CLOSED)
DKBFCT	0		/BUFFER COUNT (INIT=-377)
SECTOR	0
DKDTR	0		/TRANSF. DIRECT. SW.,0=F,-1=R
DKWREX	0		/WRITE EXECUTED SWITCH (0=NOT, NON 0=EXECUTED)
DKFPCT	0		/FILE ENTRY COUNT
DBLKLC	0		/24-56 FILE ENTRY SWITCH(50=24;10=70)
DKTR	0		/SEARCH-READ(13000) OR SEARCH-WRITE(15000)
DKWRWT	0		/INTERRUPT RETURN FOR CONT. I/O (0=CLEAR)
DRENSW	0		/RENAME SWITCH (NON0=SET)
DESAME	0		/NON 0 = SAME NAME FOUND ON .ENTER
DK1SAV	0		/FILE NAME
DKCLR4=.
	0
DKCLR3=.
	0
DKCLRZ=.
	0
	0		/RENAME FILE NAME
	0
	0
	.EJECT
DKFILE	0		/FILE ORIENT. SWITCH,0=FILE,-0=NON-FILE
DKNCOR	0		/DIRECT. IN CORE SWITCH
DKDIRA	0		/BIT MAP DIRECTION SWITCH (CURR. BL.)+1=F,-1=R
DKDIRL	0		/BIT MAP DIRECTION SWITCH (LAST.BL.),+1=F,-1=R
DKMTRX	0		/CURRENT BIT MAP WD. POINTER
DKRBIT	0		/18  BIT (2'S COMP)COUNTER FOR BIT MAP SEARCH
DKRELB	0		/FREE BL.#AFTER BIT MAP SEARCH
DKSBIT	0		/-(MATRIX WORD)
DKTBIT	0		/TEST BIT FOR BIT MAP SEARCH
DKWMCT	0		/BIT MAP WORD COUNT
DKBMPT	0		/DIR. BIT MAP 1 POINTER
DKBLOK	0		/BLOCK EXAMINED COUNT
TRACK=.
DKBLC	0
DKDRGT	LAW -1		/DIR. SEARCH SW. (0=SEARCHING)
BLBND=.
DBUFSZ=BLBND-DBUFF
/FOLLOWING =CELLS USED IN COMMON BY BOTH FILES
DLFAKE	DKFAKE		/POINTER TO EMPTY FILE NAME
DKCCA	0		/CURRENT ADDR. (C.A.) POINTER FOR TRANSFER
DKDATC	0		/LINE DATA COUNT
DKDMOD	0		/DATA MODE (15-17)
DKHPTS	0		/DKA BUF. LINE HEADER POINTER
DKUCKP	0		/USER LINE BUF. CHECKSUM POINTER
DKUDP	0		/USER LINE BUF DATA POINTER (MODIFIED)
DKUHP	0		/USER LINE BUF. HEADER POINTER
DKWC	0		/2'S COMP TRANSFER WORD COUNT
DLEOFH	DKEOFH		/EOF HEADER POINTER (FOR .CLOSE)
DKCKSM	0		/LINE CHECKSUM
DKWPC	0		/WORD PAIR COUNT
DNOIO	0		/IGNORE PHONY INTERR. SW. (-1=IGNORE)
DKIGNR	0		/BGRD I/O GOING SW. (-1=GOING)
DBDONE	0		/BGRD I/O DONE SW. (NON 0= DONE)
DKDVSM	0		/DATA VALIDITY BIT MASK
DKBMCT	0
DKCLCT	0
DKCLRP	0
DKCTS	0
DKCT1S	0
DKDES	0
DKFIN	0
DKOLBM	0
DKUDRP	0
DKUDRR	0
DKUWC	0
DKWCSV	0
DKXRNW	0
DKXROL	0
DKABRT	0
DKABTM	0
	.END
