home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / FNDISLOT.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  1KB  |  52 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  Originally published as part of the MicroFirm Function Library
  5. **
  6. **  Copyright 1990, Robert B.Stout
  7. **
  8. **  The user is granted a free limited license to use this source file
  9. **  to create royalty-free programs, subject to the terms of the
  10. **  license restrictions specified in the LICENSE.MFL file.
  11. **
  12. **  Function to locate an unused user interrupt vector.
  13. */
  14.  
  15. #include "extkword.h"
  16. #include "snpdosys.h"
  17.  
  18. #ifdef __ZTC__
  19.  #include <int.h>
  20. #else
  21.  #include <dos.h>
  22.  #ifdef __TURBOC__
  23.   #define GETVECT getvect
  24.  #else /* assume MSC */
  25.   #define GETVECT _dos_getvect
  26.  #endif
  27.  #define FNULL (void (FAR *)())(0L)
  28. #endif
  29.  
  30. unsigned findIslot(void)
  31. {
  32. #ifdef __ZTC__
  33.       unsigned int_no, seg, ofs;
  34.  
  35.       for (int_no = 0x60; int_no < 0x6f; ++int_no)
  36.       {
  37.             int_getvector(int_no, &seg, &ofs);
  38.             if (0U == (seg | ofs))
  39.                   return int_no;
  40.       }
  41. #else /* MSC/BC/TC */
  42.       unsigned int_no;
  43.  
  44.       for (int_no = 0x60; int_no < 0x6f; ++int_no)
  45.       {
  46.             if (FNULL != (void (FAR *)())GETVECT(int_no))
  47.                   return int_no;
  48.       }
  49. #endif
  50.       return 0;
  51. }
  52.