Ok, Hey guys. I was wondering how I would come about performing basic addition in GCC using inline Intel syntax assembly. I have a way of doing it in AT&T but in my opinion I just prefer using Intel generally.
Ok, My AT&T code is this:
#include <stdio.h>
int main()
{
int row = 14, boat = 7;
asm (
"addl %%ebx, %%eax"
:"=a"(row)
:"a"(row), "b"(boat)r
);
printf("row + boat = %d\n", row);
return 0;
}
My boshed up Intel code is:
#include <stdio.h>
int main()
{
int row = 14, boat = 7;
asm(
".intel_syntax noprefix\n"
"mov ebx, row\n"
"mov eax, boat\n"
"add eax, ebx\n"
".att_syntax\n"
);
printf("row + boat = %d", row);
return 0;
}
In Layman's terms I wish for it to be translated into Intel Syntax in a way that it doesn't give me errors :p
Oh and if it helps, the errors:
Assembler messages:
Error: too many memory references for `mov'
Error: junk `PTR [esp+4]' after expression
Error: too many memory references for `mov'
Error: junk `PTR [esp]' after expression
Error: too many memory references for `mov'
Error: too many memory references for `mov'
Thanks in advanced.