home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / CLIB2.ZIP / BDOSPTR.CAS < prev    next >
Encoding:
Text File  |  1990-06-07  |  1.7 KB  |  55 lines

  1. /*---------------------------------------------------------------------------
  2.  * filename - bdosptr.cas
  3.  *
  4.  * function(s)
  5.  *       bdosptr - MS-DOS system call
  6.  *--------------------------------------------------------------------------*/
  7.  
  8. /*[]------------------------------------------------------------[]*/
  9. /*|                                                              |*/
  10. /*|     Turbo C Run Time Library - Version 3.0                   |*/
  11. /*|                                                              |*/
  12. /*|                                                              |*/
  13. /*|     Copyright (c) 1987,1988,1990 by Borland International    |*/
  14. /*|     All Rights Reserved.                                     |*/
  15. /*|                                                              |*/
  16. /*[]------------------------------------------------------------[]*/
  17.  
  18.  
  19. #pragma  inline
  20. #include <asmrules.h>
  21. #include <dos.h>
  22. #include <_io.h>
  23.  
  24.  
  25. /*--------------------------------------------------------------------------*
  26.  
  27. Name        bdosptr - MS-DOS system call
  28.  
  29. Usage        int bdosptr(int dosfun, void *argument, unsigned dosal);
  30.  
  31. Prototype in    dos.h
  32.  
  33. Description    provides direct access to the MS-DOS system calls which
  34.         require a pointer argument.
  35.  
  36. Return value    the return value of AX on success, or -1 on failure; errno
  37.         and _doserrno are also set on failure.
  38.  
  39. *---------------------------------------------------------------------------*/
  40. int bdosptr(int cmd, void *arg, unsigned dosal)
  41. {
  42.     pushDS_
  43. asm    mov    ah, byte ptr cmd
  44. asm    mov    al, byte ptr dosal
  45. asm    LDS_    dx, arg
  46. asm    clc
  47. asm    int    21h
  48.     popDS_
  49. asm    jc    bdosptrFailed
  50.     return(_AX);
  51.  
  52. bdosptrFailed:
  53.     return __IOerror(_AX);
  54. }
  55.