home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 256_01 / fun5ah.a < prev    next >
Encoding:
Text File  |  1988-01-08  |  2.1 KB  |  54 lines

  1. ;---------------------------------------------------------------------
  2. ;    ASM88 FILE:     FUN5AH.A     Create Unique Temporary File
  3. ;    ----------
  4. ;    WRITTEN:        25/10/87
  5. ;    -------
  6. ;    PURPOSE:        This is one of a series of files which take
  7. ;    -------         advantage of INT 21H functions under MS-DOS.
  8. ;                    In each case the error situation is marked by
  9. ;                    the carry flag being set.   We use the De Smet
  10. ;                    external variable '_carryf' to see whether the
  11. ;                    carry is set on return from the function.
  12. ;                    If so, the error code can be used to obtain
  13. ;                    information about the specific error.
  14. ;
  15. ;    USAGE:          int FUN5AH(path_buf, attr, &_carryf)
  16. ;    -----           char *path_buf;  /* special buffer starting with
  17. ;                                        ASCIIZ filename then 13 bytes
  18. ;                                        of memory */
  19. ;                    int attr;
  20. ;                    char *_carryf;
  21. ;
  22. ;    DEPENDENCIES:           De Smet C V 2.44+
  23. ;    ------------
  24. ;    Copyright 1987 - Cogar Computer Services Pty. Ltd
  25. ;---------------------------------------------------------------------
  26.  
  27. CSEG
  28. PUBLIC FUN5AH_
  29.  
  30. FUN5AH_:
  31.     push    bp    ; normal De Smet C start
  32.     mov    bp,sp    ; point to the stack
  33.     mov    ax,ds    ; and make ES common with DS
  34.     mov    es,ax
  35. ;----------------------------------------------------------------------
  36. ;  The unique programme follows.
  37. ;----------------------------------------------------------------------
  38.     mov    dx,[bp+4]    ; address of special name buffer
  39.     mov    cx,[bp+6]    ; the attribute
  40.     mov    ah,5ah    ; the Function No.
  41.     int    21h
  42.     jc    FUN5AH_ERROR
  43.     jmp    FUN5AH_QUIT
  44. FUN5AH_ERROR:
  45.     mov    si,[bp+8]    ; get address of '_carryf' variable
  46.     mov    byte [si],1    ; return with _carryf = 1
  47. ;----------------------------------------------------------------------
  48. ;  Normal programme termination.
  49. ;----------------------------------------------------------------------
  50. FUN5AH_QUIT:
  51.     pop    bp    ; restore starting conditions
  52.     ret
  53. ;----------------------------------------------------------------------
  54.