I've added a whole host of new features to the program written by MichaelW. So it's swell now.
Code: Select all
'-------------
' CPUID32.BAS
'-------------
'$Dynamic
Option Explicit
Common Shared CPUFt$, TimeS, StartTime,
EndTime, Famly!, Famly$, Comma$
Common Shared Stepp!, Stepp$, CModel$,
CModel!, Brand$, CPUI$, Comma!
Common Shared CPUA$, CPUL$, CPUN$,
CPUR$, Revis!, Revis$, CNumb!, CNumb$
Common Shared HTT
DECLARE SUB Delay(Time)
'****************************************************
************************
' netaces2k - 07 Oct 2006: mods to ADD
additional CPUID features, and
' further display details. Otherwise, nice
coding job... :o)
' See also:
http://www.paradicesoftware.com/specs/cpuid/cp
uid.htm
' The detection system is now modified to
detect most / all of
' the Intel(R) Pentium(R) class features
that are available.
' See also:
http://www.sandpile.org/ia32/cpuid.htm
' 26 Oct 2006: I have added 55 new
instructions to the feature
' detection system. Intel's P2,P3,P4/M/D
are all onboard now (not Core2Duo yet).
' AMD's
Duron,Athlon,AthlonXP,Sempron,Turion,Athlon6
4/X2/FX,Opteron/Opteron64.
'Features detected are: (63 In All!)
' v86, DE, PSE, TSC, MSR, PAE, MCE, CX8,
SEP, DCPL, GPE, MTRR, PGE, MCA, SYSE,
MP
' CMOV, PAT, PSE36, APIC, MON, PSN,
CLFSH, FXSR, HT, FPU, DTES, ACPI, MMX+,
ACC
' PBE, SSE4, MMX, SS, SSE, SSE2, SSE3,
3DNow, 3DNow+, AMD64, IA-64, CPUID, NX,
XD
' RDTSCP, CX16, VMX, SMX, EST, TM2, CID,
XTPR, DCA, RAZ, SVM, CMPL, AMC8, ABM
' SSE4A, maSSE, EXTas, LAHF
'Notes:
' The features, some of them, are brand specific
(Intel/AMD). So don't be
' shocked not to see one. Your processor may
not have it. The program will
' NOT detect a feature that is not normally part of
your brand of CPU.
'****************************************************
************************
' This function queries the processor...
' Returns a bit range value, with the value
' shifted to place lowbit at bit position 0.
'
Function brval( Byval dwordval As Uinteger,_
Byval highbit As Uinteger,_
Byval lowbit As Uinteger )_
As Uinteger
dwordval = dwordval Shl (31 - highbit)
dwordval = dwordval Shr (31 - highbit +
lowbit)
Return dwordval
Exit Function
End Function
Function cpuid_eax( Byval func As Uinteger)
asm mov eax, [func]
asm cpuid
asm mov [Function], eax
Exit Function
End Function
Function cpuid_ebx( Byval func As Uinteger)
asm mov eax, [func]
asm cpuid
asm mov [Function], ebx
Exit Function
End Function
Function cpuid_ecx( Byval func As Uinteger)
asm mov eax, [func]
asm cpuid
asm mov [Function], ecx
Exit Function
End Function
Function cpuid_edx( Byval func As Uinteger)
asm mov eax, [func]
asm cpuid
asm mov [Function], edx
Exit Function
End Function
' This is the list to check on, in the detection
process...
Enum cpufeatures
CPUID = 1
VME:DE:PSE:TSC:MSR:PAE:MCE:CX8:SEP:D
CPL:ACC:TM1:MP
GPE:SYSE:MTRR:PGE:MCA:CMOV:PAT:PSE3
6:APIC:MON:NX
PSN:CLFSH:FXSR:HHT:FPU:DTES:ACPI:MXx:
PBE:SSE4:XD
MMX:SSE:SSE2:SSNP:SSE3:TDNow:TDNow2:
X64:IA64:CX16
VMX:SMX:EST:TM2:CID:XTPR:DCA:RDTSCP:
RAZ:SVM:CMP
AMC8:ABM:SSE4A:maSSE:EXTas:LAHF
End Enum
' Returns:
' Supported = 1, NOT Supported = 0.
Function cpufeat( feature As Uinteger ) As
Uinteger
Select Case feature
Case CPUID
' CPUID supported if can set/clear
' ID flag (EFLAGS bit 21).
asm
pushfd
pop edx
pushfd
pop eax
Xor eax, &h200000 ' Flip ID flag
push eax
popfd
pushfd
pop eax
Xor eax, edx
Shr eax, 21
mov [Function], eax
End asm
Case FPU
'Math-Coprocessor
Return brval( cpuid_edx( 1 ), 0, 0 )
Case VME
'VirtualMachineExt-x86
Return brval( cpuid_edx( 1 ), 1, 1 )
Case DE
'DebugModeExtension
Return brval( cpuid_edx( 1 ), 2, 2 )
Case PSE
'PageSizeExtension
Return brval( cpuid_edx( 1 ), 3, 3 )
Case TSC
'TimeStampCounters
Return brval( cpuid_edx( 1 ), 4, 4 )
Case MSR
'ModelSpecificRegisters
Return brval( cpuid_edx( 1 ), 5, 5 )
Case PAE
'PhysicalAddressExtension
Return brval( cpuid_edx( 1 ), 6, 6 )
Case MCE
'MachineCheckException
Return brval( cpuid_edx( 1 ), 7, 7 )
Case CX8
'CMPXCHG8B
Return brval( cpuid_edx( 1 ), 8, 8 )
Case GPE, APIC 'Intel =
APIC, AMD = GPE/APIC
Return brval( cpuid_edx( 1 ), 9, 9 )
Case SYSE
'SystemCall (Enter/Exit/Return)
Return brval( cpuid_edx( 1 ), 11, 11 )
Case MTRR
'MemoryTypeRegisters
Return brval( cpuid_edx( 1 ), 12, 12 )
Case PGE
'PageGlobalExtensions
Return brval( cpuid_edx( 1 ), 13, 13 )
Case MCA
'MachineCheckArchitecture
Return brval( cpuid_edx( 1 ), 14, 14 )
Case CMOV
'ConditionalMove
Return brval( cpuid_edx( 1 ), 15, 15 )
Case PAT
'PageAddressTable
Return brval( cpuid_edx( 1 ), 16, 16 )
Case PSE36
'PageSizeExtensions36bit
Return brval( cpuid_edx( 1 ), 17, 17 )
Case PSN 'Intel P3
Serial Number
Return brval( cpuid_edx( 1 ), 18, 18 )
' Return brval( cpuid_eax( 0 ), 3, 3 )
'Serial Location???
Case CLFSH 'CLFluSH
Return brval( cpuid_edx( 1 ), 19, 19 )
Case MP
'Multi-Processor Capable(Intel?)
Return brval( cpuid_eax( 1 ), 19, 19 )
Case NX, XD 'No
eXecute/eXecute Diasble
If cpuid_eax( &h80000000 ) >
&h80000000 Then
Return brval( cpuid_edx( &h80000001
), 20, 20 )
End If
Case DTES
'DebugStore Trace MSR's
Return brval( cpuid_edx( 1 ), 21, 21 )
Case ACPI 'ACPI
Return brval( cpuid_edx( 1 ), 22, 22 )
Case MMX
'MultiMedia-eXtensions
Return brval( cpuid_edx( 1 ), 23, 23 )
Case FXSR
'FPFastSaveLoad
Return brval( cpuid_edx( 1 ), 24, 24 )
Case SSE 'SSE
Return brval( cpuid_edx( 1 ), 25, 25 )
Case SSE2 'SSE v2
Return brval( cpuid_edx( 1 ), 26, 26 )
Case SSNP 'Self-Snoop
Return brval( cpuid_edx( 1 ), 27, 27 )
Case HHT
'HyperTransport/Threading
Return brval( cpuid_edx( 1 ), 28, 28 )
Case TM1
'ThermalMonitor1
Return brval( cpuid_edx( 1 ), 29, 29 )
Case PBE
'PendingBreakEvent
Return brval( cpuid_edx( 1 ), 31, 31 )
Case SSE3 'SSE v3
Return brval( cpuid_ecx( 1 ), 0, 0 )
Case LAHF 'AMD's
LAHF (AMD x64)
Return brval( cpuid_ecx( 1 ), 0, 0 )
Case CMP
'CoreMuitlProcessorLegacy
Return brval( cpuid_ecx( 1 ), 1, 1 )
Case SVM
'SecureVirtualMachine
Return brval( cpuid_ecx( 1 ), 2, 2 )
Case MON
'Monitor/WaitSrvc
Return brval( cpuid_ecx( 1 ), 3, 3 )
Case EXTas
'ExtendedAPICSpace
Return brval( cpuid_ecx( 1 ), 3, 3 )
Case DCPL
'QualifiedDebugStore (Intel)
Return brval( cpuid_ecx( 1 ), 4, 4 )
Case AMC8 'AltMovCr8
(AMD)
Return brval( cpuid_ecx( 1 ), 4, 4 )
Case VMX
'VirtualMachineExtensions
Return brval( cpuid_ecx( 1 ), 5, 5 )
Case ABM
'AdvancedBitManipulation
Return brval( cpuid_ecx( 1 ), 5, 5 )
Case SMX
'SecurityMgmtExtensions
Return brval( cpuid_ecx( 1 ), 6, 6 )
Case SSE4a 'SSE4A
Return brval( cpuid_ecx( 1 ), 6, 6 )
Case maSSE
'MisAlignedSSE
Return brval( cpuid_ecx( 1 ), 7, 7 )
Case EST
'EnhancedSpeedStep
Return brval( cpuid_ecx( 1 ), 7, 7 )
Case TM2
'ThermalMonitor2
Return brval( cpuid_ecx( 1 ), 8, 8 )
Case SSE4 'SSE v4
Return brval( cpuid_ecx( 1 ), 9, 9 )
Case CID 'ContextID
Return brval( cpuid_ecx( 1 ), 10, 10 )
Case CX16
'CMPXCHG16B
Return brval( cpuid_ecx( 1 ), 13, 13 )
Case XTPR
'SendTaskPriorityMsgs
Return brval( cpuid_ecx( 1 ), 14, 14 )
Case DCA
'DirectCacheAccess
Return brval( cpuid_ecx( 1 ), 18, 18 )
Case RDTSCP
'RDTSCP (TSC)
Return brval( cpuid_ecx( 1 ), 27, 27 )
Case RAZ
'ReadAsZero
Return brval( cpuid_ecx( 1 ), 31, 31 )
Case MXx 'AMD's
MMX+ w/SSE
If cpuid_eax( &h80000000 ) >
&h80000000 Then
Return brval( cpuid_edx( &h80000001
), 22, 22 )
End If
Case TDNow 'AMD's
3DNow!
If cpuid_eax( &h80000000 ) >
&h80000000 Then
Return brval( cpuid_edx( &h80000001
), 31, 31 )
End If
Case TDNow2 'AMD's
3DNow! 2/Pro
If cpuid_eax( &h80000000 ) >
&h80000000 Then
Return brval( cpuid_edx( &h80000001
), 30, 30 )
End If
Case X64 'AMD's
x86-64
If cpuid_eax( &h80000000 ) >
&h80000000 Then
Return brval( cpuid_edx( &h80000001
), 29, 29 )
End If
Case ACC
'AccessCodeControl
If cpuid_eax( &h80000000 ) >
&h80000000 Then
Return brval( cpuid_edx( &h80000001
), 29, 29 )
End If
Case IA64 'Intel's IA-64
(Itanium)
If cpuid_eax( &h80000000 ) >
&h80000000 Then
Return brval( cpuid_edx( &h80000001
), 30, 30 )
End If
Case Else:
End Select
Exit Function
End Function
'****************************************************
************************
#define VENDOR_OTHER 0 ' and
Unknowns
#define VENDOR_INTEL 1
#define VENDOR_AMD 2 ' NexGen
#define VENDOR_CYRIX 3 ' Also
VIA/Centaur
Dim maxCpuidInput As Uinteger '
Maximum Basic Function
Dim signature As Uinteger ' EAX (Function
1)
Dim steppingID As Uinteger ' EAX bits 3-0
(function 1)
Dim model As Uinteger ' EAX bits 7-4
(function 1)
Dim displayModel As Uinteger ' Calculated
Dim family As Uinteger ' EAX bits 11-8
(function 1)
Dim cputype As Uinteger ' EAX bits 13-12
(function 1)
Dim tlbcache As Uinteger ' EAX bit 2
(function 0)
Dim displayFamily As Uinteger ' Calculated
Dim extendedModel As Uinteger ' EAX bits
19-16 (function 1)
Dim extendedFamily As Uinteger ' EAX bits
27-20 (function 1)
Dim brandID As Uinteger ' EBX bits 7-0
(function 1)
Dim maxCpuidInputEx As Uinteger '
Maximum Extended Function
Dim signatureEx As Uinteger ' EAX
Extended CPU ID Info (function 80000001h)
Dim vendor As Uinteger ' Vendor
Identifier
Dim vendorID As Zstring * 13 ' BrandMarker
(function 0)
Dim nameString As Zstring * 49 ' CPU Name
(Function 80000002h-4h, AMD)
Print: Color 15, 0
Print "FreeBASIC CPUID/32 þ v1.02R1 þ This
Version By netaces2k: 05 Jul 2007"
Print "Original Version By MichaelW: 14 Jun
2006 - http://www.freebasic.net/forum/"
Color 9, 0: Print String(75, 196): Color 7, 0
If cpufeat( CPUID ) = 0 Then
Beep: Color 7, 0
GOTO Vend
Print "The CPUID Features Are Not
Supported. Press SPACE To Exit."
Sleep: End
End If
maxCpuidInput = cpuid_eax( 0 )
asm
Xor eax, eax
cpuid
mov [vendorID], ebx
mov [vendorID + 4], edx
mov [vendorID + 8], ecx
End asm
Vend: 'Jump point...
'VendorID String, Len=12/Text
Select Case vendorID
Case "GenuineIntel" '1 = International
Electronics (Intel Corp.)
vendor = VENDOR_INTEL
Case "AuthenticAMD" '2 = Advanced
Micro Devices (AMD)
vendor = VENDOR_AMD
Case "CyrixInstead" '3 = Cyrix (now VIA
Technologies)
vendor = VENDOR_CYRIX
Case Else:
vendor = VENDOR_OTHER
End Select
'VendorID Strings:
' "GenuineIntel" - Intel Corp.
' "AuthenticAMD" - Advanced Micro Devices
' "CyrixInstead" - Cyrix(VIA)
' "CentaurHauls" - Centaur(VIA)
' "SiS SiS SiS " - Silicon Information Systems
' "NEC NEC NEC " - National Electronics Corp.
' "NexGenDriven" - NexGen(AMD)
' "GenuineTMx86", "TransMetaCPU" -
TransMeta
' "RiseRiseRise" - Rise
' "UMC UMC UMC " - United MicroElectronics
Corp.
' "Geode by NSC" - National Semiconductor
Corp.
'SELECT CASE Vendor
' CASE INTEL: Ven = "Intel": Copy$ =
"GenuineIntel": COwn$ = "International
Electronics Corp.": CUrl$ =
"http://www.intel.com/"
' CASE AMD: Ven = "AMD": Copy$ =
"AuthenticAMD": COwn$ = "Advanced Micro
Devices, Inc.": CUrl$ =
"http://www.amd.com/"
' CASE CYRIX: Ven = "Cyrix": Copy$ =
"CyrixInstead": COwn$ = "VIA Technologies,
Inc.": CUrl$ = "http://www.viatech.com/"
' CASE UMC: Ven = "UMC": Copy$ =
"UMC UMC UMC ": COwn$ = "United
Microelectronics Corp.": CUrl$ =
"http://www.umc.com/"
' CASE NEC: Ven = "NEC": Copy$ = "NEC
NEC NEC ": COwn$ = "National Electronics
Corp.": CUrl$ = "http://www.nec.com/"
' CASE NSC: Ven = "NSC": Copy$ =
"Goods by NSC": COwn$ = "National
Semiconductor Corp.": CUrl$ =
"http://www.nsc.com/"
' CASE SIS: Ven = "SIS": Copy$ = "SIS SIS
SIS ": COwn$ = "Silicon Information Systems":
CUrl$ = "http://www.sis.com/"
' CASE NXGEN: Ven = "NexGen": Copy$ =
"NexGenDriven": COwn$ = "NexGen Software
Technologies, Inc.": CUrl$ =
"http://www.nexgen.com/"
' CASE IDT: Ven = "VIA": Copy$ =
"CentaurHauls": COwn$ = "VIA Technologies,
Inc.": CUrl$ = "http://www.viatech.com/"
' CASE RISE: Ven = "Rise": Copy$ =
"RiseRiseRise": COwn$ = "Rise Corporation":
CUrl$ = "http://www.rise.com/"
' CASE TRNS: Ven = "TransMeta": Copy$ =
"GenuineTMx86": COwn$ = "TransMeta
Corporation": CUrl$ =
"http://www.transmeta.com/"
' CASE ELSE: Ven = "VendorCode = " +
LTRIM$(STR$(Vendor))
'END SELECT
If maxCpuidInput Then
signature = cpuid_eax( 1 )
steppingID = brval( signature, 3, 0 )
model = brval( signature, 7, 4 )
family = brval( signature, 11, 8 )
cputype = brval( cpuid_eax( 1 ), 13, 12 )
extendedModel = brval( signature, 19, 16 )
extendedFamily = brval( signature, 27, 20 )
brandID = brval( cpuid_ebx( 1 ), 7, 0 )
tlbcache = brval( cpuid_eax( 2 ), 0, 0 )
' For AMD only use the family and
extendedFamily
' returned by function 80000001h, if available.
If vendor = VENDOR_AMD Then
maxCpuidInputEx = cpuid_eax(
&h80000000 )
If maxCpuidInputEx > &h80000000 Then
family = brval( cpuid_eax( &h80000001
), 11, 8 )
extendedFamily = brval( cpuid_eax(
&h80000001 ), 27, 20 )
End If
End If
End If
' AMD processor name string, supported starting
with the AMD
' K5 Model 1, contains the actual processor
name.
' Intel processor brand string is retrieved in the
same manner
' as the AMD Processor Name String, but
instead of a processor
' name it contains frequency and multiplier
information that
' is of no use here.
If vendor = VENDOR_AMD Then
If maxCpuidInputEx > &h80000000 Then
signatureEx = cpuid_eax( &h80000001 )
If maxCpuidInputEx > &h80000003 Then
asm
mov eax, &h80000002
cpuid
mov [nameString], eax
mov [nameString+4], ebx
mov [nameString+8], ecx
mov [nameString+12], edx
mov eax, &h80000003
cpuid
mov [nameString+16], eax
mov [nameString+20], ebx
mov [nameString+24], ecx
mov [nameString+28], edx
mov eax, &h80000004
cpuid
mov [nameString+32], eax
mov [nameString+36], ebx
mov [nameString+40], ecx
mov [nameString+44], edx
End asm
End If
End If
End If
' Use the Intel rules to calc the displayed family
and model.
displayFamily = family
displayModel = model
If family = &hF Then displayFamily +=
extendedFamily
If family = 6 Or family = &hF Then displayModel
+= extendedModel
' Display the family, model, and stepping in
decimal instead
' of the hex that Intel now recommends.
Color 7, 0: Print "CPU Vendor: ";
Color 15, 0: Print vendorID ';
String$(2,32);"(";ltrim$(Str$(vendor)); ")"
Gosub Intel: Gosub AMD
Print
Color 7, 0: Print String$(4,32);"Family: ";
Color 15, 0: Print displayFamily ';
String$(2,32);"(";ltrim$(Str$(family)); ")"
Color 7, 0: Print String(5,32);"Model: ";
Color 15, 0: Print displayModel ';
String$(2,32);"(";ltrim$(Str$(model)); ")"
Color 7, 0: Print String$(2,32);"Stepping: ";
Color 15, 0: Print steppingID
Color 7, 0: Print String$(3,32);"CPU Key: ";
Color 15, 0: Print "000"; Hex$(signature)
'Color 7, 0: Print String$(2,32);"CPU Type: ";
'Color 15, 0: Print Hex$(cputype)
'Color 7, 0: Print String$(2,32);"CPUCache: ";
'Color 15, 0: Print Hex$(tlbcache)
Print
If cpufeat( CPUID ) = 0 Then GOTO Finish
'Display the detected features.
'Shoe Ext. CPUID Data... (From Win2k/XP
ENVIRON set...)
GOSUB Envir
Print
Color 7, 0: Print String$(2,32);"Features: ";
'General List of Features (Usually supported)...
If cpufeat( CPUID ) Then CPUFt$ = CPUFt$ +
"CPUID "
If cpufeat( FPU ) Then CPUFt$ = CPUFt$ +
"FPU "
If cpufeat( VME ) Then CPUFt$ = CPUFt$ +
"v86 "
If cpufeat( DE ) Then CPUFt$ = CPUFt$ + "DE
"
If cpufeat( PSE ) Then CPUFt$ = CPUFt$ +
"PSE "
If cpufeat( TSC ) Then CPUFt$ = CPUFt$ +
"TSC "
If cpufeat( MSR ) Then CPUFt$ = CPUFt$ +
"MSR "
If cpufeat( PAE ) Then CPUFt$ = CPUFt$ +
"PAE "
If cpufeat( MCE ) Then CPUFt$ = CPUFt$ +
"MCE "
If cpufeat( CX8 ) Then CPUFt$ = CPUFt$ +
"CX8 "
If cpufeat( GPE ) Then CPUFt$ = CPUFt$ +
"GPE "
If cpufeat( APIC ) Then CPUFt$ = CPUFt$ +
"APIC "
If cpufeat( SYSE ) Then CPUFt$ = CPUFt$ +
"SYSE "
If cpufeat( MTRR ) Then CPUFt$ = CPUFt$ +
"MTRR "
If cpufeat( PGE ) Then CPUFt$ = CPUFt$ +
"PGE "
If cpufeat( MCA ) Then CPUFt$ = CPUFt$ +
"MCA "
If cpufeat( CMOV ) Then CPUFt$ = CPUFt$ +
"CMOV "
If cpufeat( PAT ) Then CPUFt$ = CPUFt$ +
"PAT "
If cpufeat( PSE36 ) Then CPUFt$ = CPUFt$ +
"PSE36 "
If cpufeat( CLFSH ) Then CPUFt$ = CPUFt$ +
"CLFSH "
If cpufeat( FXSR ) Then CPUFt$ = CPUFt$ +
"FXSR "
If cpufeat( HHT ) Then CPUFt$ = CPUFt$ +
"HTT "
If cpufeat( MP ) Then CPUFt$ = CPUFt$ + "MP
"
If cpufeat( ACPI ) Then CPUFt$ = CPUFt$ +
"ACPI "
If cpufeat( MMX ) Then CPUFt$ = CPUFt$ +
"MMX "
If cpufeat( SSE ) Then CPUFt$ = CPUFt$ +
"SSE "
If cpufeat( SSE2 ) Then CPUFt$ = CPUFt$ +
"SSE2 "
If cpufeat( SSE3 ) Then CPUFt$ = CPUFt$ +
"SSE3 "
If cpufeat( TDNow ) Then CPUFt$ = CPUFt$ +
"3DNow "
If cpufeat( TDNow2 ) Then CPUFt$ = CPUFt$ +
"3DNow+ "
'AMD(tm) Specific...
If cpufeat( RDTSCP ) AND vendor = 2 Then
CPUFt$ = CPUFt$ + "RTSC "
If cpufeat( SVM ) AND vendor = 2 Then
CPUFt$ = CPUFt$ + "SVM "
If cpufeat( CMP ) AND vendor = 2 Then
CPUFt$ = CPUFt$ + "CMPL "
If cpufeat( RAZ ) AND vendor = 2 Then CPUFt$
= CPUFt$ + "RAZ "
If cpufeat( NX ) AND vendor = 2 Then CPUFt$
= CPUFt$ + "NX "
If cpufeat( CX16 ) AND vendor = 2 Then
CPUFt$ = CPUFt$ + "CX16 "
If cpufeat( MXx ) AND vendor = 2 Then CPUFt$
= CPUFt$ + "MMX+ "
If cpufeat( X64 ) AND vendor = 2 Then CPUFt$
= CPUFt$ + "AA-64 "
IF cpufeat( AMC8 ) AND vendor = 2 Then
CPUFt$ = CPUFt$ + "AMC8 "
IF cpufeat( ABM ) AND vendor = 2 Then
CPUFt$ = CPUFt$ + "ABM "
IF cpufeat( maSSE ) AND vendor = 2 Then
CPUFt$ = CPUFt$ + "MASSE "
IF cpufeat( EXTas ) AND vendor = 2 Then
CPUFt$ = CPUFt$ + "EXTAS "
IF cpufeat( LAHF ) AND vendor = 2 Then
CPUFt$ = CPUFt$ + "LAHF "
IF cpufeat( SSE4a ) AND vendor = 2 Then
CPUFt$ = CPUFt$ + "SSE4A "
'Intel(R) Specific...
If cpufeat( PSN ) AND vendor = 1 Then CPUFt$
= CPUFt$ + "PSN "
If cpufeat( DTES ) AND vendor = 1 Then
CPUFt$ = CPUFt$ + "DTES "
If cpufeat( SSNP ) AND vendor = 1 Then
CPUFt$ = CPUFt$ + "SS "
If cpufeat( SSE4 ) AND vendor = 1 Then
CPUFt$ = CPUFt$ + "SSE4 "
If cpufeat( CX16 ) AND vendor = 1 Then
CPUFt$ = CPUFt$ + "CX16 "
If cpufeat( ACC ) And vendor = 1 Then CPUFt$
= CPUFt$ + "ACC "
If cpufeat( TM1 ) And vendor = 1 Then CPUFt$
= CPUFt$ + "TM1 "
If cpufeat( TM2 ) And vendor = 1 Then CPUFt$
= CPUFt$ + "TM2 "
If cpufeat( EST ) And vendor = 1 Then CPUFt$
= CPUFt$ + "EST "
If cpufeat( DCA ) And vendor = 1 Then CPUFt$
= CPUFt$ + "DCA "
If cpufeat( VMX ) And vendor = 1 Then CPUFt$
= CPUFt$ + "VMX "
If cpufeat( SMX ) And vendor = 1 Then CPUFt$
= CPUFt$ + "SMX "
If cpufeat( XTPR ) And vendor = 1 Then
CPUFt$ = CPUFt$ + "XTPR "
If cpufeat( CID ) And vendor = 1 Then CPUFt$
= CPUFt$ + "CID "
If cpufeat( IA64 ) And vendor = 1 Then CPUFt$
= CPUFt$ + "IA-64 "
If cpufeat( DCPL ) And vendor = 1 Then
CPUFt$ = CPUFt$ + "DSCPL "
If cpufeat( PBE ) And vendor = 1 Then CPUFt$
= CPUFt$ + "PBE "
If cpufeat( MON ) And vendor = 1 Then CPUFt$
= CPUFt$ + "MON "
If cpufeat( XD ) AND vendor = 1 Then CPUFt$
= CPUFt$ + "XD "
Color 15, 0: Print Mid$(CPUFt$, 1, 68);
Color 15, 0: Print tab(13);
LTRIM$(Mid$(CPUFt$, 69, 68));
Color 15, 0: Print tab(13);
LTRIM$(Mid$(CPUFt$, 137, 68));
Color 15, 0: Print tab(13);
LTRIM$(Mid$(CPUFt$, 205, 68));
Print
Quit: 'Exit the program...
Sleep: Color 7, 0: End
Finish: 'Final lookups & displays...
' For Intel processors, display the Intel Brand
String from
' a table. If the brand ID is zero, display a
processor
' identification based on the family, model, and
features.
' The table is adapted from the IA-32 Intel
Architecture
' Software Developer’s Manual Volume 2A,
253666-015,
' April 2005, Table 3-19.
Intel: 'International Electronics...
If vendor = VENDOR_INTEL Then
Color 7, 0: Print String$(2, 32); "CPU Name:
";
Color 15, 0:
Select Case brandID
Case 0
Print "NA";
Select Case family
Case 4
Print "Intel(R) i486"
Case 5
If cpufeat( MMX ) Then
Print "Intel(R) Pentium(R) MMX"
Else
Print "Intel(R) Pentium(R)
(Classic)"
End If
Case 6
If cpufeat( SSE ) Then
Print "Intel(R) Pentium(R) III"
Elseif cpufeat( MMX ) Then
Print "Intel(R) Pentium(R) II"
Else
Print "Intel(R) Pentium(R) Pro"
End If
Case Else:
End Select
Case 1
Print "Intel(R) Celeron(R) Processor"
Case 2
Print "Intel(R) Pentium(R) III Processor"
Case 3
If signature = &h6B1 Then
Print "Intel(R) Celeron(R) Processor"
Else
Print "Intel(R) Pentium(R) III Xeon(TM)
Processor"
End If
Case 4
Print "Intel(R) Pentium(R) III Processor"
Case 6
Print "Mobile Intel(R) Pentium(R) III
Processor-M"
Case 7
Print "Mobile Intel(R) Celeron(R)
Processor"
Case 8, 9
Print "Intel(R) Pentium(R) 4 Processor"
Case &ha
Print "Intel(R) Celeron(R) Processor"
Case &hb
If signature = &hF13 Then
Print "Intel(R) Xeon(TM) Processor
MP"
Else
Print "Intel(R) Xeon(TM) Processor"
End If
Case &hc
Print "Intel(R) Xeon(TM) Processor MP"
Case &he
If signature = &hF13 Then
Print "Intel(R) Xeon(TM) Processor"
Else
Print "Mobile Intel(R) Pentium(R) 4-M
Processor"
End If
Case &hf
Print "Mobile Intel(R) Celeron(R)
Processor"
Case &h13
Print "Mobile Intel(R) Celeron(R)
Processor"
Case &h14 '6.14.8 (6F2, 6F6)
Print "Mobile Intel(R) Core2Duo(R)
Processor"
Case &h16
Print "Intel(R) Pentium(R) M Processor"
Case &h17
Print "Mobile Intel(R) Celeron(R)
Processor"
Case Else
Print "Unknown/New CPUID: "; Family;
"."; Model; "."; steppingID; ":"; signature
End Select
Else
End If
RETURN
AMD: 'Advanced Micro Devices...
' For AMD processors, display the name string, if
available,
' or a processor identification based on the
family.
If vendor = VENDOR_AMD Then
Color 7, 0: Print String$(2, 32); "CPU Name:
";
Color 15, 0:
If maxCpuidInputEx > &h80000003 Then
Print nameString
Else
If family = 4 Then
Print "Am486/Am 5x86 (X5)"
Elseif family = 5 Then
Print "K5 Family"
Elseif family = 6 Then
Print "K6 Family"
Else
Print "Unknown/New CPUID: ";
displayFamily; "."; displayModel; "."; steppingID;
":"; signature
End If
End If
Else
End If
RETURN
Envir: 'Get the ENVIRON$ variables...
IF ENVIRON$("OS") = "Windows_NT" THEN
CPUN$ =
ENVIRON$("NUMBER_OF_PROCESSORS")
CPUA$ =
ENVIRON$("PROCESSOR_ARCHITECTURE")
CPUL$ =
ENVIRON$("PROCESSOR_LEVEL")
CPUR$ =
ENVIRON$("PROCESSOR_REVISION")
CPUI$ =
ENVIRON$("PROCESSOR_IDENTIFIER")
ELSE
END IF
GOSUB Finder
RETURN
Finder: 'Find the information...
Famly! = INSTR(1, CPUI$, "Family") + 7
CModel! = INSTR(1, CPUI$, "Model") + 6
Stepp! = INSTR(1, CPUI$, "Stepping") + 9
Comma! = INSTR(1, CPUI$, CHR$(44)) + 2
Revis! = INSTR(1, CPUR$, CHR$(61)) + 1
CNumb! = INSTR(1, CPUN$, CHR$(61)) + 1
Famly$ = MID$(CPUI$, Famly!, 2)
CModel$ = MID$(CPUI$, CModel!, 2)
Stepp$ = MID$(CPUI$, Stepp!, 1)
Brand$ = MID$(CPUI$, Comma!, 12)
Revis$ = UCASE$(RTRIM$(MID$(CPUR$,
Revis!, 6)))
CNumb$ = UCASE$(RTRIM$(MID$(CPUN$,
CNumb!, 2)))
GOSUB ExtCPUID
RETURN
ExtCPUID: 'Show Extended CPUID
Information...
COLOR 7, 0: PRINT string$(4, 32); "Family: ";
COLOR 15, 0: PRINT Famly$
COLOR 7, 0: PRINT string$(5, 32); "Model: ";
COLOR 15, 0: PRINT CModel$
COLOR 7, 0: PRINT string$(2, 32); "Stepping:
";
COLOR 15, 0: PRINT Stepp$
COLOR 7, 0: PRINT string$(4, 32); "# CPUs: ";
COLOR 15, 0: PRINT CNumb$
COLOR 7, 0: PRINT string$(4, 32); "RevKey: ";
COLOR 15, 0: PRINT Revis$
'COLOR 7, 0: PRINT string$(4, 32); "Vendor: ";
'COLOR 15, 0: PRINT Brand$
RETURN
SUB Delay(TimeS)
StartTime = TIMER
EndTime = (TIMER + TimeS)
IF EndTime > 86400 THEN EndTime =
(EndTime - 86400)
DO: LOOP UNTIL TIMER > EndTime
EXIT SUB
END SUB
The program is able to detect many CPU features. Including IA-64, AMD x64 and others as well.
: The program has been patched to reveal the CPUID data, whether or not if finds the CPUID feature data.