I wrote this little program, which displays your CPU name, the speed and the number of cores. Let me know, if it works. :)
It's using a special CPUID-Function to get the CPU name. However, older CPUs (Pentium II and older) don't support this function and the program has to guess, which CPU is installed.
Sample output:
CPU: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
4x 3200 MHz
Code: Select all
Function GetCPUSpeed As Integer
Dim As UlongInt t_start, t_ende
Asm rdtsc
Asm mov dword ptr [t_start + 4], edx
Asm mov dword ptr [t_start], eax
Sleep 1000
Asm rdtsc
Asm mov dword ptr [t_ende + 4], edx
Asm mov dword ptr [t_ende], eax
t_ende -= t_start
t_ende \= 1000000
If (t_ende Mod 100) > 70 Then
Return ((t_ende\100)+1)*100
Else
Return t_ende
End If
End Function
Function GetCPUCores As UByte
Dim As UByte numcores
Asm
mov eax,&h0A
cpuid
mov [numcores],al
End Asm
If numcores = 0 Then numcores = 1
Return numcores
End Function
Function GetCPUName As String
Dim As String nam
Dim As UByte nam1,nam2,nam3,nam4
Dim As ULong tmp
Asm
mov eax,0x80000000
cpuid
mov [tmp],eax
End Asm
If tmp>=&h80000000 Then 'Brand String Supported
Dim As ZString*49 nam_brand
Asm
mov eax, &h80000002
cpuid
mov [nam_brand], eax
mov [nam_brand+4], ebx
mov [nam_brand+8], ecx
mov [nam_brand+12], edx
mov eax, &h80000003
cpuid
mov [nam_brand+16], eax
mov [nam_brand+20], ebx
mov [nam_brand+24], ecx
mov [nam_brand+28], edx
mov eax, &h80000004
cpuid
mov [nam_brand+32], eax
mov [nam_brand+36], ebx
mov [nam_brand+40], ecx
mov [nam_brand+44], edx
End Asm
nam=nam_brand
Else 'Brand String Not Supported
Dim As Zstring * 13 vendorID
Dim As ULong family,model,emodel,cpuid2
Asm
xor eax, eax
cpuid
mov [vendorID], ebx
mov [vendorID+4], edx
mov [vendorID+8], ecx
mov eax,1
cpuid
mov [cpuid2],eax
End Asm
model = cpuid2 shl (31 - 7)
model = model shr (31 - 7 + 4)
emodel = cpuid2 shl (31 - 19)
emodel = emodel shr (31 - 19 + 16)
family = cpuid2 shl (31 - 11)
family = family shr (31 - 11 + 8)
Var modelstr="&h"+Str(emodel)+Hex(model)
model=ValUInt(modelstr)
Select Case vendorID
Case "GenuineIntel"
nam="Intel(R) "
Select Case family
Case 3
nam+="x386"
Case 4
nam+="x486"
Case 5
nam+="Pentium I"
Case 6
Select Case model
Case 1
nam+="Pentium Pro"
Case 3 To 6
nam+="Pentium II"
Case 6
nam+="Celeron"
Case 7,8,10,11
nam+="Pentium III"
Case 9,13
nam+="Pentium M"
Case Else
nam+="P6"
End Select
Case 15
nam+="Pentium 4"
End Select
Case "AuthenticAMD"
nam="AMD "
Select Case family
Case 4
nam+="x486"
Case 6
nam+="Athlon"
Case 15
nam+="Athlon 64"
End Select
Case Else
nam=vendorID+" "
End Select
End If
Return nam
End Function
Print "CPU: "+GetCPUName
Print " "+Str(GetCPUCores)+"x "+Str(GetCPUSpeed)+" MHz"