Page 1 of 1

at&t syntax

Posted: Fri Jun 04, 2004 5:55 am
by jinksys
I learned assembly with nasm using intel syntax, but I like using at&t's
syntax, but something is confusing me...

I know immediate values must be preceded by $, but what is the
difference between

mov   $label,%eax
mov   label,%eax

Also, nasm uses square brackets to return a value from a memory address like:

mov eax,[label]

What is the at&t equivalent of the square brackets?

Re:at&t syntax

Posted: Fri Jun 04, 2004 11:26 am
by Schol-R-LEA
For direct addressing, you would use the label with no prefix:

movl label, %eax

BTW, remember to use the size postfixes consistently; unlike in NASM, they are mandatory in GAS (AFAIK).

I've just added a page on AT&T syntax to the OS Developement FAQ, based on a posting I wrote several months ago. HTH.