...detect whether the CPU supports MMX?

Author: Michael Wiren

Category: System

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;

 

printed from
www.swissdelphicenter.ch
developers knowledge base