Identifying CPU features

This works on Pentiums and above.

[code=thinbasic]
' Using Machine Code with ThinBasic
'---------------------------------------------------------------------------
'---Reference:
' Intel x86 Architecture Ref Manual Vol 2
'---http://developer.intel.com/design/pentiumii/manuals/243191.htm
'---------------------------------------------------------------------------
' Syntax rules:
' #Variable patches in long address of Variable (4 bytes)
' NLn patches in long decimal value n (4 bytes)
' comments are indicated by a quote mark '
' all other words are read as hexadecimal bytes.
' An error during MC_Eval$ will produce a string containing &hc3 (ret) only.

'----------------------------------------------
' CPUID
' Identifying some key CPU features
' see page 3-111 in the manual above
'----------------------------------------------
dim sMC as string = MC_Eval$ "
b8 01 00 00 00 ' mov eax,1 request feature info in edx
0f a2 ' cpuid
8b c2 ' mov eax,edx
c3 ' ret
"
'----------------------------------------------
' ---Invoke the machine code string
dim RetVal as long = MC_Exec(sMC)
dim s as string="CPU Features:"+$crlf

if Retval and &h0000001 then s+="FPU "+$crlf ' bit0 FPU
if RetVal and &h0008000 then s+="CMOV "+$crlf ' bit15 CMOV
if RetVal and &h0010000 then s+="FGPAT"+$crlf ' bit16 FGPAT
if RetVal and &h0800000 then s+="MMX "+$crlf ' bit23 MMX
if RetVal and &h1000000 then s+="FXR "+$crlf ' bit24 FXSAVE / FXRSTOR
if RetVal and &h2000000 then s+="XMM (streaming simd)"+$crlf ' bit25 XMM streaming SIMD
MsgBox 0, hex$(RetVal)+$crlf+$crlf+s
'
'----------------------------------------------
[/code]