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

  1. ;******************************************************************************
  2. ; Filename: CLOSE.ASM
  3. ;   Author: Peter Andersson
  4. ;  Version: 0.0
  5. ;  Created: 1994.06.05
  6. ;  Updated: 1994.09.20
  7. ;******************************************************************************
  8. ; Copyright Peter Andersson, 1994-1995.
  9. ; All rights reserved.
  10. ;******************************************************************************
  11. ; Function: LONG @close(LONG handle)
  12. ;  Comment: Closes a file
  13. ;    Input: Eax, handle - file handle
  14. ;  Returns: -1 if an error occured or 0 if alright
  15. ;******************************************************************************
  16.  
  17.     Include    STDDEF.INC
  18.  
  19.     Codeseg
  20.  
  21. Proc    close ,1
  22.         Push    Ebx
  23.         Mov    Ebx,Eax
  24.         Mov    Ah,3Eh
  25.         Int    21h
  26.         Jc    @@Error
  27.         Pop    Ebx
  28.         Clear    Eax
  29.         Ret
  30.     Align    4
  31. @@Error:    Mov    [Word errno],Ax
  32.     Ifdef    DEBUG
  33.         Call    printf,Offset ErrCloseMsg,Bx,Ax
  34.     Endif
  35.         Pop    Ebx
  36.         Mov    Eax,-1
  37.         Ret
  38. Endp
  39.  
  40.     Dataseg
  41.  
  42.     IfDef    DEBUG
  43. ErrCloseMsg    Db    "Error closing file with handle %h! Error: %h",LF,0
  44.     Endif
  45.  
  46.     End
  47.