Node:Converting ASM,
Next:ASM GPF,
Previous:Syntax,
Up:Converting
Q: Where can I find an automated conversion tool to convert my
Intel
-style assembly code into a code acceptable by Gas
?
Q: Where can I find a converter from AT&T
assembly to
Intel
style?
A: A SED script which should do most of the conversion was posted to the DJGPP news group.
A program called TA2AS
which can convert TASM
assembly source to AT&T style can be found on the DJGPP server and on Oulu.
TA2AS
was written by Frank van Dijk of the Spirit group; if you
have questions about this tool, you may contact Jan Oonk. The authors say that the program is far from finished,
but the sources are available with the package so you can fix whatever
is broken for your needs.
Another similar converter is Intel2Gas
, available from its
Web page.
Beginning with Binutils 2.10, Gas
has an option that causes it to
accept the Intel syntax, so you can use Gas
to assembly
Intel-style code.
Alternatively, here is what you can do to make your code linkable with DJGPP programs:
Be warned that NASM is not 100% identical to MASM or TASM. Even experienced assembly programmers might need some time to adapt to the slightly different flavor of NASM. If you want something much more similar to TASM, get JAS. JAS is available from OULU.
Also note that NASM, or at least some of its versions, doesn't produce debug info in the format understood by GDB, which makes debugging NASM-assemblied code tedious (you might not be able to display source lines and refer to local symbols by name). Latest versions of NASM might correct this deficiency.
-coff
option
to generate object code in COFF format which can be submitted to GCC, so
you can compile your original source. You can also use the LIB32
librarian from Microsoft C8 to convert object files to COFF by putting
them into a .lib
library, then extracting them as COFF files.
28 Note that, unless you link the
MASM-generated object files with DJGPP's ld
(as opposed
to Microsoft's LINK /CO
command), you won't be able to debug the
resulting program, because the debug info is not in correct format. I'm
also told that masm
doesn't produce sections named ".text" and
".data", so you might need to hex-edit the section names in the object
file manually.
TA2AS
. One place to look
for such a disassembler is on SimTel.NET mirrors.
Keep in mind that syntax is only one of the aspects of converting code written for DOS to DJGPP. You should also make sure your code doesn't violate any of the rules for protected-mode programming (see GPF in asm code).
If you need to perform the opposite conversion, from the AT&T
style to the Intel
style, try the Att2Intl
converter
written by Gregory Velichansky. Its output
is intended for NASM or TASM. Att2Intl
is available
from Greg's home page.