How to Get the CPU Vendor Name

The CPUID instruction gives you a lot of information about the CPU. You don’t have to write hundreds of lines of code to find out what CPU is installed as you have to to find out if a 286 or a 386 chip is installed. To get the CPU vendor name use this code. This function uses the CPUID instruction, so use the previous tip to find out if the installed processor supports this.

  {$ifndef ver80} // Because of 32 bit register use
    function GetVendorString: string;
    var
      aVendor: array[0..2] of DWord;
      iI, iJ : Integer;
    begin
      asm
        push  ebx
        xor   eax, eax
        dw    $A20F // CPUID instruction
        mov   DWord ptr aVendor, ebx
        mov   DWord ptr aVendor[+4], edx
        mov   DWord ptr aVendor[+8], ecx
        pop   ebx
      end;
      for iI := 0 to 2 do
        for iJ := 0 to 3 do
          Result := Result + Chr((aVendor[iI] and ($000000FF shl (iJ * 8))) shr (iJ * 8));
    end;
  {$endif}

Tags: , , , , , , , , , , , , , , , , , , ,

No Comments Yet

You can be the first to comment!

Leave a comment

OpenID Login

Standard Login