: : :
This message was edited by IDK at 2006-11-15 14:1:56
: : : Anyone tried to use gas inlined assembly? I'm trying to do a simple SSE2 mandelbrot program with inline asm with Dev+C++.
: : :
: : :
: : : int wid=256,heg=256;
: : : #define wid 256
: : : #define heg 256
: : : GLubyte* buffer = new GLubyte[wid*heg];
: : : int y=0;
: : : GLubyte* p;
: : :
: : : main(){
: : : ....
: : : asm(".intel_syntax noprefix \n\
: : : //if(y==0) y=heg, pointer=buffer+wid*heg; \n\
: : : xor eax,eax \n\
: : : or eax,_y \n\
: : : jz initYP \n\
: : : returnInitYP: \n\
: : : \n\
: : : mov ecx,_wid \n\
: : : \n\
: : : mov _pointer,ebx \n\
: : : mov _y,eax \n\
: : : .att_syntax noprefix");
: : : ...
: : : }
: : :
: : :
: : : That was the code calling the code I'm trying to write:
: : :
: : : asm(".intel_syntax noprefix \n\
: : : initYP: \n\
: : : //y=heg, pointer=buffer+wid*heg;\n\
: : : mov eax,_heg \n\
: : : lea ebx,_pointer+256*256 \n\
: : : jmp returnInitYP \n\
: : : .att_syntax noprefix");
: : :
: : :
: : : As you might see, wid and height in the lea statement are wierd.
: : : Since gas cannot do any preprocesing and the manual:
: : :
http://sourceware.org/binutils/docs-2.17/as/index.html
: : : suggests that I'll use the built in featurs of my C compiler.
: : :
: : : How do I do that?
: : :
: : : Anyone?
: : :
: : : EDIT: Firefox crashed when I tried to post this...
: : : I posted a workaround instead, but it still doesn't work for constants in the assembly, but almost...
: : : Now it looks neater anyway.
: : :
: : : I still have no clue...
: : :
: :
: : IMHO statements like a+b*c aren't allowed in ASM, you need to do something like this:
: : MOV EAX, b // EAX = b
: : MUL c // EAX = EAX * c = b * c
: : ADD EAX, a // EAX = EAX + a = b * c + a
: :
: :
NetGert[/italic]
: :
: :
:
: No, I'm just multiplying constants, and constants are calculated by the preproccessor...
:
But you did:
int wid=256,heg=256;
Am I missing something?