Показать сообщение отдельно
  #5  
Старый 20.01.2008, 20:05
Аватар для The Shadow
The Shadow The Shadow вне форума
Продвинутый
 
Регистрация: 11.06.2007
Адрес: Уфа, Россия
Сообщения: 793
Репутация: 35
По умолчанию

Код:
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; 
function TCpuData.P5CacheL1DI:word; 
begin 
if CheckMMX then P5CacheL1DI:=16 
else P5CacheL1DI:=8; 
end; 
function TCpuData.P6CacheL1DI:word; 
begin 
if not CheckMMX then P6CacheL1DI:=8 
else P6CacheL1DI:=16; 
end; 
function TCpuData.P6CacheL2:word; 
var Family,Model,Stepping:byte; 
begin 
if CheckCeleron then P6CacheL2:=128 
else 
if CheckPentiumIII then begin 
                          GetFMS(Family,Model,Stepping); 
                          if Model=7 then P6CacheL2:=512 
                          else if Model=8 then P6cacheL2:=256 
                          else P6CacheL2:=512; 
                         end 
else if not CheckMMX then P6CacheL2:=512 
else P6CacheL2:=512; 
end; 
__________________
Что делать, когда сломался комп:
1. Если вы юзер - делать ноги.
2. Если ремонтник - делать деньги.
3. Если вы программист - делать вид, что так было задумано.
Ответить с цитированием