home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / HARDWARE / SHOW285.ZIP / MOUSE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-11  |  917 b   |  39 lines

  1. #include <dos.h>
  2.  
  3. void
  4. mouse_present()
  5.    {
  6.    static char *mtypes[] = {
  7.                             "Bus",
  8.                             "Serial",
  9.                             "InPort",
  10.                             "PS/2",
  11.                             "HP"
  12.                             };
  13.    union REGS r;
  14.    r.x.ax = 0;
  15.    int86(0x33,&r,&r);
  16.    if (!r.x.ax)
  17.       {
  18.       printf("\nNo mouse driver found\n");
  19.       return;
  20.       }
  21.  
  22.    printf("\nA Mouse is present\n");
  23.    
  24.    r.x.ax = 0x24;
  25.    int86(0x33,&r,&r);
  26.    if (r.h.bh < 6 || r.h.ch > 5 || r.h.cl > 7)
  27.       {
  28.       printf("   Driver does not support 'mouse information' request.\n");
  29.       return;
  30.       }
  31.       
  32.    printf("   Driver version %x.%02x\n",r.h.bh,r.h.bl);
  33.    printf("   %s mouse.\n",mtypes[r.h.ch-1]);
  34.    if (r.h.cl)
  35.       printf("   IRQ %d\n",r.h.cl);
  36.     else
  37.       printf("   Uses PS/2 mouse port\n");
  38.    }
  39.