home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 1998 April / Freeware-CD.bin / cputst / amd_cpu / amd!.EXE / CPUID.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-19  |  1.8 KB  |  74 lines

  1. /*     $Archive: /General Utilities/CPUID/cpuid.cpp $
  2.     $Author : $
  3.     $Date   : $
  4.     $Header : $
  5.     $History: cpuid.cpp $
  6.  * 
  7.  * *****************  Version 6  *****************
  8.  * User: Tanb         Date: 7/18/96    Time: 4:53p
  9.  * Updated in $/General Utilities/CPUID
  10.  * Make the display look better
  11.  */
  12.  
  13.  
  14. #pragma inline         
  15. #include <fstream.h>
  16. #include <iomanip.h>
  17. #include <iostream.h>
  18. #include <stdlib.h>
  19. #include <string.h>
  20. #include <conio.h>
  21. #include <dos.h>
  22. #include "DEFINES.H"
  23.  
  24. cpuid k86;              //object of cpuid class
  25.  
  26. int main(void)
  27. {
  28.  int maxnum;            //variable of the case statement
  29.  int result = 0;       //variable of the result
  30.  int func = 3;         //variable of the control loop
  31.  
  32.  result = k86.chkcpubit();    //check ID bit in EFLAGS
  33.  if(result == -1) {
  34.     clrscr();
  35.     cout << "\n\n";
  36.     cout << " CPUID instruction is not supported by this processor.";
  37.     cout << "\n\n";
  38.     exit(1);
  39.  }
  40.  else {
  41.     result = k86.chkcpuid();    //check vendor id string
  42.     if(result == 1) {
  43.       clrscr();
  44.       cout << "\n\n";
  45.       cout << "AMD-k86 CPU supporting CPUID is in place.";
  46.       cout << "\n\n";
  47.     }
  48.     else {
  49.       clrscr();
  50.       cout << "\n\n";
  51.       cout << "CPU supporting CPUID is in place.";
  52.       cout << "\n\n";
  53.       }
  54.  }
  55.  //These are the standard functions
  56.  k86.std_vendor_id_str();
  57.  k86.std_cpu_signature();
  58.  
  59.  //These are the extended functions
  60.  for (maxnum=0; maxnum<=func; maxnum++)  {
  61.      switch (maxnum) {
  62.           case 0 : k86.ext_vendor_id_str();    //Vendor Identification String
  63.                       break;
  64.           case 1 : k86.ext_cpu_signature();    //Processor Signature
  65.                       break;
  66.           case 2 : k86.ext_cpu_name_str();    //Processor Name String
  67.                       break;
  68.           case 3 : k86.ext_cpu_cache_info();   //Processor Cache Information
  69.                       break;
  70.     }
  71.  }
  72.     return 0;
  73. }
  74.