.TITLE SETUP - Setup FDB For Open .IDENT /1.0/ .ENABL LC ;+ ; ; Free software BY ; Project Software & Development, Inc. ; ; This software is furnished for free and may be used and copied as ; desired. This software or any other copies thereof may be provided or ; otherwise made available to any other person. No title to and ; ownership of the software is hereby transferred or allowed. ; ; The information in this software is subject to change without notice ; and should not be construed as a commitment by PROJECT SOFTWARE ; AND DEVELOPMENT, INC. ; ; PROJECT SOFTWARE assumes no responsibility for the use or reliability ; of this software on any equipment whatsoever. ; ; Project Software & Development, Inc. ; 14 Story St. ; Cambridge, Ma. 02138 ; 617-661-1444 ; ; ; Title: SETUP.MAC ; Author: Robin Miller ; Date: November 8, 1982 ; ; Description: ; ; Setup the File Descriptor Block (FDB) for open. ; ; ; Modification History: ; ;- .ENABL AMA .NLIST BEX ; DEBUG = 0 ; DEFINE FOR DDT DEBUGGING .MCALL FDAT$R, FDOP$R, FDRC$R, FDBF$R, FDBK$R .MCALL FCSBT$, FDOFF$, NBOFF$ ; Define the FDB bit and offsets. .IF NDF DEBUG FCSBT$ ; Define FCS bits. FDOFF$ DEF$L ; Define FDB offsets. NBOFF$ DEF$L ; Define FNB offsets. .IFF FCSBT$ DEF$G ; Define FCS bits globally. FDOFF$ DEF$G ; Define FDB offsets globally. NBOFF$ DEF$G ; Define FNB offsets globally. .ENDC ; Dispatch tables for setting up the FDB's. .WORD IRECIO ; Analyze uses record I/O. ITABLE: .WORD IBLKIO ; Compress uses block I/O. .WORD IRECIO ; Decompress uses record I/O. .WORD ORECIO ; Analyze uses record I/O. OTABLE: .WORD ORECIO ; Compress uses record I/O. .WORD OBLKIO ; Decompress uses block I/O. .WORD ANLNB ; Analyze default name block. ONBTBL: .WORD DEFNB ; Compress default name block. .WORD OUTNB ; Decompress default name block. ;+ ; ; SETUP - Setup the FDB for opening the file. ; ;- SETUP:: JSR R2,$SAVVR ; Save R0 - R2. ; Clear the entire FDB's first. MOV TYPOPR,R1 ; Copy the type of operation. MOV #INFDB,R0 ; Address of the input FDB. CALL CLRFDB ; Clear the input FDB. CALL @ITABLE(R1) ; Setup the input FDB. MOV #OUTFDB,R0 ; Address of the output FDB. CALL CLRFDB ; Clear the output FDB. MOV ONBTBL(R1),R2 ; Address of default name block. CALL @OTABLE(R1) ; Setup the output FDB. 100$: RETURN .SBTTL CLRFDB - Clear The File Descriptor Block ;+ ; ; CLRFDB - Clear the file descriptor block. ; ; Inputs: ; R0 = address of the FDB to clear. ; ; Outputs: ; All registers are preserved. ; ;- CLRFDB: JSR R2,$SAVVR ; Save R0 - R2. MOV #S.FDB/2,R1 ; Size of the FDB in words. 10$: CLR (R0)+ ; Clear the entire FDB. SOB R1,10$ ; And loop until done. RETURN .SBTTL Setup The FDB for Record or Block I/O. ; Inputs: R0 = the FDB address, R2 = default FNB address. ; Setup the input FDB for record I/O. IRECIO: FDAT$R R0,,,#RECSIZ,, ; Maximum input record size. FDRC$R R0,,#RECADR,#RECSIZ ; Buffer address / max. length. FDOP$R R0,#INLUN,,#DEFNB,#FO.RD!FA.SHR ; Shared read access. FDBF$R R0,#INEFN,#BLKSIZ,, ; Event flag / FSR buffer size. RETURN ; Setup the output FDB for record I/O. ORECIO: FDAT$R R0,#R.VAR,#FD.CR,,#-10.,#-10. ; Variable / implied. FDRC$R R0,,#BUFADR,#RECSIZ ; Buffer address / max length. FDOP$R R0,#OUTLUN,,R2,#FO.WRT!FA.NSP ; Write / no supercede. FDBF$R R0,#OUTEFN,#BLKSIZ,, ; Event flag / FSR buffer size. RETURN ; Setup the input FDB for block I/O. IBLKIO: CLR IVBN ; Initialize the MOV #1,IVBN+2 ; virtual block number. FDRC$R R0,#FD.RWM,, ; Block I/O mode. FDBK$R R0,#RECADR,#BLKSIZ,#IVBN,#INEFN,#ISTAT, ; Buffer address / ; block size / virtual block number / ; event flag / I/O status block. FDOP$R R0,#INLUN,,#DEFNB,#FO.RD!FA.SHR ; Shared read access. MOV #STBLK,F.STBK(R0) ; Setup address of statistics block. RETURN ; ; Setup the output FDB for block I/O. ; ; Note: The file attributes section normally filled in by the ; FDAT$R macro, must be filled in from the header record ; of the input file before the file is opened. ; OBLKIO: CLR OVBN ; Initialize the MOV #1,OVBN+2 ; virtual block number. FDRC$R R0,#FD.RWM,, ; Block I/O mode. FDBK$R R0,#BUFADR,#BLKSIZ,#OVBN,#OUTEFN,#OSTAT, ; Buffer address / ; block size / virtual block number / ; event flag / I/O status block. FDOP$R R0,#OUTLUN,,R2,#FO.WRT!FA.NSP ; Write / no supercede. RETURN .END