Original Post
Hi all, I am having trouble setting values of class memebers using the inline assembler if they have been previously initialized. I cant quite figure out what the problem is exactly, but I have a feeling it has to do with my lack of understanding how certain instructions, like mov, move data around. Here is some code to help illustrate my problem: If I remove the intialization for the three BOOL's, the GetFeatures() function will set them properly, otherwise they will always be false. I am assuming in the code that the values are true as long as they are not equal to zero.
class CCpuInfo
{
public:
/// constructor
CCpuInfo();
/// destructor
virtual ~CCpuInfo();
...
/// find supported features, mmx, sse, 3dnow!, ect..
void GetFeatures();
private:
BOOL supportSSE;
BOOL supportSSE2;
BOOL supportMMX;
...
};
//------------------------------------------------------------------------------
/**
*/
CCpuInfo::CCpuInfo() :
supportSSE ( FALSE ),
supportSSE2 ( FALSE ),
supportMMX ( FALSE ),
{
}
void CCpuInfo::GetFeatures()
{
BOOL *_supportSSE = &this->supportSSE;
BOOL *_supportSSE2 = &this->supportSSE2;
BOOL *_supportMMX = &this->supportMMX;
__asm {
mov eax, 1
CPUID
test edx, 02000000h
jz _NOSSE
mov [_supportSSE], 1
_NOSSE: test edx, 04000000h
jz _NOSSE2
mov [_supportSSE2], 1
_NOSSE2: test edx, 00800000h
jz _EXIT
mov [_supportMMX], 1
_EXIT:
}
}