home *** CD-ROM | disk | FTP | other *** search
- ;******************************************************************************
- ; Filename: READ.ASM
- ; Author: Peter Andersson
- ; Version: 0.0
- ; Created: 1994.06.05
- ; Updated: 1994.09.20
- ;******************************************************************************
- ; Copyright Peter Andersson, 1994-1995.
- ; All rights reserved.
- ;******************************************************************************
- ; Function: LONG @read(LONG handle,PVOID buf,LONG len)
- ; Comment: Reads data to memory
- ; Input: Eax, handle - file handle
- ; Edx, buf - file read buffer
- ; Ecx, len - number of bytes to read
- ; Returns: The number of bytes actualy read or -1 if an error occured
- ;******************************************************************************
-
- Include STDDEF.INC
-
- Codeseg
-
- Proc read ,3
- Push Ebx
- Mov Ebx,Eax
- Mov Ah,3Fh
- Int 21h
- Jc @@Error
- Pop Ebx
- Ret
- Align 4
- @@Error: Mov [Word errno],Ax
- IfDef DEBUG
- Call printf,Offset ErrReadMsg,Bx,Ax
- EndIf
- Pop Ebx
- Mov Eax,-1
- Ret
- Endp
-
- Dataseg
-
- IfDef DEBUG
- ErrReadMsg Db "Error reading file with handle %h! Error: %h",LF,0
- Endif
-
- End