.MCALL .MODULE .MODULE RDBLK,VERSION=05,COMMENT= ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; 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 provided 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 Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .ENABL GBL,LC .SBTTL Macro definitions .MCALL .READW .MCALL FDBDF$, FERDF$, DEFIN$, RT5DF$ FDBDF$ ;Define FDB offsets FERDF$ ;Define file service error codes DEFIN$ ;Definitions for IND files RT5DF$ ;Definition of ERRBYT .PSECT $RDBLK .SBTTL $RDBLK - Read logical block ;+ ;$RDBLK ;This routine reads a logical block from the specified file/device. ; ;Input: R1 = Address of FDB ; R3 = Block number to read ; R4 = Address of buffer ; R5 = Size of buffer in bytes ; ;Output: R1 = Address of FDB ; R3 = Block number read ; R4 = Address of buffer ; R5 = Size of buffer in bytes ; C-bit set if error ;- .ENABL LSB $RDBLK::SAVE CMP R3,F$BLKM(R1) ;Is the block number past end-of-file? BHIS 20$ ;Yes .ASSUME F$CHAN EQ 0 ;F$CHAN(R1) ASR R5 ;Convert byte count to words .READW #EMTBLK,@R1,R4,R5,R3 ;Read a block from the file BCS 10$ ;Branch if error MOV R3,F$BLKN(R1) ;Save block number MOV #,R0 ;Indicate success BR 40$ ;Return to caller 10$: MOV #,R0 ;Assume read error TSTB @#ERRBYT ;Was it by chance EOF? BNE 30$ ;Branch if not 20$: MOV #,R0 ;End-of-file detected 30$: SEC ;Set C-bit to indicate error 40$: MOV R0,F$ERR(R1) ;Save the error code RESTOR RETURN .DSABL LSB .END