home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 256_01 / fun3dh.a < prev    next >
Text File  |  1988-01-08  |  2KB  |  52 lines

  1. ;---------------------------------------------------------------------
  2. ;    ASM88 FILE:     FUN3DH.A     Open Handle
  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 FUN3DH(name, code, &_carryf)
  16. ;    -----           char *name;  (ASCIIZ string)
  17. ;                    int code;    (Access Code)
  18. ;                    char *_carryf;
  19. ;
  20. ;    DEPENDENCIES:           De Smet C V 2.44+
  21. ;    ------------
  22. ;    Copyright 1987 - Cogar Computer Services Pty. Ltd
  23. ;---------------------------------------------------------------------
  24.  
  25. CSEG
  26. PUBLIC FUN3DH_
  27.  
  28. FUN3DH_:
  29.     push    bp    ; normal De Smet C start
  30.     mov    bp,sp    ; point to the stack
  31.     mov    ax,ds    ; and make ES common with DS
  32.     mov    es,ax
  33. ;----------------------------------------------------------------------
  34. ;  The unique programme follows.
  35. ;----------------------------------------------------------------------
  36.     mov    dx,[bp+4]    ; address of file name
  37.     mov    byte al,[bp+6]    ; the access code
  38.     mov    ah,3dh    ; the Function No.
  39.     int    21h
  40.     jc    FUN3DH_ERROR
  41.     jmp    FUN3DH_QUIT
  42. FUN3DH_ERROR:
  43.     mov    si,[bp+8]    ; get address of '_carryf' variable
  44.     mov    byte [si],1    ; return with _carryf = 1
  45. ;----------------------------------------------------------------------
  46. ;  Normal programme termination.
  47. ;----------------------------------------------------------------------
  48. FUN3DH_QUIT:
  49.     pop    bp    ; restore starting conditions
  50.     ret
  51. ;----------------------------------------------------------------------
  52.