www.delorie.com/djgpp/v2faq/faq135.html | search |
| Previous | Next | Up | Top |
$
; Intel immediate operands are undelimited (Intel push 4
is AT&T pushl $4
).
%
; Intel register operands are undelimited. AT&T absolute (as opposed to PC-relative) jump
/call
operands are
prefixed by *
; they are undelimited in Intel syntax.
add eax, 4
is addl $4, %eax
in AT&T syntax.
The source, dest
convention is maintained for compatibility with previous Unix assemblers, so that GCC won't care about the assembler with which it is configured, as some of GCC
installations (on systems other than MS-DOS) don't use GNU Binutils.
b
, w
, and l
specify byte (8-bit),
word (16-bit), and long (32-bit) memory references. Intel syntax accomplishes this by prefixing memory operands (not the opcodes themselves) with `byte ptr'
, `word
ptr'
, and `dword ptr'.
Thus, Intel mov al, byte ptr FOO
is movb FOO, %al
in AT&T syntax.
lcall/ljmp $SECTION, $OFFSET
in AT&T syntax; the Intel syntax is call/jmp far SECTION:OFFSET.
Also, the far return instruction
is lret $STACK-ADJUST
in AT&T syntax; Intel syntax is ret far STACK-ADJUST.
SECTION:[BASE + INDEX*SCALE + DISP]is translated into the AT&T syntax
SECTION:DISP(BASE, INDEX, SCALE)
Intel: [ebp - 4] AT&T: -4(%ebp) Intel: [foo + eax*4] AT&T: foo(,%eax,4) Intel: [foo] AT&T: foo(,1) Intel: gs:foo AT&T: %gs:fooFor a complete description of the differences, see the "i386-Dependent" section of the "GNU assembler documentation". If you don't read this FAQ with an Info browser, download GNU Binutils, unzip the files named as.iN (where N is a digit) from it, then type at the DOS prompt:
info as machine i386You will see a menu of Gas features specific to x86 architecture.
A guide is available which was written by Brennan Underwood; it describes how to use inline assembly programming with DJGPP and includes a tutorial on the AT&T assembly syntax. Check out the DJGPP inline assembly tutorial. Another useful tutorial about writing separate assembly-language modules for DJGPP was written by George Foot and is available from George's home page. The DJGPP User's Guide also has a tutorial on writing assembly-language code. Many people who used Intel syntax and then converted to the AT&T style say that they like the AT&T variant more. However, if you prefer to stick with the Intel syntax, download and install NASM, which is a free portable assembler. It is compatible with DJGPP and accepts a syntax which is much more similar to the Intel style. A guide for using NASM with DJGPP was written by Matthew Mastracci and is available from Matthew's Web page.
webmaster donations bookstore | delorie software privacy |
Copyright ⌐ 1998 by Eli Zaretskii | Updated Sep 1998 |
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)