a2sm

What you need to know

This script does nothing more than text replacement. As such, it does not produce any sort of optimized code, and hand-written code is better. However, it's still a useful tool. It's a disgusting mess QUALITY SOLUTION of regular expressions, and here it is: a2sm.sh
(Last updated Jan 25, 5:12pm PST)

Usage

First, you'll need execute permissions on the script itself. cd to the directory with the script, and run chmod +x a2sm.sh

C code is not directly handled by a2sm, but instead it reads the x86 assembly (intel syntax) that gcc generates from C files. In order to get this assembly, you run the following command: gcc -S -masm=intel my-code.c Which will produce a file named my-code.s in the same directory. Now you're ready to translate it!

The script takes the filename to read from as the only argument, and writes the translated assembly to stdout. So to capture it into a file of its own, simply redirect the output like so: ./a2sm.sh my-code.s > sm213-out.s And if you're lucky, all will have gone well. Due to the fact that a2sm is entirely pattern matching, most things will cause it to produce incorrect assembly without any warning. Check out the next section for what to not do.

What to Avoid...

Newest Changes

The Future?