I use Code::Blocks with the "Microsoft Visual C++ Toolkit 2003" compiler and I've imported a project made in VC++.
There is some code in assembler and it doesn't compile.
_asm
{
mov edi,h.mDstP
mov esi,h.mSrcP
mov ecx,h.mRunLength
copyloop:
movzx eax,WORD PTR [esi]
add esi,4
mov [edi],ax
add edi,2
dec ecx
jnz copyloop
mov h.mDstP,edi
mov h.mSrcP,esi
}
The compiler doesn't know what _asm is.
How can I compile the assembler code?Do u have any ideas? I'd appreciate some help
Hi,
use "__asm" instead of "_asm".
I've tried using "__asm" instead of "_asm" and it doesn't change a thing.
I get the same compiler error : DDI_ASM_CopyPixels16.cpp(1) : error C2059: syntax error : '__asm'
Strange, becouse "__asm" works for me (I also use MS VC Toolkit 2k3 + Platform SDK). This code was compiled without errors:
//glFrustum(-0.104f,0.104f,-0.058f,0.058f,0.1f,100.0f);
__asm
{
push 0x40590000; ///
push 0; // 100.0
push 0x3FB99999; ///
push 0x9999999A; // 0.1
mov eax,0x0E560419
push 0x3FADB22D; ///
push eax; // 0.058
push 0xBFADB22D; ///
push eax; // -0.058
mov eax,0x76C8B439
push 0x3FBA9FBE; ///
push eax; // 0.104
push 0xBFBA9FBE; ///
push eax; // -0.104
call dword ptr glFrustum
}
Working binary: http://www.icpnet.pl/~groman/Release.rar - it's my lame demo in C++ with lot of asm, it uses OpenGL.
Quote from: stream on October 12, 2005, 02:48:22 PM
I use Code::Blocks with the "Microsoft Visual C++ Toolkit 2003" compiler and I've imported a project made in VC++.
There is some code in assembler and it doesn't compile.
...
The compiler doesn't know what _asm is.
you must have some other syntax error in your program, i just checked, and the following sample with your asm code compiles and runs quite fine using VCTK2003
#include <stdio.h>
#include <stdlib.h>
typedef struct tagHS {
__int32* mSrcP;
__int16* mDstP;
int mRunLength;
} HS ;
void cpInt2Short(HS h) {
_asm {
mov edi,h.mDstP
mov esi,h.mSrcP
mov ecx,h.mRunLength
copyloop:
movzx eax,WORD PTR [esi]
add esi,4
mov [edi],ax
add edi,2
dec ecx
jnz copyloop
mov h.mDstP,edi
mov h.mSrcP,esi
}
}
void someasmfoo( void)
{
#define LENGTH 10
__int32 ia1[LENGTH];
__int16 ia2[LENGTH];
HS h;
for(int i=0; i<LENGTH; i++){
ia1[i] = i+100;
}
h.mRunLength = LENGTH;
h.mSrcP = ia1;
h.mDstP = ia2;
cpInt2Short(h);
for(int i=0; i<LENGTH; i++){
printf("i: %i , ia1: %i , ia2: %i\n",i,ia1[i],ia2[i]);
}
}
int main()
{
someasmfoo();
printf("done.\n");
return 0;
}
I've made a new project and tryed some assembler code and it worked just fine. The assembler code seems not to be the problem. I think the problem is the order in wich files are beeing compiled.
It's so confusing because in VC++ it compiles perfectly and I've noticed that the file compilation order in VC++ differs from that in C::B.
Do you have any ideas how may I fix this or what else could be wrong?
I apreciate your concern.
Quote from: stream on October 12, 2005, 09:59:56 PM
I've made a new project and tryed some assembler code and it worked just fine. The assembler code seems not to be the problem. I think the problem is the order in wich files are beeing compiled.
It's so confusing because in VC++ it compiles perfectly and I've noticed that the file compilation order in VC++ differs from that in C::B.
Do you have any ideas how may I fix this or what else could be wrong?
I apreciate your concern.
I have no idea. Compress your project and put it here. Maybe somebody looks into it and will help you.
thanx for your concerne, but I've managed top compile it.
The problem occur when I've imported the VC++ project, it forgot some settings - and i've had to cycle through all the cpp files and select the ones that compile and link and the ones that don't. :)