	.TITLE	RBINIO
/ 
/ 
/                   FIRST PRINTING, FEBRUARY 1974
/ 
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO 
/ CHANGE WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED
/ AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPON-
/ SIBILITY FOR ANY ERRORS THAT MAY APPEAR IN THIS
/ DOCUMENT.
/ 
/ THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FUR-
/ NISHED TO THE PURCHASER UNDER A LICENSE FOR USE ON
/ A SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH
/ INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR 
/ USE IN SUCH SYSTEM, EXCEPT AS MAY OTHERWISE BE PRO-
/ VIDED IN WRITING BY DIGITAL.
/ 
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/ FOR THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIP-
/ MENT THAT IS NOT SUPPLIED BY DIGITAL.
/ 
/ COPYRIGHT (C) 1974, BY DIGITAL EQUIPMENT CORPORATION
/ 
/ 
        .EJECT
/
/COPYRIGHT 1971, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/
/EDIT #006  1-28-72   **REF**WAD
/
/ASSEMBLY PARAMTERS:
/
/DEFINE RSX FOR RSX SYSTEMS.
/NO PARAMETERS FOR DOS SYSTEMS.
/
/RANDOM ACCESS BINARY I/O OBJECT-TIME PACKAGE
/    CONTAINS ROUTINES TO INIT. A DEVICE FOR R.A.,
/    BINARY I/O AND TO DO I/O CLEANUP.
/    THE BINIO ROUTINES .RI, .RJ, .RK, .RL, AND .RB ARE
/    USED FOR RANDOM ACCESS I/O FOR THE DIFFERENT TYPES
/    OF DATA ELEMENTS AND FOR ARRAYS.
/
/ROY FOLK
/
/  INTERNAL .GLOBALS--
	.GLOBL	.RS		/INIT. DEVICE FOR R.A. BINARY READ
	.GLOBL	.RX		/INIT. DEVICE FOR R.A. BINARY WRITE
	.GLOBL	.RG		/R.A. BINARY I/O CLEANUP
	.GLOBL	RBINIO
RBINIO=.
/  EXTERNAL GLOBALS--
	.GLOBL	.FH		/R/W FLAG (FIOPS)
	.GLOBL	.RN		/R.A. FLAG (FIOPS)
	.GLOBL	.RCDNM		/RCD. NUM. (RANCOM)
	.GLOBL	.INRRW		/INIT. RANDOM R/W (RANCOM)
	.GLOBL	.MDSW		/MODS SW.: = 0 (BIN.); = 2 (ASCII)
	.GLOBL	.FNPTR		/PNTR. TO FIRST WD. OF RCD. (RANCOM)
	.GLOBL	.RIO		/RANDOM I/O (RANCOM)
	.GLOBL	.ADAVR		/ADDR. OF ASSOC. VAR. (RANCOM)
	.GLOBL	.LRFLG		/LAST FCD. FLG. (RANCOM)
	.GLOBL	.ER		/ERROR (OTSER)
	.GLOBL	.BUFLC		/BUFF. LOC. (BINIO)
	.GLOBL	.RDTV		/READ TRANS. VEC. (BINIO)
	.GLOBL	.IBLB		/INIT. BINARY LINE BUFF. (BINIO)
	.GLOBL	.WRTV		/WRITE TRANS. VEC. (BINIO)
	.GLOBL	.ER4		/REINIT. .ER (OTSER)
/
/CONSTANTS
S00000	000000
S00001	1
S00007	7
W00000	400000
/WORKING STORAGE
LDBNER	.DSA	BINEOR
TEMP	0
	.EJECT
/BINARY RANDOM READ AND WRITE
/
/  WRITE
/  CALLING SEQUENCE-
/	JMS	.RX
/	.DSA	ADDR. OF SLOT NUMBER
/	(AC HOLDS INTEGER RECORD NUMBER)
.RX	0
	DAC*	.RCDNM
	LAC	S00001
	DAC*	.FH		/SET F/W FLG.
	JMP	RWCOM
/  READ
/  CALLING SEQUENCE--
/	JMS	.RS
/	.DSA	ADDR OF SLOT NUMBER
/	(AC HOLDS INTEGER RECORD NUMBER)
.RS	0
	DAC*	.RCDNM
	DZM*	.FH		/SET R/W FLG.
	LAC	.RS
	DAC	.RX
RWCOM	LAC	W00000		/400000
	DAC*	.RN
	DZM*	.MDSW		/BIN. MODE
	LAC*	.RX		/ADDR. OF SLOT NUM.
	JMS*	.INRRW
	.IFUND RSX
/ONLY CHECK FILE HEADERS WITH DOS15.
	JMS	CHKBMD		/CHECK BINARY MODE
	.ENDC
/INIT. 	.IBLB AND .FI (IN BINIO) FOR R.A.
	LAC*	.FNPTR		/AC _ ADDR. OF FIRST WD OF RCD.
	DAC*	.BUFLC
	LAC	LDBNER		/CONTAINS BINEOR
	DAC*	.RDTV
	DAC*	.WRTV
/
	JMS*	.IBLB		/INIT. LINE BUF. PARAMS.
	ISZ	.RX		/INCREM. FOR RTN
	JMP*	.RX
	.EJECT
	.IFUND RSX
/CHECK BINARY MODE
/CALLING SEQUENCE--
/	JMS	CHKBMD
CHKBMD	0
	LAC*	.FNPTR		/ADDR. OF HDR. WD. 0 TO AC
	DAC	TEMP
	LAC*	TEMP		/HDR. WD. 0 TO AC
	AND	S00007		/MODE BITS
	SAD	S00000
	JMP*	CHKBMD
	JMS*	.ER		/BAD MODE OR EOF ERROR
	11
	.EJECT
	.ENDC
/BINARY END-OF-RECORD
/CALLING SEQUENCE--
/	JMS	BINEOR
BINEOR	0
	DZM*	.LRFLG		/CLR. LAST RCD. FLG
/PREPARE AND OUTPUT OLD RCD. (IF WRITE) AND SET
/  PTRS.  FOR NEW RCD.
	JMS*	.RIO
	LAC*	.FNPTR		/RESET .BUFLC FOR .IBLB INITIAL.
	DAC*	.BUFLC
/
	.IFUND RSX
/CHECK FILE HEADERS WITH DOS15 ONLY.
	JMS	CHKBMD		/CHECK BINARY MODE
	.ENDC
	JMS*	.IBLB		/INIT. L.B. PARAMS.
	JMP*	BINEOR
	.EJECT
/BINARY RANDOM ACCESS I/O CLEAN-UP
/CALLING SEQUENCE--
/	JMS	.RG
.RG	0
	LAC*	.ADAVR
	DAC	TEMP
	ISZ*	TEMP		/INCREM. ASSOC. VAR.
	LAC*	.FH
	SNA			/SKP IF WRITE
	JMP	RG1		/READ - RTN.
	ISZ*	.LRFLG		/SET LAST RCD. FLG.
	JMS*	.RIO		/OUTPUT FINAL RCDS.
RG1	LAC	(NOP		/REINIT. .ER
	DAC*	.ER4
	JMP*	.RG
	.END
