Node:Converting ASM, Next:, Previous:Syntax, Up:Converting

17.2 Converting between Intel ASM syntax and AT&T syntax

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:

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.