Mega Code Archive

 
Categories / Delphi / System
 

Detect whether the cpu supports mmx

function SupportsMMX: Boolean; begin Result := False; try asm push eax push ebx push ecx push edx pushfd pop eax mov ebx,eax xor eax,$00200000 push eax popfd pushfd pop eax xor eax,ebx je @NoMMX mov eax,$01 test edx,$800000 jz @NoMMX mov byte ptr[Result],1 @NoMMX: pop edx pop ecx pop ebx pop eax end; except; end; end; procedure TForm1.Button1Click(Sender: TObject); begin if SupportsMMX then ShowMessage('Computer supports MMX'); end;