	.TITLE *** RSX DISK FILES HANDLER OVERLAY #1
/
/ 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	#76	26 NOV 75	C. PROTEAU
/					M.HEBENSTREIT
/
/
/ DEFINING %RF15 PRODUCES A VERSION FOR THE RF DISK.
/ DEFINING %RP02 PRODUCES A VERSION FOR THE RP02 DISK PACK.
/ DEFINING %RK05 PRODUCES A VERSION FOR THE RK05 CARTRIDGE DISK.
/ 
	.IFUND %RF15
	.IFUND %RP02
	.IFUND %RK05
	.END    NO ASSEMBLY PARAMETERS SPECIFIED
	.ENDC
	.ENDC
	.ENDC
/
/ INTERNALLY DEFINED GLOBAL SYMBOL: MUST BE THE SAME AS THE FILE NAME.
/
	.GLOBL	RFOPEN
/
/ EXTERNALLY DEFINED GLOBAL SYMBOLS.
/
	.GLOBL	RFRQND,RFALUN,RFAL1B,RFSREV,RFGTBL,RFPTBL,RFBFAD,RFOPED
	.GLOBL	RFPDNA,RFFCNT,RFCLFL,RFLUNN
/
	.IFUND %RF15
	.GLOBL RFUNIT
	.ENDC
/
/
/ DEFINITION OF REGISTERS LOCATED WITHIN THE RSX EXECUTIVE.
/
X10=10				/AUTOINCREMENT REGISTER 10.
R1=101				/GENERAL REGISTER #1.
R2=102				/GENERAL REGISTER #2.
R4=104				/GENERAL REGISTER #4.
NADD=107			/ENTRY POINT TO "ADD
				/NODE TO DEQUE" SUBROUTINE.
NDEL=112			/ENTRY POINT TO "DELETE NODE FROM DEQUE"
				/SUBROUTINE.
PENP=115			/ENTRY POINT TO "PICK AN EMPTY
				/NODE FROM POOL" SUBROUTINE.
MONTH=166			/1 - 12.
DAY=167				/1 - 31.
YEAR=170			/0 - 99.
POOL=240			/HEAD OF THE EMPTY NODES DEQUE.
ALBF=353			/ENTRY POINT TO "ALLOCATE BUFFER" SUBR.
DABF=356			/ENTRY POINT TO "DEALLOCATE BUFFER" SUBR.
LUFD1=304			/PTR TO START OF LUN-UFD TABLE
/
/ IOT AND PARAMETER DEFINITIONS.
/
.INH=705522			/INHIBIT INTERRUPTS.
.ENB=705521			/ENABLE INTERRUPTS.
IDX=ISZ				/IDX IS USED INSTEAD OF ISZ WHEN THE
				/INTENT IS TO ADD 1 TO A REGISTER BUT
				/NOT TO SKIP.
/
RFOPEN	0			/ENTRY TO THIS OVERLAY WITH THE FUNCTION
				/CODE IN THE AC.
	DZM	RFERCD		/INITIALIZE THE ERROR CODE (0=NONE).
	SAD	(032)
	JMP	RFSEEK		/SEEK -- OPEN SEQUENTIAL INPUT FILE.
	SAD	(033)
	JMP	RFENTR		/ENTER -- OPEN SEQUENTIAL OUTPUT FILE.
				/RENAME -- OPEN FILE FOR RENAMING.
	.TITLE *** RENAME (OPEN FILE FOR RENAMING)
/
/ THE SECOND PART OF THE RENAMING PROCESS IS "CLOSE"ING THE FILE WITH A
/ NEW NAME. BOTH SEQUENTIAL AND RANDOM ACCESS FILES MAY BE RENAMED.
/
RFRENM	JMS	RFCOM1		/COMMON SETUP CODE: INTEGRITY CHECKS,
	NOP			/GET AND INITIALIZE A FILE BUFFER.
				/NOP -- ARGUMENT MEANS THAT THE FILE
				/MUST NOT ALREADY BE IN USE.
				/(ASSUME THAT ALL ACTIVE REGISTERS ARE ALTERED).
				/RETURN HERE IF NO ERROR OCCURRED.
	JMS	RFUFDS		/GET THE UFD FOR THIS LUN
	DAC	RF.FEF,X	/SAVE THE UFD'S STARTING BLOCK
	JMP	RFGBLC		/USE CODE IN COMMON WITH "SEEK"
	.TITLE *** SEEK (OPEN SEQUENTIAL FILE FOR INPUT)
/
RFSEEK	JMS	RFCOM1		/COMMON SETUP CODE: INTEGRITY CHECKS,
				/GET AND INITIALIZE A FILE BUFFER.
	SKP			/ARG. 1 -- MEANS O.K. IF FILE IS OPEN
				/	ELSEWHERE FOR INPUT.
				/(ASSUME THAT ALL ACTIVE REGISTERS ARE ALTERED).
				/RETURN HERE IF NO ERROR OCCURRED.
/
/ THE XR IS POINTING AT THE FILE BUFFER. THE FOLLOWING IS COMMON CODE
/ USED ALSO BY "RENAME".
/
RFCOCO	JMS	RFUFDS		/PREPARE TO GET 1ST UFD BLOCK.
RFGBLC	DAC	RF.BLK,X	/SAVE THE BLOCK NUMBER.
	JMS*	RFGTBL		/GET DISK BLOCK.
				/(EFFECTIVELY, ALL ACTIVE REGISTERS ARE
				/ALTERED; THE XR IS LEFT POINTING AT THE
				/FILE BUFFER).
				/DISK ERROR?
	JMP	RFDKER		/#/ YES -- THE ERROR CODE IS IN THE AC.
	JMS	RFSRCH		/NO -- SEARCH THE UFD BLOCK FOR THE FILE.
				/(X10, LR, AC & RF.CNT ARE ALTERED).
	LAC	RF.OFF,X	/WAS THE FILE FOUND?
	SZA
	JMP	RFSKFF		/YES.
/
/ THE CURRENT UFD BLOCK DOES NOT CONTAIN THE FILE. PREPARE TO READ IN
/ THE NEXT BLOCK IF ONE EXISTS.
/
	LAC	RF.DAT+377,X    /EXAMINE THE UFD BLOCK'S FORWARD LINKAGE.
	SAD	RFL002		/SAD (-1).
	JMP	RFFLNF		/#/ THIS IS THE FINAL UFD BLOCK; THEREFORE,
				/THE FILE DOES NOT EXIST.
	JMP	RFGBLC		/READ IN THE NEXT UFD BLOCK.
/
/ THE FILE NAME HAS BEEN FOUND.
/
RFSKFF	LAC	RFFCOD		/IF THIS IS A RENAME DON'T TEST FILE TYPE
	SAD	(37
	JMP	RFFLOK
	LAC	RFTYPE		/IS THE OLD FILE A SEQ. ACCESS FILE?
	SPA
	JMP	RFCONF		/#/ NO -- ERROR.
/
	LAC	RF.OFS,X	/IS THIS A TRUNCATED FILE?
	SMA
	JMP	RFFLOK		/NO.
/
/ A TRUNCATED FILE MAY BE RENAMED BUT IT CANNOT BE READ.
/
RFTRFL	LAC	RFFCOD		/FUNCTION = "SEEK"?
	SAD	(032)
	JMP	RFITFL		/#/ YES -- ERROR.
RFFLOK	JMS	RFDBFA		/NO -- SET THE BUFFER DATA POINTER POINTING TO
	AAC	+376		/WORD 376 (THE BACKWARD LINKAGE WORD) TO
	DAC	RF.DPT,X	/INDICATE THAT THE BUFFER IS EMPTY.
	LAC	RF.OFS,X	/SET THE FORWARD LINKAGE WORD TO POINT TO
	AND	(377777)	/THE FILE'S FIRST DATA BLOCK.
	DAC	RF.DAT+377,X
	JMP	RFRQOC		/I/O REQUEST COMPLETED.
/
/ ERRORS.
/
RFUIDR	LAW     -33		/UNINITIALIZED DIRECTORY OR UNIT DISMOUNTED
	SKP
RFCONF	LAW	-57		/SEQUENTIAL/RANDOM ACCESS CONFLICT. CAN'T
	SKP			/"ENTER" IF FILE IS ALREADY A RANDOM
				/ACCESS FILE.
RFFLNF	LAW	-13		/FILE NOT FOUND.
	SKP
RFITFL	LAW	-51		/CANNOT READ A TRUNCATED FILE.
RFDKER	DAC	RFERCD		/SAVE THE ERROR CODE TEMPORARILY.
/
/ RELINQUISH THE FILE BUFFER.
/
	LAC*	RFBFAD		/GET BUFFER ADDRESS.
	DAC*	(R4)
	JMS*	(DABF)		/DEALLOCATE I/O BUFFER.
				/(R4, R5, XR & AC ARE ALTERED).
/
/ REMOVE THE ACTIVE LUN NODE.
/
	LAC	RFALNA		/ACTIVE LUN NODE ADDRESS.
	DAC*	(R1)
	JMS*	(NDEL)		/(R1, R2, R6, XR & AC ARE ALTERED).
	LAC	RFALNA		/RETURN THE NODE TO THE EMPTY POOL.
	JMS	RFRTND		/(R2, R6, XR & AC ARE ALTERED).
	LAC	RFERCD		/RETURN THE ERROR CODE.
	JMP*	RFSREV		/SET REQUESTER'S EVENT VARIABLE.
/
/ REQUESTED OPERATION COMPLETED -- INCREMENT THE OPEN FILE COUNT.
/
RFRQOC	ISZ*	RFFCNT		/ADD 1 TO THE NUMBER OF OPEN FILES.
	NOP
	LAC*	RFPDNA		/SET XR TO POINT TO THE PHYSICAL DEVICE
	JMS	RFADJX		/NODE.
	LAC	11,X		/SET BIT 1 IN THE "ASSIGN INHIBIT" FLAG
	RTL			/TO SIGNAL THE "REASSIGN" MCR FUNCTION
	STL			/TASK THAT FILES ARE OPEN ON THE RF.
	RTR
	DAC	11,X
	CLA!IAC			/FOR SUCCESSFUL COMPLETION OF A FILE OPEN
	PAL			/DIRECTIVE, RETURN +1 IN THE LR AND BYPASS
	JMP*	RFOPED		/THE CODE THAT WOULD DECREMENT THE I/O
				/PENDING COUNT (SEE RESIDENT CODE).
	.TITLE *** ENTER (OPEN SEQUENTIAL FILE FOR OUTPUT)
/
RFENTR	JMS	RFCOM1		/COMMON SETUP CODE: INTEGRITY CHECKS,
				/GET AND INITIALIZE A FILE BUFFER.
	NOP			/ARG. 1 -- MEANS ERROR IF FILE ACTIVE.
				/(ASSUME THAT ALL ACTIVE REGISTERS ARE ALTERED).
				/RETURN HERE IF NO ERROR OCCURRED.
/
/ THE XR IS POINTING AT THE FILE BUFFER.
/
	JMS	RFUFDS		/NUMBER OF THE FIRST UFD BLOCK.
RFGBLN	DAC	RF.BLK,X	/SET THE CURRENT BLOCK NUMBER.
	JMS*	RFGTBL		/READ IN THE CURRENT BLOCK.
				/(EFFECTIVELY, ALL ACTIVE REGISTERS ARE
				/ALTERED; THE XR IS LEFT POINTING AT THE
				/FILE BUFFER).
	JMP	RFDKER		/#/ RETURN HERE, IF AN ERROR OCCURRED,
				/WITH THE ERROR CODE IN THE AC.
				/RETURN HERE OTHERWISE.
	JMS	RFSRCH		/SEARCH THE UFD BLOCK FOR A FREE FILE
				/ENTRY SLOT AND FOR THE EXISTENCE OF
				/THE OLD FILE ENTRY.
				/(X10, LR, AC & RF.CNT ARE ALTERED).
	LAC	RF.OFF,X	/WAS THE OLD FILE FOUND?
	SZA
	JMP	RFENFF		/YES.
/
/ THE CURRENT UFD BLOCK DOES NOT CONTAIN THE FILE OR ELSE THE FILE WAS
/ FOUND BUT A FREE SLOT WAS NOT. PREPARE TO READ IN THE NEXT UFD BLOCK
/ IF ONE EXISTS.
/
RFNUFD	LAC	RF.DAT+377,X	/IS THIS THE FINAL UFD BLOCK?
	SAD	RFL002		/SAD (-1).
	SKP			/YES.
	JMP	RFGBLN		/NO -- READ IN THE NEXT ONE.
/
/ THE FINAL UFD BLOCK HAS BEEN READ. IF A FREE FILE ENTRY SLOT HAS NOT
/ BEEN FOUND, ADD ANOTHER BLOCK TO THE UFD.
/
	LAC	RF.FEF,X	/WAS A FREE ENTRY FOUND?
	SZA
	JMP	RFNTER		/YES.
	JMS*	RFAL1B		/NO -- ALLOCATE A BLOCK OF 256 WORDS
				/ON THE DISK.
				/(EFFECTIVELY, ALL REGISTERS + RFTMP1
				/ARE ALTERED).
				/WAS A BLOCK ALLOCATED?
	JMP	RFDKER		/#/ NO -- ERROR CODE IS IN THE AC.
/
/ THE XR IS POINTING AT THE FILE BUFFER.
/
	DAC	RF.DAT+377,X    /YES -- SET THE FORWARD LINKAGE IN THE
				/CURRENT UFD BLOCK (WHICH WILL NOW BE
				/THE NEXT TO LAST UFD BLOCK) TO POINT
				/TO THE NEWLY ALLOCATED BLOCK.
	JMS*	RFPTBL		/WRITE OUT THE CURRENT UFD BLOCK.
				/(EFFECTIVELY, ALL ACTIVE REGISTERS ARE
				/ALTERED -- THE XR IS LEFT POINTING AT
				/THE FILE BUFFER).
	DAC	RFERCD		/#/ RETURN HERE, IF AN ERROR OCCURRED, WITH
				/THE ERROR CODE IN THE AC.
				/RETURN HERE IF NO ERROR OCCURRED.
/
/ *********************************************************************
/
/ NOTE -- I/O SHOULD NOT BE ABORTED AT THIS POINT SINCE THE UFD IS
/ NOW OPEN-ENDED, I.E., THE FORWARD LINK IN THE LAST UFD BLOCK ISN'T -1.
/
/ *********************************************************************
/
/ INITIALIZE THE NEWLY-CREATED UFD BLOCK.
/
	LAC	RF.BLK,X	/SAVE THE NUMBER OF THE NEXT-TO-LAST
	DAC	RF.DAT+376,X    /UFD BLOCK AS THE BACKWARD LINK.
	LAC	RF.DAT+377,X    /MAKE THE NEWLY ALLOCATED UFD BLOCK
	DAC	RF.BLK,X	/THE CURRENT DISK BLOCK.
	LAW	-1		/SET THE FORWARD BLOCK LINKAGE WORD
	DAC	RF.DAT+377,X    /TO INDICATE THIS IS THE LAST BLOCK.
	JMS	RFDBFA		/GET THE FILE DATA BUFFER ADDRESS AND ZERO
	JMS	RFZERO		/ALL BUT THE LAST 2 WORDS IN THE DATA BUFFER.
	-376			/(X10, RFTMP1 & AC ARE ALTERED).
	JMS	RFSRCH		/SEARCH THE UFD BLOCK FOR A FREE FILE
				/ENTRY SLOT.
				/(X10, LR, AC & RF.CNT ARE ALTERED).
	JMP	RFENTF		/ENTER THE FILE PARAMETERS.
/
/ THE FILE HAS BEEN FOUND. IF IT IS A RANDOM ACCESS FILE, THE "ENTER" IS
/ ILLEGAL. IF IT IS A TRUNCATED SEQUENTIAL ACCESS FILE, IT EXISTS ONLY
/ BECAUSE OF A PREVIOUS DISK MALFUNCTION. TRUNCATED FILES NORMALLY
/ EXIST ONLY WHILE THEY ARE BEING CREATED, AND THAT CONDITION WOULD
/ HAVE BEEN DETECTED ABOVE. THE TRUNCATED FILE'S ENTRY WILL BE USED
/ TO CREATE THE NEW FILE. WHATEVER BLOCKS WERE USED FOR THE TRUNCATED
/ FILE ARE LOST. IF IT IS A NORMAL FILE, IT WILL BE RETAINED UNTIL
/ AFTER THE NEW FILE IS SUCCESSFULLY CLOSED OUT. THIS IS DONE IN
/ CASE THE TASK CREATING THE NEW VERSION OF THE FILE IS ABORTED.
/
RFENFF	LAC	RFTYPE		/IS THE OLD FILE A SEQUENTIAL ACCESS TYPE?
	SPA
	JMP	RFCONF		/#/ NO -- ERROR.
/
	LAC	RF.OFS,X	/IS THE OLD FILE TRUNCATED?
	SPA
	JMP	RFUSET		/YES.
/
	.EJECT
/ THE OLD FILE IS O.K. AND WILL BE RETAINED.
/
	LAC	RF.FEF,X	/WAS A FREE SLOT FOUND?
	SZA
	JMP	RFNTER		/YES.
	JMP	RFNUFD		/NO.
/
/ USE THE OLD TRUNCATED FILE'S UFD SLOT FOR THE NEW FILE.
/
RFUSET	LAC	RFUFDB		/SET THE "FREE ENTRY FOUND" FLAG.
	DAC	RF.FEF,X
	LAC	RF.OFB,X	/SET THE ENTRY'S UFD BLOCK NUMBER.
	DAC	RF.FEB,X
	LAC	RF.OFL,X	/SET THE ENTRY'S RELATIVE LOCATION
	DAC	RF.FEL,X	/WITHIN THE BLOCK.
	DZM	RF.OFF,X	/CLEAR THE "OLD FILE FOUND" FLAG.
	JMP	RFENTF		/ENTER THE FILE PARAMETERS.
/
/ PREPARE TO ENTER THE FILE NAME INTO THE DIRECTORY. FIRST, MAKE SURE
/ THAT THE PROPER UFD BLOCK IS IN CORE.
/
RFNTER	LAC	RF.FEB,X	/IS THE CURRENT BLOCK THE ONE WITH THE
	SAD	RF.BLK,X	/FREE ENTRY?
	JMP	RFENTF		/YES.
	DAC	RF.BLK,X	/NO -- READ IN THAT UFD BLOCK.
	JMS*	RFGTBL		/(EFFECTIVELY, ALL ACTIVE REGISTERS ARE
				/ALTERED; THE XR IS LEFT POINTING AT THE
				/FILE BUFFER).
	JMP	RFDKER		/#/ RETURN HERE, IF AN ERROR OCCURRED,
				/WITH THE ERROR CODE IN THE AC.
				/RETURN HERE OTHERWISE.
/
/ CHANGE THE FREE FILE ENTRY SLOT IN THE UFD TO ENTER THIS FILE.
/
RFENTF	JMS	RFDBFA		/SET AUTOINDEX REGISTER 10 IN ORDER
	AAC	-1		/TO STORE THE FILE PARAMETERS IN THE
	TAD	RF.FEL,X	/FREE ENTRY SLOT.
	DAC*	(X10)
/
	LAC	RF.FN1,X	/STORE THE FILE NAME.
	DAC*	X10
	LAC	RF.FN2,X
	DAC*	X10
	LAC	RF.EXT,X	/STORE THE FILE NAME EXTENSION.
	DAC*	X10
	LAC	(400000)	/INDICATE "TRUNCATED FILE" AND DON'T
	DAC*	X10		/WORRY ABOUT THE FILE'S STARTING
				/BLOCK NUMBER. THAT WILL BE FILLED
				/IN WHEN THE FILE IS CLOSED.
	DZM*	X10		/SET THE FILE LENGTH TO ZERO -- THAT
				/WILL BE FILLED IN WHEN THE FILE IS CLOSED.
				/ALSO, BIT ZERO=0 INDICATES THAT THIS IS
				/A SEQUENTIAL RATHER THAN A RANDOM ACCESS FILE.
	DZM*	X10		/WORDS 5 AND 6 ARE ALWAYS ZERO.
	DZM*	X10
/
/ COMPUTE THE DATE AS IS DONE FOR DOS-15.
/
	CLQ			/STORE THE DATE IN THE FORM: MM/DD/YY,
				/WHERE YY=0 FOR 1970.
	.INH			/INHIBIT INTERRUPTS.
	LAC*	(YEAR
	AAC	-106
	AND	(77
	DAC	RFTMP1
	LAC*	(MONTH
	AND	(77
	PAL
	LAC*	(DAY
	.ENB
	AND	(77
	CLQ
	LRS	6
	PLA
	LRS	6
	LACQ
	TAD	RFTMP1
	DAC*	X10		/DATE THE FILE WAS CREATED.
/
/ WRITE THE UFD BLOCK ONTO THE DISK.
/
	JMS*	RFPTBL		/(EFFECTIVELY, ALL ACTIVE REGISTERS ARE
				/ALTERED -- THE XR IS LEFT POINTING AT
				/THE FILE BUFFER).
	JMP	RFDKER		/#/ RETURN HERE, IF AN ERROR OCCURRED, WITH
				/THE ERROR CODE IN THE AC.
				/RETURN HERE IF NO ERROR OCCURRED.
	LAC	RFERCD		/DID AN ERROR OCCUR PREVIOUSLY WHILE
	SZA			/WRITING OUT THE NEXT-TO-LAST UFD BLOCK?
	JMP	RFDKER		/#/ YES.
	JMP	RFRQOC		/NO -- I/O REQUEST COMPLETED.
	.TITLE *** DIRECTORY SEARCH SUBROUTINE
/
/ SUBROUTINE RFSRCH -- A UFD BLOCK IS IN THE FILE DATA BUFFER. SEARCH
/ THE BLOCK FOR A FREE FILE ENTRY SLOT AND ALSO FOR THE FILE NAME IN
/ QUESTION.
/
/ CALLING SEQUENCE:
/
/	XR POINTING AT THE FILE BUFFER
/	JMS	RFSRCH
/	(UNCONDITIONAL RETURN)
/
/ THE CALLER MUST INITIALIZE THE FREE-ENTRY-FOUND FLAG (RF.FEF) AND
/ THE OLD-FILE-ENTRY-FOUND FLAG (RF.OFF) IN THE FILE BUFFER AS
/ APPROPRIATE.
/
/ ALTERED REGISTERS:
/
/	X10, LR, AC & RF.CNT
/
RFSRCH	0
	LAW	-37		/NUMBER OF FILE ENTRIES PER UFD BLOCK.
	DAC	RF.CNT
	DZM	RF.REL		/RELATIVE POSITION WITHIN THE BLOCK.
	JMS	RFDBFA		/PREPARE AUTOINDEX REGISTER 10 TO
	AAC	-1		/SCAN THROUGH THE DATA BLOCK (UFD).
/
RFSRCL	DAC*	(X10)
	PAL			/SAVE TEMPORARILY.
	LAC*	X10		/FIRST HALF OF FILE NAME MATCH?
	SAD	RF.FN1,X
	SKP
	JMP	RFSRFE		/NO -- TRY FOR FREE ENTRY.
	LAC*	X10		/YES -- SECOND HALF MATCH?
	SAD	RF.FN2,X
	SKP
	JMP	RFSRCE		/NO.
	LAC*	X10		/YES -- EXTENSION MATCH?
	SAD	RF.EXT,X
	SKP
	JMP	RFSRCE		/NO.
/
/ OLD FILE ENTRY FOUND -- RECORD ITS LOCATION AND TYPE.
/
	LAC	RF.BLK,X	/NUMBER OF THE CURRENT UFD BLOCK.
	DAC	RF.OFB,X
	LAC	RF.REL		/RELATIVE LOCATION WITHIN THE BLOCK.
	DAC	RF.OFL,X
	LAC*	X10		/BIT 0 = 1 INDICATES A TRUNCATED FILE AND
	DAC	RF.OFS,X	/BITS 1-17 = THE STARTING BLOCK NUMBER.
	LAC*	X10		/SAVE THE FILE TYPE (BIT 0): SEQUENTIAL (0)
	DAC	RFTYPE		/OR RANDOM ACCESS (1).
RFL002	LAW	-1		/[USED AS A LITERAL].
	DAC	RF.OFF,X	/SET FLAG TO INDICATE "OLD FILE FOUND".
	JMP	RFSRCE
/
/ TEST FOR FREE ENTRY IN UFD.
/
RFSRFE	SZA			/ENTRY = 0?
	JMP	RFSRCE		/NO -- NOT A FREE ENTRY.
	LAC	RF.FEF,X	/YES -- HAS A FREE ENTRY ALREADY BEEN FOUND?
	SZA
	JMP	RFSRCE		/YES.
	LAC*	X10		/NO -- WORD 2 = 0?
	SZA!CLC
	JMP	RFSRCE		/NO -- NOT A FREE ENTRY.
	SAD*	X10		/YES -- WORD 3 = 0?
	JMP	RFSRCE		/NO -- NOT A FREE ENTRY.
/
/ FREE FILE ENTRY FOUND -- RECORD ITS LOCATION.
/
	LAC	RFUFDB		/GET THE STATING BLOCK OF THE UFD
	DAC	RF.FEF,X	/SET THE FLAG TO INDICATE "FREE FILE
				/ENTRY FOUND".
	LAC	RF.BLK,X	/NUMBER OF THE CURRENT UFD BLOCK.
	DAC	RF.FEB,X
	LAC	RF.REL		/RELATIVE POSITION WITHIN THE UFD BLOCK.
	DAC	RF.FEL,X
/
/ MOVE TO THE NEXT UFD FILE ENTRY AND TEST FOR THE END OF THE BLOCK.
/
RFSRCE	ISZ	RF.CNT		/END OF UFD BLOCK?
	SKP			/NO.
	JMP*	RFSRCH		/YES -- RETURN.
	LAC	RF.REL		/UPDATE THE RELATIVE FILE ENTRY LOCATION.
	AAC	+10
	DAC	RF.REL
	PLA			/UPDATE AUTOINCREMENT REGISTER 10 FOR
	AAC	+10		/THE NEXT ENTRY.
	JMP	RFSRCL
	.TITLE *** DIRECTORY DIRECTIVES COMMON SETUP SUBROUTINE
/
/ SUBROUTINE RFCOM1 -- INITIALIZATION CODE FOR "OPEN" DIRECTIVES: COMPUTE
/ PAGE ADDRESS PARAMETERS, DISSECT THE I/O REQUEST NODE, SEARCH THE ACTIVE
/ LUN DEQUE TO BE SURE THAT THE FILE IS NOT BEING USED IN CONFLICT WITH
/ THE PRESENT REQUEST, VALIDATE THE FILE NAME AND EXTENSION, GET A FILE
/ BUFFER, AND ADD A NODE TO THE ACTIVE LUN DEQUE.
/
/ CALLING SEQUENCE:
/
/	JMS	RFCOM1
/	SKP (OR NOP)
/	(RETURN HERE IF NO ERROR OCCURRED)
/
/	ARGUMENT 1 --	IF THE FILE IS ALREADY IN USE ON SOME OTHER LUN,
/			"SKP" MEANS THAT IT IS ALRIGHT PROVIDED THAT THE
/			FILE IS OPEN ONLY FOR INPUT -- "NOP" MEANS THIS
/			IS ALWAYS AN ERROR.
/
/ ALTERED REGISTERS:
/
/	ASSUME THAT ALL ACTIVE REGISTERS ARE ALTERED
/
RFCOM1	0
	LAC	RFCOM1		/COMPUTE THE PAGE ADDRESS BITS FOR THIS
	AND	(70000)		/OVERLAY AND SAVE THEM IN BOTH POSITIVE
	DAC	RFPAGE		/AND NEGATIVE FORM.
	TCA
	DAC	RFXADJ
/
/ PICK UP THE PARAMETERS FROM THE I/O REQUEST NODE.
/
	LAC*	RFRQND		/SET UP THE XR TO ACCESS THE NODE.
	JMS	RFADJX
	LAC	5,X		/SAVE THE CAL FUNCTION CODE.
	AND	(777)
	DAC	RFFCOD
	LAC	7,X		/SAVE I/O ARGUMENT 1.
	DAC	RFARG1
	LAC	10,X		/SAVE I/O ARGUMENT 2.
	DAC	RFARG2
	LAC	11,X		/SAVE I/O ARGUMENT 3.
	DAC	RFARG3
/
	.EJECT
/ SEARCH THE ACTIVE LUN DEQUE TO SEE IF THE FILE IS ALREADY IN USE.
/
	LAC	RFALUN		/SET THE INDEX REGISTER TO START AT
	JMS	RFADJX		/THE HEAD OF RFALUN.
/
RFALLP	LAC*	RFRQND		/SET AUTOINCREMENT REGISTER 10 TO
	IAC			/ACCESS THE TASK NAME IN THE REQUEST NODE.
	DAC*	(X10)
/
/ TEST FOR END OF DEQUE.
/
	LAC	0,X		/END OF RFALUN DEQUE?
	SAD	RFALUN
	JMP	RFANEW		/YES.
	JMS	RFADJX		/NO -- SET THE INDEX REGISTER TO
				/POINT TO THE NEXT NODE.
/
/ TEST FOR TASK NAME. (ACTUALLY, IT IS NOT A TASK NAME -- SEE COMMENTS
/ AT "RFALUN" IN RESIDENT CODE).
/
	LAC	2,X		/FIRST HALF OF TASK NAME FOUND?
	SAD*	X10
	SKP
	JMP	RFALCF		/NO -- TRY NEXT CHECK.
	LAC	3,X		/SECOND HALF FOUND?
	SAD*	X10
	SKP
	JMP	RFALCF		/NO -- TRY NEXT CHECK.
/
/ TEST FOR LUN.
/
	LAC*	X10		/SKIP THE PRIORITY CODE.
	LAC	5,X		/DO THE LUNS MATCH?
	XOR*	X10
	AND	RFL001		/AND (777000).
	SZA
	JMP	RFALCF		/NO -- TRY NEXT CHECK.
/
	.EJECT
/#/ THE TASK-LUN NODE IN RFALUN HAS BEEN FOUND. THAT MEANS THAT THAT TASK
/ STILL HAS A FILE OPEN ON THAT LUN, WHICH IS AN ERROR.
/
	LAW	-10
	DAC*	RFCLFL		/SET A FLAG FOR THE "DONE" CODE SO THAT
				/IT WILL CLOSE THE FILE.
	JMP*	RFSREV
/
/ CHECK THE ACTIVE LUN TO SEE IF THIS FILE IS ALREADY OPEN.
/
RFALCF	PXA
	LMQ			/SAVE THE NODE'S ADJUSTED ADDRESS IN THE MQ.
	LAC	11,X		/SET THE XR TO POINT TO THIS FILE'S
	JMS	RFADJX		/CORE BUFFER.
	LAC	RF.FN1,X	/FIRST HALF OF FILE NAME MATCH?
	SAD	RFFNM1
	SKP
	JMP	RFNALN		/NO.
	LAC	RF.FN2,X	/YES -- SECOND HALF?
	SAD	RFFNM2
	SKP
	JMP	RFNALN		/NO.
	LAC	RF.EXT,X	/YES -- EXTENSION?
	SAD	RFFEXT
	SKP
	JMP	RFNALN		/NO.
/
/ THIS FILE IS BEING MANIPULATED VIA ANOTHER LUN OR BY A DIFFERENT TASK.
/ EXECUTE ARGUMENT 1 IN THE CALL TO THIS SUBROUTINE (SKP OR NOP) TO
/ DETERMINE IF THIS IS AN ERROR.
/
	XCT*	RFCOM1		/SKP OR NOP.
	JMP	RFFLP1		/#/ POSSIBLE ERROR
	LAC	RF.OPN,X	/IS THE FILE ONLY BEING READ?
	SAD	(032)
	SKP			/YES -- O.K.
	JMP	RFFLM1		/#/ NO -- POSSIBLE ERROR
/
/ TRY NEXT RFALUN NODE.
/
RFNALN	LACQ			/RESTORE THE XR.
	PAX
	JMP	RFALLP		/TRY THE NEXT NODE.
/
	.EJECT
/ 
/ HERE WE NEED TO SEE IF THE TWO FILES THAT ARE OPEN ARE ON
/ DIFFERENT UNITS OR DIFFERENT UFDS. IF THEY ARE THEN THERE'S
/ NO ERROR. HOWEVER, IF THE FILES MIGHT BE OPENED ON THE SAME
/ UNIT AND UFD THEN THAT'S AN ERROR.
/
RFFLP1	CLC			/SET FLAG TO GO TO RFFLOP ON ERROR
	DAC	RFTMP6
	SKP
RFFLM1	DZM	RFTMP6		/SET FLAG TO GO TO RFFLOM ON ERROR
	LACQ			/PREPARE TO ACCESS RFALUN
	PAX
	.IFUND %RF15
	LAC	7,X		/ARE THE UNIT NOS. THE SAME?
	SAD*	RFUNIT
	SKP
	JMP	RFALLP		/NO -- THEN THERE'S NO ERROR
	.ENDC
	LAC*	(LUFD1		/YES -- CALC ADDR OF LUN-UFD ENTRY
	AAC	-1
	TAD*	RFLUNN
	DAC	RFTMP1		/SAVE THIS ADDRESS
	LAC*	RFTMP1		/GET THE UFD NAME
	DAC	RFTMP2		/SAVE IT
	LAC	5,X		/GET THE LUN FOR THE OPEN FILE
	SWHA
	TAD*	(LUFD1		/CALC ADD OF LUN-UFD ENTRY
	AAC	-1
	DAC	RFTMP1		/SAVE IT
	LAC*	RFTMP1		/GET THE UFD NAME FOR THE OPEN FILE
	SAD	RFTMP2		/SAME AS FOR FILE NOW BEING OPENED?
	SKP
	JMP	RFALLP		/NO -- OK, NO ERROR
	LAC	RFTMP6		/#/YES -- FILE NAME CONFLICT
	SNA			/WHERE TO GO -- RFFLOM OR RFFLOP?
	JMP	RFFLOM
	JMP	RFFLOP
/
	.EJECT
/ A SCAN OF THE RFALUN DEQUE DID NOT TURN UP A NODE FOR THE TASK-LUN
/ COMBINATION OF THE CURRENT I/O REQUEST. VALIDATE THE FILE NAME AND
/ EXTENSION, GET A FILE BUFFER, AND THEN CREATE SUCH A NODE.
/
RFANEW	LAC	RFFNM1		/IS THE FILE NAME NULL?
	SZA!CLA
	JMP	.+3
	SAD	RFFNM2
	JMP	RFIFNM		/#/ YES -- ERROR.
	SAD	RFFEXT		/WHAT ABOUT THE EXTENSION?
	JMP	RFIFNM		/#/ YES -- ERROR.
/
/ PICK UP AN EMPTY NODE IN ORDER TO CREATE AN ENTRY FOR RFALUN.
/
	JMS*	(PENP)		/PICK AN EMPTY NODE FROM THE POOL.
				/(R1, R6, XR & AC ARE ALTERED).
				/WAS A NODE FOUND?
	JMP	RFAPLE		/#/ NO -- POOL IS EMPTY.
	DAC	RFTMP1		/YES -- SAVE ITS ADDRESS.
	LAC*	RFRQND		/SET R2 WITH THE I/O REQUEST NODE ADDRESS.
	DAC*	(R2)
	LAC	(400+RF.DAT)    /SET R4 WITH THE DESIRED BUFFER SIZE.
	DAC*	(R4)
	JMS*	(ALBF)		/ALLOCATE A BUFFER.
				/(R1, R3, R4, R5, R6, X10, X11, X12,
				/XR & AC ARE ALTERED).
				/ERROR?
	JMP	RFNOBF		/#/ YES.
	DAC*	RFBFAD		/NO -- SAVE ITS ADDRESS.
	LAC	RFTMP1
	DAC*	(R2)		/SAVE THE NODE'S ADDRESS
				/IN R2 FOR THE CALL (BELOW) TO "NADD".
	DAC	RFALNA
	JMS	RFADJX		/SET THE NODE'S ADDRESS IN THE XR.
/
/ ENTER PARAMETERS INTO THE NEW RFALUN NODE. THE TASK NAME IS NOT REALLY
/ A TASK NAME -- SEE "RFALUN" IN RESIDENT CODE.
/
	LAC*	RFRQND		/ADDRESS OF THE I/O REQUEST NODE.
	IAC
	DAC*	(X10)
	LAC*	X10		/TASK NAME (1ST HALF).
	DAC	2,X
	LAC*	X10		/TASK NAME (2ND HALF).
	DAC	3,X
	LAC*	X10		/SKIP TASK PRIORITY.
RFL001	777000			/[WORD USED AS A LITERAL].
	AND*	X10		/LUN CODE IS IN THE LEFT HALF.
	DAC	5,X
	.IFUND %RF15
	LAC*	RFPDNA		/SAVE THE ADDRESS OF THE PDVL NODE
	DAC	6,X
	LAC*	RFUNIT		/SAVE THE UNIT NUMBER OF THE DISK
	DAC	7,X
	.ENDC
	LAC*	RFBFAD		/SAVE THE BUFFER ADDRESS.
	DAC	11,X
/
	.EJECT
/ INSERT THE NEW NODE IN THE RFALUN DEQUE.
/
	LAC	RFALUN		/START OF THE RFALUN DEQUE.
	DAC*	(R1)
	JMS*	(NADD)		/INSERT NODE.
				/(R2, R6, XR & AC ARE ALTERED).
	JMS	RFXRFB		/SET THE XR TO POINT TO THE FILE BUFFER.
	TAD	RFPAGE		/COMPUTE THE ADDRESS OF THE BUFFER AND
	JMS	RFZERO		/THEN ZERO OUT THE FILE DESCRIPTORS.
	-RF.DAT			/ARGUMENT -- NEGATIVE WORD COUNT.
				/(X10, RFTMP1 & AC ARE ALTERED).
	LAC	RFFCOD		/SAVE THE CAL FUNCTION CODE IN THE
	DAC	RF.OPN,X	/"FILE OPEN" WORD.
	LAC	RFFNM1		/SAVE THE FILE NAME AND EXTENSION.
	DAC	RF.FN1,X
	LAC	RFFNM2
	DAC	RF.FN2,X
	LAC	RFFEXT
	DAC	RF.EXT,X
/
/ EXIT WITH THE XR POINTING AT THE FILE BUFFER.
/
	IDX	RFCOM1
	JMP*	RFCOM1
/
/ SINCE NONE OF THE FOLLOWING ERRORS REQUIRE THAT A FILE BE CLOSED, THERE
/ IS NO NEED TO RETURN TO THE CALLING ROUTINE. THE I/O FUNCTION IS,
/ EFFECTIVELY, IGNORED.
/
RFIFNM	LAW	-53		/ILLEGAL FILE NAME OR EXTENSION.
	SKP
RFFLOP	LAW	-54		/FILE OPEN ELSEWHERE.
	SKP
RFFLOM	LAW	-55		/FILE OPEN FOR MODIFICATION ELSEWHERE.
	SKP
RFAPLE	LAW	-777		/"POOL" IS EMPTY.
	JMP*	RFSREV
RFNOBF	LAC	RFTMP1		/RETURN THE NODE TO THE EMPTY POOL.
	JMS	RFRTND		/(R2, R6, XR & AC ARE ALTERED).
	LAW	-56		/NO FILE BUFFER AVAILABLE.
	JMP*	RFSREV
	.TITLE *** MISCELLANEOUS SUBROUTINES
/
/ SUBROUTINE RFADJX -- SET THE INDEX REGISTER FROM THE VALUE IN THE AC
/ BY ADDING THE INDEX ADJUSTMENT FACTOR, WHICH COMPENSATES FOR THE
/ PAGE ADDRESS BITS ADDED FOR MEMORY REFERENCE INSTRUCTIONS.
/
/ CALLING SEQUENCE:
/
/	UNADJUSTED VALUE IN THE AC
/	JMS	RFADJX
/	(UNCONDITIONAL RETURN)
/
/ ALTERED REGISTERS:
/
/	AC & XR
/
RFADJX	0
	TAD	RFXADJ
	PAX
	JMP*	RFADJX
/
/
/
/
/
/ SUBROUTINE RFRTND -- RETURN A NODE TO THE POOL OF EMPTY NODES.
/
/ CALLING SEQUENCE:
/
/	NODE ADDRESS IN THE AC
/	JMS	RFRTND
/	(UNCONDITIONAL RETURN)
/
/ ALTERED REGISTERS:
/
/	R2, R6, XR & AC
/
RFRTND	0
	DAC*	(R2)		/SAVE THE NODE'S ADDRESS.
	LAC	(POOL)		/ADDRESS OF THE HEAD OF THE EMPTY POOL.
	DAC*	(R1)
	JMS*	(NADD)		/ADD THE NODE TO THE POOL.
				/(R2, R6, XR & AC ARE ALTERED).
	JMP*	RFRTND
/
	.EJECT
/ SUBROUTINE RFXRFB -- SET THE XR TO POINT TO THE FILE BUFFER.
/
/ CALLING SEQUENCE:
/
/	JMS	RFXRFB
/	(UNCONDITIONAL RETURN)
/
/ ALTERED REGISTERS:
/
/	AC & XR
/
RFXRFB	0
	LAC*	RFBFAD
	JMS	RFADJX
	JMP*	RFXRFB
/
/
/
/
/
/ SUBROUTINE RFDBFA -- COMPUTE THE ADDRESS OF THE FILE DATA BUFFER.
/
/ CALLING SEQUENCE:
/
/	XR POINTING AT THE FILE BUFFER
/	JMS	RFDBFA
/	(UNCONDITIONAL RETURN)
/
/ ALTERED REGISTERS:
/
/	AC
/
RFDBFA	0
	PXA
	TAD	RFPAGE
	TAD	(RF.DAT)
	JMP*	RFDBFA
/
	.EJECT
/ SUBROUTINE RFZERO -- CLEAR A SPECIFIED AREA OF CORE.
/
/ CALLING SEQUENCE:
/
/	STARTING ADDRESS IN THE AC
/	JMS	RFZERO
/	TWOS COMPLEMENT WORD COUNT
/	(UNCONDITIONAL RETURN)
/
/ ALTERED REGISTERS:
/
/	X10, RFTMP1 & AC
/
RFZERO	0
	AAC	-1		/PREPARE AUTOINDEX REGISTER 10 WITH THE
	DAC*	(X10)		/FIRST ADDRESS MINUS 1.
	LAC*	RFZERO		/PICK UP THE WORD COUNT.
	DAC	RFTMP1
	DZM*	X10		/ZERO CORE.
	ISZ	RFTMP1
	JMP	.-2
	IDX	RFZERO
	JMP*	RFZERO
	.EJECT
/
/
/
/
/ SUBROUTINE RFUFDS -- GET THE STARTING BLOCK OF A UFD INTO THE AC
/
/ CALLING SEQUENCE:
/
/	JMS	RFUFDS
/	(UNCONDITIONAL RETURN)
/
/ ALTERED REGISTERS:
/
/	AC, RFTMP1
/
RFUFDS	0
	JMS	RFXRFB		/SET THE XR TO POINT TO FILE BUFFER
	LAC*	(LUFD1		/CALC ADDR OF LUN-UFD TABLE ENTRY
	AAC	-1		/FOR THIS REQUEST
	TAD*	RFLUNN
	DAC	RFTMP1		/SAVE THE ADDR
	LAC*	RFTMP1		/GET UFD NAME FROM LUN-UFD TABLE
	SNA			/IS THIS UNIT DISMOUNTED?
	JMP	RFUIDR		/#/YES -- DECLARE ERROR
	DAC	RFTMP1		/NO -- SAVE THE UFD NAME
	.IFUND	%RP02
	LAC	(1777		/GET MFD'S STATING BLOCK FOR RF AND RK
	.ENDC
	.IFDEF	%RP02
	LAC	(47040
	.ENDC
RFMFD1	DAC	RF.BLK,X	/MAKE THIS BLOCK CURRENT
	JMS*	RFGTBL		/GET THE DISK BLOCK
	JMP	RFDKER		/#/RETURN HERE ON A DISK GET ERROR
	JMS	RFDBFA		/RETURN HERE IF SUCCESSFUL -- MAKE AC PT AT BUFFER
	AAC	-1		/SETUP X10 AS A POINTER TO THE BUFFER
	DAC*	(X10
	AAC	370		/SET UP RFTMP6 SO IT POINTS 1 BEFORE LAST ENTRY
	DAC	RFTMP6
RFMFD2	LAC*	X10		/GET AN MFD ENTRY
	SAD	RFTMP1		/DOES IT MATCH?
	JMP	RFMFD3		/YES
	LAC*	(X10		/NO -- IS THIS THE END OF THE MFD BLK?
	SAD	RFTMP6
	JMP	RFMFD4		/YES
	AAC	3		/NO -- INCREMENT X10 
	DAC*	(X10
	JMP	RFMFD2		/GO LOOK AT NEXT MFD ENTRY
RFMFD4	LAC	RF.DAT+377,X	/IS THIS THE LAST MFD BLOCK?
	SAD	(-1
	JMP	RFUIDR		/#/YES -- ERROR
	JMP	RFMFD1		/NO -- PREPARE TO GET NEXT MFD BLOCK
RFMFD3	LAC*	X10		/GET THE STARTING BLOCK OF THE UFD
	SAD	(-1		/IS IT INITIALIZED?
	JMP	RFUIDR		/#/NO -- ERROR
	DAC	RFUFDB		/YES -- SAVE BLOCK NUMBER
	JMP*	RFUFDS
	.TITLE *** FILE BUFFER STRUCTURE
/
/ FILE BUFFERS ARE CREATED IN THE TOP PART OF A TASK'S CORE PARTITION BY A
/ COMMON "GET BUFFER" SUBROUTINE WITHIN THE EXECUTIVE.
/ THE BEGINNING OF THE BUFFER IS USED FOR FILE STATUS DESCRIPTORS.
/ THESE ARE DEFINED BELOW RELATIVE TO THE BEGINNING OF THE BUFFER.
/
RF.FN1=0		/FILE NAME -- 1ST HALF.
RF.FN2=1		/FILE NAME -- 2ND HALF.
RF.EXT=2		/FILE NAME EXTENSION.
RF.OPN=3		/CAL FUNCTION CODE BY WHICH THIS FILE WAS OPENED.
RF.BLK=4		/CURRENT DISK DATA BLOCK NUMBER.
/
/ LOCATION OF A FREE FILE ENTRY IN THE UFD.
/
RF.FEF=5		/SET NON-0 (UFD START BLK) BY "RFSRCH" WHEN A FREE FILE
			/	ENTRY HAS BEEN FOUND.
RF.FEB=6		/NUMBER OF THE UFD BLOCK WHICH HAS A FREE FILE ENTRY.
RF.FEL=7		/RELATIVE LOCATION WITHIN THE UFD BLOCK OF THE
			/	FREE FILE ENTRY.
RF.FES=10		/THE NEW FILE'S STARTING BLOCK NUMBER.
/
/ LOCATION OF THE OLD FILE ENTRY IN THE UFD.
/
RF.OFF=11		/SET NON-0 (-1) BY "RFSRCH" IF THE FILE ALREADY
			/	EXISTS IN THE DIRECTORY.
RF.OFB=12		/NUMBER OF THE UFD BLOCK WHICH HAS THE OLD FILE ENTRY.
RF.OFL=13		/RELATIVE LOCATION WITHIN THE UFD BLOCK OF THE
			/	OLD FILE ENTRY.
RF.OFS=14		/BIT 0 = 1 IF THE FILE IS TRUNCATED.
			/BITS 1-17 = THE FILE'S STARTING BLOCK NUMBER.
/
/ READ AND WRITE PARAMETERS.
/
RF.DPT=15		/POINTER TO A DATA LINE IN THE FILE DATA BLOCK.
RF.PER=16		/SET NON-0 WHEN THE CURRENT DATA BLOCK
			/	HAS A PARITY ERROR.
RF.EOF=17		/SET NON-0 WHEN AN END-OF-FILE RECORD
			/	HAS BEEN READ.
RF.FSZ=20		/SIZE OF THE CURRENT OUTPUT FILE IN
			/	NUMBER OF DATA BLOCKS.
RF.NXB=21		/NEXT DATA BLOCK NUMBER ALLOCATED PRIOR
			/	TO WRITING OUT THE CURRENT BLOCK.
/
/ WITHIN THE FILE BUFFER THERE IS A FILE DATA BUFFER OF 256 (DECIMAL)
/ WORDS, WHICH STARTS IMMEDIATELY AFTER THE FILE STATUS DESCRIPTORS.
/ DATA BLOCKS ARE READ HERE FROM THE DISK OR ARE ASSEMBLED HERE AND
/ THEN WRITTEN TO THE DISK.
/
RF.DAT=22		/START OF 400 OCTAL WORD FILE DATA BLOCK.
	.TITLE *** VARIABLES AND CAL PARAMETER BLOCKS
/
/ VARIABLES.
/
RFFCOD	0			/I/O REQUEST FUNCTION CODE (BITS 9-17)
				/WITH 0 IN THE LEFT HALF.
RFARG1	0			/I/O ARGUMENT 1.
RFFNM1=RFARG1			/1ST HALF OF FILE NAME IN .SIXBT.
RFARG2	0			/I/O ARGUMENT 2.
RFFNM2=RFARG2			/2ND HALF OF FILE NAME IN .SIXBT.
RFARG3	0			/I/O ARGUMENT 3.
RFFEXT=RFARG3			/FILE NAME EXTENSION IN .SIXBT.
RFTMP1	0			/TEMPORARY STORAGE.
RFTMP6	0
RFTMP2	0
RFTMP3	0
	.IFUND %RF15
RFTMP4	0
	.ENDC
RFTMP5	0
RFUFDB	0			/STARTING BLOCK NUMBER OF THE UFD
RFPAGE	0			/PAGE ADDRESS BITS FOR THE PAGE IN WHICH
				/THIS CODE IS LOCATED.
RFXADJ	0			/INDEX REGISTER ADJUSTMENT FACTOR (SEE
				/INITIALIZATION CODE IN RESIDENT SECTION
				/FOR AN EXPLANATION). C(RFXADJ) = -C(RFPAGE).
RF.CNT	0			/COUNTER.
RF.REL	0			/RELATIVE POSITION WITHIN UFD BLOCK.
RFERCD	0			/TEMPORARY STORAGE FOR THE ERROR CODE.
RFALNA	0			/ADDRESS OF THE ACTIVE LUN NODE.
RFTYPE	0			/FILE TYPE (BIT 0): SEQUENTIAL ACCESS (0)
				/OR RANDOM ACCESS (1).
/
	.END
