Page 1 of 1

Simple AT&T ASM Prob

Posted: Mon Mar 08, 2004 2:38 am
by srg
Hi

This is my first real attempt at any AT&T inline asm and this is driving me arround the bend:

asm ("movl %esp, %0": "=g" (temp) : : "memory");

I want to move a value from esp to a local variable called temp but I get this error:

operand number missing after %-letter

What am I doing wrong?

thanks
srg

Re:Simple AT&T ASM Prob

Posted: Mon Mar 08, 2004 2:49 am
by Candy
srg wrote: asm ("movl %esp, %0": "=g" (temp) : : "memory");
...
operand number missing after %-letter
asm ("movl %%esp, %0": "=g" (temp) : : "memory");

AT&T sucks.

Re:Simple AT&T ASM Prob

Posted: Mon Mar 08, 2004 8:11 am
by srg
Candy wrote:
srg wrote: asm ("movl %esp, %0": "=g" (temp) : : "memory");
...
operand number missing after %-letter
asm ("movl %%esp, %0": "=g" (temp) : : "memory");

AT&T sucks.
Well I'm still concidering coding any assembly as seperate routines in NASM, I'm nice and familliar with that.

Re:Simple AT&T ASM Prob

Posted: Thu Mar 11, 2004 1:36 am
by Solar
One, GNU as (the assembler used for inline ASM in gcc) can also to Intel syntax.

Two, AT&T doesn't suck any more than any other ASM dialect, just because a user used the wrong syntax. If I forget a '$' in my Perl script, that's just as wrong and doesn't say Perl sucks.

Three, personally I consider AT&T syntax much superior because I have previous experience on 6502 and 68k CPUs - I consider Intel syntax to be seriously broken. ;-)

Re:Simple AT&T ASM Prob

Posted: Thu Mar 11, 2004 3:38 am
by Candy
Solar wrote: One, GNU as (the assembler used for inline ASM in gcc) can also to Intel syntax.
In a broken way, with still most of the same problems Intel-syntax people had with at&t syntax.
Two, AT&T doesn't suck any more than any other ASM dialect, just because a user used the wrong syntax. If I forget a '$' in my Perl script, that's just as wrong and doesn't say Perl sucks.
I wasn't referring to the user error but more to the unintuitive (yes, I know it's only past experience, don't flame me now) concept of using one percent-sign with registers, but if you use arguments you have to modify them all to use 2 percent signs.
Three, personally I consider AT&T syntax much superior because I have previous experience on 6502 and 68k CPUs - I consider Intel syntax to be seriously broken. ;-)
I can understand that, have done 68HC11 programming myself. Still, for x86es the intel syntax is lots better (imo). I still can't figure out how exactly to encode a sib operation in AT&T syntax, but in intel syntax its just [xxx] with on the place of XXX some addition of some operands you'd like. Lots more intuitive than a 8(ebx, eax, 4) something to me...