Using intel syntax asm with gcc
Posted: Sun Feb 19, 2006 1:21 pm
I was googling trying to figure out how to use the att syntax and then i saw http://wiki.bfh.ch/index.php/Inline_@$$ ... th_the_GCC and it
showed an exact intel syntax which is super easy to use and no more %0,%%eax crap
here is the small code snipplet that demonstrated it
well i just wanted to share that cause i have seen many new coders(including me) saying "how do you change asm to normal" or "can i use nasm so i get the normal looking way"
which i thought was all no until now.
showed an exact intel syntax which is super easy to use and no more %0,%%eax crap
here is the small code snipplet that demonstrated it
Code: Select all
static int VarD = 0x27439AB;
static int VarB = 19;
static int VarA = 8;
static int VarC = -56;
int main() {
__asm (
".intel_syntax noprefix\n" //this tells it to go intel
"mov EAX,[VarA]\n"
"add EAX,[VarB]\n"
"mov [VarC],EAX\n"
".att_syntax \n" //remember that the compiler still uses att syntax so this should be at the end everytime
);
VarC = VarA + VarB;
return 0;
}
which i thought was all no until now.