C files with inline-asm into bmax?

BlitzMax Forums/BlitzMax Programming/C files with inline-asm into bmax?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Stuart somthing like this, all though i could be wrong. but this does compile. im unsure on '_emit' convertion though.


#include <windows.h>

unsigned __int64 start, stop;
unsigned __int64 nCtr, nFreq, nCtrStop;

int CpuSpeed(void)
{
    QueryPerformanceFrequency((LARGE_INTEGER *)&nFreq);
	
//    __asm__("_emit $0x0F");
//    __asm__("_emit $0x31");

    __asm__("mov _start,%eax");
    __asm__("mov 4+(_start),%edx");
	
    QueryPerformanceCounter((LARGE_INTEGER *)&nCtrStop);
    nCtrStop += nFreq;
    do
	{
        QueryPerformanceCounter((LARGE_INTEGER *)&nCtr);
    } while (nCtr < nCtrStop);
    
//    __asm__("_emit $0x0F");
//    __asm__("_emit $0x31");

    __asm__("mov %eax,_stop");
    __asm__("mov %edx,4+(_stop)");


    return ((stop-start)/1000000);
}



kev