Portable Macro Assembler
Many years ago I wrote a macro assembler for a project I was working on. I have decided to make this available to those who might find a use for it. It is pretty simple to use, and can be fixed to assemble for a variety of processors. I have written samples for Intel 386, Zilog z8000, Motorola 6809 and 68000 and the Western Design Center 65C816. The output format is currently set to produce unix a.out format. It does not support ELF or PE formats, although these would be easy to add. This code is made available under non-commeral use. If you make any changes to this code, please send them back to me and I will integrate them into source.
The assembler is a basic two pass design, with support for listing generation and macro expansion. For a new processor you will need to create a table.c file and a machine.c and machine.h field. The table.c file describes all the opcodes that the processor supports, and how to encode them. As the assembler reads each line, it looks it up in the optab table and calls the machine() function in machine.c to handle it. This function can use the rest of the assembler routines to parse the operands and generate the object code. Support for generic pseudo ops are provided by the assembler.
The source can be downloaded here: as.tar.gz.