home *** CD-ROM | disk | FTP | other *** search
- ;******************************************************************************
- ; Filename: LSEEK.ASM
- ; Author: Peter Andersson
- ; Version: 0.0
- ; Created: 1994.06.05
- ; Updated: 1995.03.10 PA - Changed to the _fastcall convention
- ; 1995.03.13 PA - Changed the name from fseek to lseek
- ;******************************************************************************
- ; Copyright Peter Andersson, 1994-1995.
- ; All rights reserved.
- ;******************************************************************************
- ; Function: LONG @lseek(LONG handle,LONG filepos,LONG whence)
- ; Comment: Moves the file pointer within a file
- ; Input: Eax, handle - file handle
- ; Edx, filepos - file position
- ; Ecx, whence - relative to start of file, current or end of file
- ; Returns: new file position or -1 if an error occured
- ;******************************************************************************
-
- Include STDDEF.INC
-
- Codeseg
-
- Proc lseek ,3
- Push Ebx
- Mov Ebx,Eax
- Mov Ah,42h
- Mov Al,Cl
- Mov Ah,42h
- Int 21h
- Jc @@Error
- Pop Ebx
- Mov Eax,Edx
- Ret
- Align 4
- @@Error: Mov [Word errno],Ax
- IfDef DEBUG
- Call printf,Offset ErrSeekMsg,Bx,Ax
- Endif
- Pop Ebx
- Mov Eax,-1
- Ret
- Endp
-
- Dataseg
-
- IfDef DEBUG
- ErrSeekMsg Db "Error seeking file with handle %h! Error: %h",LF,0
- Endif
-
- End