home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-2.ZIP / GFUNC / CRNFILE.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-05-30  |  1.5 KB  |  77 lines

  1.         page    58,132
  2. ;/*
  3. ;** crnfile.asm
  4. ;** contains:    crnfile()
  5. ;*/
  6.  
  7. CREATENEWFILE        equ    05bh        ;Create New File Function #
  8. DOSCALL         equ    021h        ;DOS Software Interrupt
  9.  
  10.         include model.h
  11.         include prologue.h
  12.  
  13.         ifndef    AZTEC
  14.          ReferVar    _gferror,<cWord>
  15.         endif
  16.  
  17.         dseg    dCreateNewFile
  18.         ifdef    AZTEC
  19.          ReferVar    _gferror,<cWord>
  20.         endif
  21.         endds
  22.  
  23.         pseg    ccrnfile
  24.  
  25.         ifdef    DSNOTHING
  26.          assume  ds:nothing
  27.         endif
  28.  
  29.  
  30. ;/*
  31. ;**  int
  32. ;** crnfile(unsigned attribute, char *filename)
  33. ;**
  34. ;** ARGUMENT(s)
  35. ;**  attribute        -
  36. ;**  filename        -    Pointer to ASCIIZ filename (path O.K.)
  37. ;**
  38. ;** DESCRIPTION
  39. ;**  This function will fail the file open if the filename already exists.
  40. ;**
  41. ;**
  42. ;** RETURNS
  43. ;**  -1 if error other wise returns a file handle.  If a -1 is returned
  44. ;**  the error will be stored in the global variable _gferror.
  45. ;**
  46. ;** AUTHOR
  47. ;**  ""   Fri 11-Nov-1988    14:08:15
  48. ;**   Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
  49. ;**
  50. ;** MODIFICATIONS
  51. ;**
  52. ;*/
  53.         cproc    crnfile
  54.         mov    cx,parm1_
  55.         if    _LDATA
  56.          push    ds
  57.          lds    dx,parm2_        ;DS:DX points to path name
  58.         else
  59.          mov    dx,parm2_        ;DS:DX points to path name
  60.         endif
  61.         mov    ah,CREATENEWFILE
  62.         int    DOSCALL
  63.         jnc    createexit        ;if no error return file handle
  64.         ifdef    DSNOTHING
  65.          mov    bx,seg _gferror
  66.          mov    ds,bx
  67.         endif
  68.         mov    _gferror,ax        ;put error in error variable
  69.         mov    ax,-1            ;and return -1
  70. createexit:
  71.         if    _LDATA
  72.          pop    ds
  73.         endif
  74.         cproce
  75.         endps
  76.         end
  77.