home *** CD-ROM | disk | FTP | other *** search
/ Groovy Bytes: Behind the Moon / groovybytes.iso / GROOVY / SND_TOOL / FUNK108A.ZIP / DOS32V30.ZIP / PAL / FILEIO / LSEEK.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-05-20  |  1.3 KB  |  52 lines

  1. ;******************************************************************************
  2. ; Filename: LSEEK.ASM
  3. ;   Author: Peter Andersson
  4. ;  Version: 0.0
  5. ;  Created: 1994.06.05
  6. ;  Updated: 1995.03.10 PA - Changed to the _fastcall convention
  7. ;           1995.03.13 PA - Changed the name from fseek to lseek
  8. ;******************************************************************************
  9. ; Copyright Peter Andersson, 1994-1995.
  10. ; All rights reserved.
  11. ;******************************************************************************
  12. ; Function: LONG @lseek(LONG handle,LONG filepos,LONG whence)
  13. ;  Comment: Moves the file pointer within a file
  14. ;    Input: Eax, handle - file handle
  15. ;           Edx, filepos - file position
  16. ;           Ecx, whence - relative to start of file, current or end of file
  17. ;  Returns: new file position or -1 if an error occured
  18. ;******************************************************************************
  19.  
  20.     Include    STDDEF.INC
  21.  
  22.     Codeseg
  23.  
  24. Proc    lseek ,3
  25.         Push    Ebx
  26.         Mov    Ebx,Eax
  27.         Mov    Ah,42h
  28.         Mov    Al,Cl
  29.         Mov    Ah,42h
  30.         Int    21h
  31.         Jc    @@Error
  32.         Pop    Ebx
  33.         Mov    Eax,Edx
  34.         Ret
  35.     Align    4
  36. @@Error:    Mov    [Word errno],Ax
  37.     IfDef    DEBUG
  38.         Call    printf,Offset ErrSeekMsg,Bx,Ax
  39.     Endif
  40.         Pop    Ebx
  41.         Mov    Eax,-1
  42.         Ret
  43. Endp
  44.  
  45.     Dataseg
  46.  
  47.     IfDef    DEBUG
  48. ErrSeekMsg    Db    "Error seeking file with handle %h! Error: %h",LF,0
  49.     Endif
  50.  
  51.     End
  52.