How to retrieve the CPU vendor ID #231

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;
Original resource:
Author:
Contributor: Bill Miller
Added: 2014/01/22
Last updated: 2014/01/22