Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How to detect Athlon and Pentium in chess engine ???

Author: Omid David Tabibi

Date: 04:47:28 04/18/04

Go up one level in this thread


On April 18, 2004 at 07:23:51, Matthias Gemuh wrote:

>
>Hi Windows programmers,
>how do you detect whether processor is from AMD or Intel ?

Use the "cpuid" assembly instruction if you are working on x86:

        // machine info
	int str1, str2, str3;
	__asm {
		mov		eax, 00h
		cpuid
		mov		str1, ebx
		mov		str2, edx
		mov		str3, ecx
	}
	sprintf(vendorId, "%c%c%c%c%c%c%c%c%c%c%c%c",
		(str1), (str1 >> 8), (str1 >> 16), (str1 >> 24),
		(str2), (str2 >> 8), (str2 >> 16), (str2 >> 24),
		(str3), (str3 >> 8), (str3 >> 16), (str3 >> 24));


vendorId is a string containing the processor name. It will be GenuineIntel or
AuthenticAMD.





>Thanks,
>Matthias



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.