How do I identify which CPU i have from a TP7 program?

I need how to identify what kind of processor and speed has a pc, could tell me some one how to do it?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

K, In normal pascal you can use "Test8086" to check if the processor is 8086, 80286 or 80386... But it won't give show you if your cpu is better than an 80386 cpu. therefore you need to check wich cpu > 80386 that you have... And you have to use asssembler for that one.

Anyway, all you have to test is if the CPU is 80386, 80486 or pentium. Since every CPU since the Pentium has an instruction called CPUID, from wich you could easily Identify it with. I suggest that you get some documents on the CPUID instruction since It can be used in more than one way.

Anyway, here's a pice of codde I found on my HDrive, (It's not made by me) I've only altered it a bit. I hope this helps you enough...

   0 = 8086
   1 = 80186/80286
   2 = 80386
   3 = 80386   (new)
   4 = 80486   (new)
   5 = Pentium (new)
   6 = ??

Note that for Pentium and higher CPUs, the new CPUID instruction is used to
retrieve the processor family number.  This code should work on post-Pentium
(80686-class) CPUs and Pentium compatibles, and could return numbers > 5.
program CPUTest;

const iDStr : string[13] = '            ';

  if (Test8086 = 2) then         { RTL check stops at 2 = 386}
             INC    Test8086     { 3 = 386, for consistency }
                                 { Do we have a 386 or a 486? }
                                 { Does pushf/popf preserve the Alignment Check bit? (386=no, 486=yes) }
             MOV    BX, SP       { save current stack pointer }
             AND    SP, NOT 3    { align stack to avoid AC fault }
    DB $66;  PUSHF
    DB $66;  POP    AX
    DB $66;  MOV    CX, AX
    DB $66,$35; DD $40000        { xor AC bit in EFLAGS }
    DB $66;  PUSH   AX
    DB $66;  POPF
    DB $66;  PUSHF
    DB $66;  POP    AX
    DB $66;  XOR    AX, CX       { Is AC bit toggled? }
             JE @@1              { if not, we have a 386 }
             AND    SP, NOT 3    { align stack to avoid AC fault }
    DB $66;  PUSH   CX
    DB $66;  POPF                { restore original AC bit }
             MOV    SP, BX       { restore original stack pointer }
             MOV  Test8086, 4    { we know we have at least a 486 }

    { Do we have a 486 or a Pentium? }
    { Does pushf/popf preserve the CPUID bit? (486=no, P5=yes) }
    DB $66;  MOV    AX, CX       { get original EFLAGS}
    DB $66,$35; DD $200000      { XOR id bit in flags}
    DB $66;  PUSH   AX
    DB $66;  POPF
    DB $66;  PUSHF
    DB $66;  POP    AX
    DB $66;  XOR    AX, CX      { Is CPUID bit toggled? }
             JE @@1             { if not, we have a 486 }
    DB $66;  XOR    AX, AX
    DB $0F,$A2                  { CPUID, AX = 0 (get CPUID caps) }
             LEA DI,IDStr
    DB $66;  MOV [DI+1],BX
    DB $66;  MOV [DI+5],DX
    DB $66;  MOV [DI+9],CX
    DB $66;  CMP    AX, 1
             JL @@1             { if < 1, then exit }
    DB $66;  XOR    AX, AX
    DB $66;  INC    AX
    DB $0F,$A2                  { CPUID, AX = 1 (get CPU info)   }
             AND    AX, $0F00   { mask out all but family id }
             SHR    AX, 8
             MOV    Test8086, al      { Pentium family = 5 }
  writeln('Test8086: ',Test8086);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.