Assembler Converter from 16-bit Intel ASM to 32-bit AT&T S syntax

Home Page

This is an Assembly language converter from 16-bit Intel (ASM) to 32-bit AT&T (S) syntax.

This article is intended to serve as an example of a practical, large application of SR.  Similar techniques can be used to convert between other computer languages or file formats.  After you gain an understanding of how this converter works, you can change it to meet your specific needs.

The input is expected to be an ASM assembly file that had been assembled in the 1980’s using the old Borland Turbo Assembler for a 16-bit MCS-86 program.  It must use lower-case mnemonics & operands with tabbed columns.

The output will be close to the equivalent S assembly source file for a modern 32-bit Intel processor using AT&T syntax.

There is no automated total converter.  The result of this converter will need many details fixed, but the tedious part will be finished for you in a few minutes.

The command line needs you to just type 2 file names without extensions.  The first is the name of the batch file below.  I called it “Intel2ATT.BAT”.  The second is the name of the old ASM file that you want to convert.  For example:

Intel2ATT OldFile

This converter uses the following rules to target the GNU AS (GAS) assembler:
Byte registers require a “$” prefix.
Tabs, CR/LF and trailing white-space are OK, but trailing white-space is removed, anyway.
Register: AS: No extra punctuation; for example loc. Intel: Square brackets; for example [loc].
Address: AS: Prefix with ‘$’; for example $loc. Intel: No extra punctuation; for example loc.
Memory: AS: Parentheses; for example (%eax). Intel: Square brackets; for example [eax].
size: AS: Explicit in op-code; for example movw for word. Intel: Implicit, deduced by assembler; for example mov.
? is no longer accepted as a value.

The process includes a tab ending each line and before comments.

Click here and copy the listing, paste it into a text editor and save it as “Intel2ATT.BAT”.  NOTEPAD can do it.

 – Gareth B. Dolby

Top

 Home Page

7 thoughts on “Assembler Converter from 16-bit Intel ASM to 32-bit AT&T S syntax”

  1. You have made some decent points there. I checked on the net
    to learn more about the issue and found most people will go along
    with your views on this website.

  2. I have changed my spam filter, because I have not seen any comments since installing the former filter. Post your comment, now.

    Admin:
    Gareth

  3. I would like to thank you for the efforts you have put in writing this site. I’m hoping the same high-grade website post from you in the upcoming also. In fact your creative writing abilities has inspired me to get my own website now. Really the blogging is spreading its wings fast. Your write up is a great example of it.

Leave a Reply to computer junkyard Cancel reply

Your email address will not be published.