home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Science / Science.zip / imdisp79.zip / TVGA.C < prev    next >
Text File  |  1993-02-15  |  1KB  |  62 lines

  1. /*
  2. Function:
  3.      Determining if the VGA card is a Trident card
  4.  
  5. Output parameters:
  6.      1 - card is a Trident
  7.      0 - card is not a Trident
  8.  
  9. Calling protocol:
  10.      Trident = Is_It_Trident();
  11. */
  12. int Is_It_Trident(void)
  13. {
  14.     unsigned   char    new_value, old_value, value;
  15.  
  16.     outp (0x3C4, 0x0E);   /* read the Mode Control #1 Register */
  17.     old_value = inp (0x3C5);
  18.  
  19.     outp (0x3C5, 0x01);   /* write a new value, bit0=1, all other bits 0 */
  20.  
  21.     value = inp (0x3C5) & 0x0F;   /* read the new value */
  22.     outp (0x3C5, old_value);      /* write the old value */
  23.  
  24.     if (value == 0x02)
  25.        return(1);
  26.     else
  27.        return(0);
  28. }
  29.  
  30. /*
  31. Function:
  32.     Determine the Trident chip number
  33.  
  34. Output parameters:
  35.     identity - integer containing chip code
  36.                8900 = Trident 8900 chip
  37.                8800 = Trident 8800 chip
  38.  
  39. Note:
  40.     A subsequent consequence of this call is that the mode control
  41.     registers are put into their new state.
  42.  
  43. Calling protocol:
  44.     identity = Which_Trident();
  45. */
  46.  
  47. int Which_Trident(void)
  48. {
  49.     unsigned   char    value;
  50.  
  51.     outp (0x3C4, 0x0B);  /* version register */
  52.     outp (0x3C5, 0x00);  /* dummy write to put system into old
  53.                             definitions */
  54.  
  55.     value = inp (0x3C5);  /* read causes new definitions */
  56.  
  57.     if (value >= 0x03)
  58.        return(8900);
  59.     else
  60.        return(8800);
  61. }
  62.