» Help

How to retrieve the CPU vendor ID

   

Here is a little assembly code routine that shows how to retrieve the computer's CPU vendor ID.

function GetCPUVendor: string;
var
  aVendor: array [0 .. 2] of LongWord;
  iI, iJ: Integer;
begin
  asm
    push  ebx
    xor   eax, eax
    dw    $A20F // CPUID instruction
    mov   LongWord ptr aVendor, ebx
    mov   LongWord ptr aVendor[+4], edx
    mov   LongWord 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;
Author: Unknown
Contributor: Bill Miller
Added: 2014-01-22
Last updated: 2014-01-22

« Return to contents »