procedure TCpuData.GetExtendedFMS(var family, model, stepping: byte);
var
TempFlags: dword;
BinFlags: array [0..31] of byte;
i, pos:integer;
begin
asm
push eax
push ebx
push ecx
push edx
mov eax,$80000001
mov ebx,0
mov ecx,0
mov edx,0
db $0F,$A2 /// cpuid
mov TempFlags,eax
pop edx
pop ecx
pop ebx
pop eax
end;
for i:=0 to 31 do
begin
BinFlags[i]:=TempFlags mod 2;
TempFlags:=TempFlags div 2;
end;
family:=0;
model:=0;
stepping:=0;
pos:=0;
for i:=0 to 3 do
begin
stepping:=stepping+(BinFlags[pos]*StrToInt(FloatToStr(Power(2,i))));
inc(pos);
end;
pos:=4;
for i:=0 to 3 do
begin
model:=model+(BinFlags[pos]*StrToInt(FloatToStr(Power(2,i))));
inc(pos);
end;
pos:=8;
for i:=0 to 3 do
begin
family:=family+(BinFlags[pos]*StrToInt(FloatToStr(Power(2,i))));
inc(pos);
end;
end;
function TCpuData.GetExtendedCpuName: string;
var
s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12: array[0..3] of char;
TempCpuName: string;
i: integer;
begin
asm
push eax
push ebx
push ecx
push edx
mov eax,$80000002
mov ebx,0
mov ecx,0
mov edx,0
db $0F,$A2 /// cpuid
mov s1,eax
mov s2,ebx
mov s3,ecx
mov s4,edx
mov eax,$80000003
mov ebx,0
mov ecx,0
mov edx,0
db $0F,$A2 /// cpuid
mov s5,eax
mov s6,ebx
mov s7,ecx
mov s8,edx
mov eax,$80000004
mov ebx,0
mov ecx,0
mov edx,0
db $0F,$A2 /// cpuid
mov s9,eax
mov s10,ebx
mov s11,ecx
mov s12,edx
pop edx
pop ecx
pop ebx
pop eax
end;
TempCpuName:='';
for i:=0 to 3 do
TempCpuName:=TempCpuName+s1[i];
for i:=0 to 3 do
TempCpuName:=TempCpuName+s2[i];
for i:=0 to 3 do
TempCpuName:=TempCpuName+s3[i];
for i:=0 to 3 do
TempCpuName:=TempCpuName+s4[i];
for i:=0 to 3 do
TempCpuName:=TempCpuName+s5[i];
for i:=0 to 3 do
TempCpuName:=TempCpuName+s6[i];
for i:=0 to 3 do
TempCpuName:=TempCpuName+s7[i];
for i:=0 to 3 do
TempCpuName:=TempCpuName+s8[i];
for i:=0 to 3 do
TempCpuName:=TempCpuName+s9[i];
for i:=0 to 3 do
TempCpuName:=TempCpuName+s10[i];
for i:=0 to 3 do
TempCpuName:=TempCpuName+s11[i];
for i:=0 to 3 do
TempCpuName:=TempCpuName+s12[i];
GetExtendedCpuName := TempCpuName;
end;
function TCpuData.GetExtendedL1DCache: word;
var
L1D, TempL1D: dword;
BinArray: array [0..31] of byte;
i, p: integer;
begin
asm
push eax
push ebx
push ecx
push edx
mov eax,$80000005
mov ebx,0
mov ecx,0
mov edx,0
db $0F,$A2 /// cpuid
mov L1D,ecx
pop edx
pop ecx
pop ebx
pop eax
end;
for i:=0 to 31 do
begin
BinArray[i]:=L1D mod 2;
L1D:=L1D div 2;
end;
TempL1D:=0;
p:=0;
for i:=24 to 31 do
begin
TempL1D:=TempL1D+(BinArray[i]*StrToInt(FloatToStr(Power(2,p))));
inc(p);
end;
GetExtendedL1DCache:=TempL1D;
end;
function TCpuData.GetExtendedL1ICache: word;
var
L1I, TempL1I: dword;
BinArray: array [0..31] of byte;
i, p: integer;
begin
asm
push eax
push ebx
push ecx
push edx
mov eax,$80000005
mov ebx,0
mov ecx,0
mov edx,0
db $0F,$A2 /// cpuid
mov L1I,edx
pop edx
pop ecx
pop ebx
pop eax
end;
for i:=0 to 31 do
begin
BinArray[i]:=L1I mod 2;
L1I:=L1I div 2;
end;
TempL1I:=0;
p:=0;
for i:=24 to 31 do
begin
TempL1I:=TempL1I+(BinArray[i]*StrToInt(FloatToStr(Power(2,p))));
inc(p);
end;
GetExtendedL1ICache:=TempL1I;
end;
function TCpuData.GetExtendedL2Cache: word;
var
L2, TempL2: dword;
BinArray: array [0..31] of byte;
i, p: integer;
begin
asm
push eax
push ebx
push ecx
push edx
mov eax,$80000006
mov ebx,0
mov ecx,0
mov edx,0
db $0F,$A2 /// cpuid
mov L2,ecx
pop edx
pop ecx
pop ebx
pop eax
end;
for i:=0 to 31 do
begin
BinArray[i]:=L2 mod 2;
L2:=L2 div 2;
end;
TempL2:=0;
p:=0;
for i:=16 to 31 do
begin
TempL2:=TempL2+(BinArray[i]*StrToInt(FloatToStr(Power(2,p))));
inc(p);
end;
GetExtendedL2Cache:=TempL2;
end;
function TCpuData.CheckCeleron: Boolean;
var
BId: byte;
begin
asm
push eax
push ebx
push ecx
push edx
mov eax,1
db $0F,$A2 /// cpuid
mov BId,bl
pop edx
pop ecx
pop ebx
pop eax
end;
CheckCeleron:=(BId=$1);
end;
function TCpuData.CheckPentiumIII: Boolean;
var
BId: byte;
begin
CheckPentiumIII:=(CheckMMX and CheckSSE);
end;
function TCpuData.CheckXeon: Boolean;
var
BId: byte;
begin
asm
push eax
push ebx
push ecx
push edx
mov eax,1
db $0F,$A2 /// cpuid
mov BId,bl
pop edx
pop ecx
pop ebx
pop eax
end;
CheckXeon:=(BId=$3);
end;
function TCpuData.CheckPentium4: Boolean;
var
BId: byte;
begin
asm
push eax
push ebx
push ecx
push edx
mov eax,1
db $0F,$A2 /// cpuid
mov BId,bl
pop edx
pop ecx
pop ebx
pop eax
end;
CheckPentium4:=(BId=$8);
end;
function TCpuData.CheckIthanium: Boolean;
var
res: dword;
BinArray: array [0..31] of byte;
i: byte;
begin
asm
push eax
push ebx
push ecx
push edx
mov eax,1
db $0F,$A2 /// cpuid
mov res,edx
pop edx
pop ecx
pop ebx
pop eax
end;
for i:=0 to 31 do
begin
BinArray[i]:=res mod 2;
res:=res div 2;
end;
CheckIthanium:=(CheckPentium4 and (BinArray[30]=1));
end;
function TCpuData.IntelP5N: string;
begin
if CheckMMX then
IntelP5N:='Intel Pentium(r) MMX(tm)'
else
IntelP5N:='Intel Pentium(r)';
end;
function TCpuData.IntelP6N: string;
begin
if CheckCeleron then
IntelP6N:='Intel Celeron(r)'
else
if CheckPentiumIII then
IntelP6N:='Intel Pentium(r) III'
else
if CheckXeon then
IntelP6N:='Intel Pentium(r) III Xeon(tm)'
else
if not CheckMMX then
IntelP6N:='Intel Pentium(r) PRO'
else
IntelP6N:='Intel Pentium(r) II';
end;
function TCpuData.AMDK5N: string;
var
Family, Model, Stepping: byte;
begin
GetFMS(Family,Model,Stepping);
if Model=0 then
AMDK5N:='AMD K5'
else
AMDK5N:=GetExtendedCpuName;
end;
function TCpuData.Cyrix686N: string;
begin
if CpuData.GetMaxExtendedFunctions>0 then
Cyrix686N:=GetExtendedCpuName
else
if CheckMMX then
Cyrix686N:='VIA Cyrix 6x86MII'
else
Cyrix686N:='VIA Cyrix 6x86';
end;
function TCpuData.GenericCpuN: string;
var
SysInfo:TSystemInfo;
begin
GetSystemInfo(SysInfo);
if SysInfo.dwProcessorType=386 then
GenericCpuN:='Generic 386 CPU'
else
if SysInfo.dwProcessorType=486 then
GenericCpuN:='Generic 486 CPU'
else
if SysInfo.dwProcessorType=586 then
GenericCpuN:='Pentium Class CPU'
else
GenericCpuN:='Unknown CPU';
end;