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

  1.  
  2. ;    FILENAME: OFCREATE.ASM
  3. ;    Copyright (c) 1988 by Borland International, Inc.
  4. ;
  5. ;    Description: This module implements the routine FileCreate. FileCreate
  6. ;    creates or truncates a file. The file is opened for writing.
  7. ;    ASSEMBLY INSTRUCTIONS: To assemble this module use the following 
  8. ;    TASM command line. 
  9. ;        TASM ofcreate
  10.  
  11. include globals.inc
  12.  
  13. _TEXT   segment
  14.  
  15.     FileCreate proc
  16.  
  17.     ;    Input 
  18.     ;        bx - file record offset
  19.     ;        cx - buffer size
  20.     ;        dx - offset of filespec
  21.     ;    Output (of INT 21h, Function 3Ch)
  22.     ;        cf - set if error occurred
  23.     ;        ax - error code
  24.     ;            3 - if path not found
  25.     ;            4 - if no handle available
  26.     ;            5 - if access denied
  27.     ;    Registers modified 
  28.     ;        ax
  29.  
  30.     mov     WORD PTR [bx], 1  ;set status
  31.     mov     [bx+2], cx        ;save size
  32.     call    FileAlloc         ;allocate buffer
  33.     jc      filcre1           ;jump if error
  34.     mov     ah, 3ch           ;function
  35.     sub     cx, cx            ;file attribute - 00h normal
  36.     int     21h               ;execute
  37.     mov     [bx+8], ax        ;save handle
  38.     jnc     filcre1
  39.     call    FileFree          ;deallocate buffer
  40.     stc
  41. filcre1:
  42.     ret
  43.     FileCreate endp
  44.  
  45. _TEXT    ends
  46.  
  47. end
  48.