home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / graphics / 9493 < prev    next >
Encoding:
Text File  |  1992-09-08  |  2.8 KB  |  121 lines

  1. Xref: sparky comp.graphics:9493 comp.os.msdos.programmer:9128
  2. Path: sparky!uunet!spool.mu.edu!sdd.hp.com!swrinde!network.ucsd.edu!cogsci!crl!hartung
  3. From: hartung@crl.ucsd.edu (Jeff Hartung)
  4. Newsgroups: comp.graphics,comp.os.msdos.programmer
  5. Subject: S3 86C911 graphics chip identification
  6. Keywords: VGA SVGA S3 chip identification graphics card IBM MSDOS
  7. Message-ID: <1565@cogsci.ucsd.EDU>
  8. Date: 7 Sep 92 16:27:21 GMT
  9. Sender: news@cogsci.ucsd.EDU
  10. Organization: University of California, San Diego
  11. Lines: 108
  12.  
  13.  
  14. Hi.  Can anyone verify whether or not this is the best method to identify the
  15. S3 86C911 chip?  The documentation I have from S3 says that the CRT controller
  16. register at index value 30h is a "Chip ID/Rev Register" and has a fixed
  17. value of 81h.  It seems to work on my card (Orchid F1280) just fine, but I am
  18. wondering if there is some better way to do this?
  19.  
  20. ---------------------------------CUT HERE---------------------------------
  21. #pragma inline
  22. #include <dos.h>
  23.  
  24. #define TRUE 1
  25. #define FALSE 0
  26.  
  27. #define MISC    0x3CC    /* Miscelaneous output control register */
  28. #define S3R0    0x30    /* S3 Chip ID/Rev. Register */
  29. #define S3R8    0x38    /* S3 Register Lock 1 CRTC index (0x48 to unlock) */
  30. #define S3R9    0x39    /* S3 Register Lock 2 CRTC index (0xa5 to unlock) */
  31.  
  32. int CRTA, CRTD;    /* CRTC index and CRTC register */
  33. unsigned char S3 = FALSE;
  34.  
  35. int is_s3(void)
  36. {
  37.     int value;
  38.  
  39.     unlock_s3();    /* Unlock access to S3 CRTC Registers */
  40.  
  41.     outportb(CRTA, S3R0);
  42.     value = inportb(CRTD);
  43.  
  44.     lock_s3();    /* Relock access to S3 CRTC Registers */
  45.  
  46.     getch();
  47.     if (value == 0x81) return 1;
  48.     else return 0;
  49. }
  50.  
  51. void unlock_s3(void)
  52. {
  53.     asm {
  54.     mov dx,CRTA
  55.     mov al,S3R8
  56.     out dx,al
  57.     inc dx
  58.     mov al,0x48
  59.     out dx,al
  60.     dec dx
  61.     mov al,S3R9
  62.     out dx,al
  63.     inc dx
  64.     mov al,0xa5
  65.     out dx,al
  66.     }
  67. }
  68.  
  69. void lock_s3(void)
  70. {
  71.     asm {
  72.     mov dx,CRTA
  73.     mov al,S3R8
  74.     out dx,al
  75.     inc dx
  76.     mov al,0x84
  77.     out dx,al
  78.     dec dx
  79.     mov al,S3R9
  80.     out dx,al
  81.     inc dx
  82.     mov al,0x42
  83.     out dx,al
  84.     }
  85. }
  86.  
  87. void main(int argc, char *argv[])
  88. {
  89.  
  90.      if (inport(MISC) & 1) CRTA = 0x3d4;    /* Color monitor */
  91.      else CRTA = 0x3b4;                /* Monochrome monitor */
  92.      CRTD = CRTA + 1;
  93.  
  94.      S3 = is_s3();
  95. }
  96. ---------------------------------CUT HERE---------------------------------
  97.  
  98. Thanks,
  99.  
  100.  --Jeff Hartung--      
  101.  Disclaimer: My opinions only, etc., etc., BLAH! BLAH! BLAH!...
  102.  InterNet - hartung@crl.ucsd.edu         BITNET - hartung@ucsd
  103.  UUCP - ucsd!crl.ucsd.edu!hartung
  104. Newsgroups: comp.graphics
  105. Subject: Re: Quadratic Bezier curve
  106. Summary: 
  107. Expires: 
  108. References: <Meessen-040992120427@130.104.58.7> <douglas.715814265@willow.cs.scarolina.edu>
  109. Sender: 
  110. Followup-To: 
  111. Distribution: 
  112. Organization: University of California, San Diego
  113. Keywords: 
  114.  
  115.  
  116. -- 
  117.  --Jeff Hartung--      
  118.  Disclaimer: My opinions only, etc., etc., BLAH! BLAH! BLAH!...
  119.  InterNet - hartung@crl.ucsd.edu         BITNET - hartung@ucsd
  120.  UUCP - ucsd!crl.ucsd.edu!hartung
  121.