home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / tasm / ofopenw.asm < prev    next >
Assembly Source File  |  1988-08-28  |  1KB  |  52 lines

  1.  
  2. ;    FILENAME: OFOPENW.ASM
  3. ;    Copyright (c) 1988 by Borland International, Inc.
  4. ;
  5. ;    Description: This module implements the routine FileOpenW. FileOpenW
  6. ;    opens a file for writing.
  7. ;
  8. ;    ASSEMBLY INSTRUCTIONS: To assemble this module use the following 
  9. ;    TASM command line. 
  10. ;        TASM ofopenw
  11.  
  12. include globals.inc
  13.  
  14. _TEXT   segment
  15.  
  16.     FileOpenW proc
  17.  
  18.     ;    Input 
  19.     ;        bx - file record offset
  20.     ;        cx - buffer size
  21.     ;        dx - offset of filespec
  22.     ;    Output (of INT 21h, Function 3Dh)
  23.     ;        cf - set if error occurred
  24.     ;        ax - error code
  25.     ;            1 - if function number invalid (file-sharing must be loaded)
  26.     ;            2 - if file not found
  27.     ;            3 - if path not found of file doesn't exist
  28.     ;            4 - if no handle available
  29.     ;            5 - if access denied
  30.     ;          0Ch - if file access code invalid
  31.     ;    Registers modified
  32.     ;        ax
  33.  
  34.     mov     WORD PTR [bx], 1  ;set status
  35.     mov     [bx+2], cx        ;save size
  36.     call    FileAlloc         ;allocate buffer
  37.     jc      filopw1           ;jump if error
  38.     mov     ax, 3d01h         ;function and write access
  39.     int     21h               ;execute
  40.     mov     [bx+8], ax        ;save handle
  41.     jnc     filopw1
  42.     call    FileFree          ;deallocate
  43.     stc
  44. filopw1:
  45.     ret
  46.     FileOpenW endp
  47.  
  48. _TEXT    ends
  49.  
  50. end
  51.