unit main;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TfrmMain = class(TForm)
    paTop: TPanel;
    cbCanIdentify: TCheckBox;
    paMain: TPanel;
    laCPU: TLabel;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    laVendorID: TLabel;
    Label2: TLabel;
    laFamily: TLabel;
    laFamily2: TLabel;
    Label3: TLabel;
    laModel: TLabel;
    Label4: TLabel;
    laStepping: TLabel;
    Label5: TLabel;
    laType: TLabel;
    Label6: TLabel;
    laBrandID: TLabel;
    Label7: TLabel;
    laCache: TLabel;
    Label8: TLabel;
    laSerial: TLabel;
    GroupBox2: TGroupBox;
    cbFPU: TCheckBox;
    cbTSC: TCheckBox;
    cbCX8: TCheckBox;
    cbFSC: TCheckBox;
    cbCMOV: TCheckBox;
    cbFCOMI: TCheckBox;
    cbMMX: TCheckBox;
    cbSSE: TCheckBox;
    cbSSE2: TCheckBox;
    cbSerial: TCheckBox;
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmMain: TfrmMain;

implementation

uses cpuinfo, CacheDesc;

{$R *.DFM}

{procedure TForm1.Button2Click(Sender: TObject);
begin
  Memo1.Lines.Clear;
  Memo1.Lines.Add('CanIdentify = '+IntToStr(Byte(CPUID.CanIdentify)));
  Memo1.Lines.Add('GenuineIntel = '+IntToStr(Byte(CPUID.GenuineIntel)));
  Memo1.Lines.Add('VendorID = '+CPUID.VendorID);
  case CPUID.CPUType of
   ctOriginal: Memo1.Lines.Add('OEM CPU');
   ctOverDrive: Memo1.Lines.Add('OverDrive CPU');
   ctDualProcessor: Memo1.Lines.Add('Dual Processor');
   ctUnknown: Memo1.Lines.Add('Unknown CPU Type');
  end;
  case CPUID.CPUFamily of
   cf486: Memo1.Lines.Add('80486 family');
   cfPentium: Memo1.Lines.Add('Pentium family');
   cfPentiumPro: Memo1.Lines.Add('Pentium Pro family');
   cfPentium4: Memo1.Lines.Add('Pentium 4 family');
   cfUnknown: Memo1.Lines.Add('Unknown CPU family');
  end;
  Memo1.Lines.Add(CPUID.Processor);
  Memo1.Lines.Add('FPU Present = '+IntToStr(Byte(CPUID.Features[ftFPU])));
  Memo1.Lines.Add('MMX Supported = '+IntToStr(Byte(CPUID.Features[ftMMX])));
  Memo1.Lines.Add('Serial Number Enabled = '+IntToStr(Byte(CPUID.Features[ftSerialNumber])));
  case CPUID.CacheSize of
   ca128K: Memo1.Lines.Add('Level 2 Cache 128K');
   ca256K: Memo1.Lines.Add('Level 2 Cache 256K');
   ca512K: Memo1.Lines.Add('Level 2 Cache 512K');
   ca1M: Memo1.Lines.Add('Level 2 Cache 1M');
   ca2M: Memo1.Lines.Add('Level 2 Cache 2M');
   caNoCache: Memo1.Lines.Add('No Level 2 Cache');
   caSizeUnknown: Memo1.Lines.Add('Level 2 Cache Unknown');
  end;
  Memo1.Lines.Add('Serial Number: '+CPUID.SerialNumber);
end;}

procedure TfrmMain.FormCreate(Sender: TObject);
var
 S: String;
begin
 cbCanIdentify.Checked:=CPUID.CanIdentify;
 paMain.Visible:=cbCanIdentify.Checked;
 laCPU.Caption:=CPUID.Processor;
 laVendorID.Caption:=CPUID.VendorID;
 laFamily.Caption:=IntToStr(CPUID.Family);
 case CPUID.CPUFamily of
  cf486: S:='= 80486 family';
  cfPentium: S:='= Pentium I family';
  cfPentiumPro: S:='= Pentium Pro family';
  cfPentium4: S:='= pentium 4 family';
 else
  S:='= Unknown family';
 end;
 laFamily2.Caption:=S;
 laModel.Caption:=IntToStr(CPUID.Model);
 laStepping.Caption:=IntToStr(CPUID.Stepping);
 case CPUID.CPUType of
  ctOriginal: S:='Original/OEM CPU';
  ctOverDrive: S:='OverDrive CPU';
  ctDualProcessor: S:='Dual Processor';
 else
  S:='Unknown';
 end;
 laType.Caption:=S;
 case CPUID.BrandID of
  brCeleron: S:='Celeron';
  brP3: S:='Pentium III';
  brP3Xeon: S:='Pentium III Xeon';
  brP4: S:='Pentium 4';
 else
  S:='Not supported';
 end;
 laBrandID.Caption:=S;
 case CPUID.CacheSize of
  caNoCache: S:='None';
  ca128K: S:='128KB';
  ca256K: S:='256KB';
  ca512K: S:='512KB';
  ca1M: S:='1MB';
  ca2M: S:='2MB';
 else
  S:='Unknown';
 end;
 laCache.Caption:=S;
 if CPUID.Features[ftSerialNumber] then
  laSerial.Caption:=CPUID.SerialNumber;
 cbFPU.Checked:=CPUID.Features[ftFPU];
 cbTSC.Checked:=CPUID.Features[ftTSC];
 cbCX8.Checked:=CPUID.Features[ftCX8];
 cbFSC.Checked:=CPUID.Features[ftFSC];
 cbCMOV.Checked:=CPUID.Features[ftCMOV];
 cbFCOMI.Checked:=CPUID.Features[ftFCOMI];
 cbMMX.Checked:=CPUID.Features[ftMMX];
 cbSSE.Checked:=CPUID.Features[ftSSE];
 cbSSE2.Checked:=CPUID.Features[ftSSE2];
 cbSerial.Checked:=CPUID.Features[ftSerialNumber];
end;

procedure TfrmMain.Button1Click(Sender: TObject);
var
 frmCache: TfrmCache;
begin
 frmCache:=TfrmCache.Create(nil);
 try
  frmCache.ShowModal;
 finally
  frmCache.Free;
 end;
end;

end.
