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

  1. ;******************************************************************************
  2. ; Filename: WRITE.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 @write(LONG handle,PVOID buf,LONG len)
  12. ;  Comment: Writes data to a file
  13. ;    Input: Eax, handle - file handle
  14. ;           Edx, buf - pointer to write buffer
  15. ;           Ecx, len - length of block to write in bytes
  16. ;  Returns: The number of bytes actualy written or -1 if an error occured.
  17. ;******************************************************************************
  18.  
  19.     Include    STDDEF.INC
  20.  
  21.     Codeseg
  22.  
  23. Proc    write ,3
  24.         Push    Ebx,Edi,Esi
  25.         Mov    Ebx,Eax
  26.         Mov    Ah,40h
  27.         Int    21h
  28.         Jc    @@Error
  29.         Pop    Esi,Edi,Ebx
  30.         Ret
  31.     Align    4
  32. @@Error:    Mov    [Word errno],Ax
  33.     Ifdef    DEBUG
  34.         Call    printf,Offset ErrWriteMsg,Bx,Ax
  35.     Endif
  36.         Mov    Eax,-1
  37.         Pop    Esi,Edi,Ebx
  38.         Ret
  39. Endp
  40.  
  41.     Dataseg
  42.  
  43.     IfDef    DEBUG
  44. ErrWriteMsg    Db    "Error writing file with handle %h! Error: %h",LF,0
  45.     Endif
  46.  
  47.     End
  48.