Mail Archives: djgpp/1994/01/08/20:17:33
> I have come to the conclusion that GAS does not compile the kind of
> assembly code I am used to -- namely, the .ASM files that a garden
> variety DOS assembler works with. Is this correct?
Two big differences:
1. GAS uses the opposite order of operands from most DOS assemblers
2. GAS encodes operand length in the op code, so instead of saying
mov eax,[dword ptr]foo you would say movl foo,%eax (or something like
that). Note that register names are preceeded by %
There are some examples of gas-format assembly language in the djgpp library
sources, or you can use the gcc -S option to generate your own examples from
C source code.
I once considered the possibility of writing a preprocessor which would let
you write assembly language which looked more like a .ASM file (at least put
the operands in the "right" order). But then I realized that most of the
time, if I need to go to assembly language, I first write a C version, then
get assembly language output from the compiler and tweak it. In that mode,
I'm better off getting used to the GAS syntax. (You'll also want to get used
to GAS syntax because that's what you'll get out of the debugger.)
- Raw text -