EMA is a project mainly written in Haskell, based on the GPL-3.0 license.
An Elegant MIPS Assembler, written in Haskell
EMA stands for Elegant MIPS Assembler. Note that "elegant" here is not a claim but rather a design goal. EMA specifically targets the R3000 series of processors. Its syntax resembles that used in official MIPS documentation.
EMA is a "pure" MIPS assembler - it doesn't implement any pseudo-instructions. It does, however, have support for macros, so you can easily implement your own. In the future EMA may start with a number of predefined macros.
EMA is very simple - it doesn't support any superfluous section types or complex output formats. It does not use a linker and has no support for modules. It does not do any instruction reordering and will not automatically or intelligently fill delay slots.
EMA is GPL licensed. In the event that you find EMA useful for anything, please contribute at github.com/adamsmasher/EMA.
USAGE:
ema
SYNTAX: Comments start with # and run to the end of a line All register names begin with $, e.g. $zero, $sp, $22, etc. Hex literals are prefixed with 0x, binary literals with % All instructions must live inside of a .text section, all memory allocation directives (i.e. .comm) inside of a .bss section. Memory allocation directives do not actually write anything to the binary - they just define a label for an address in memory. Your file is assembled linearly: a program like
.text 0x80020000 add $1, $2, $3 .text 0x80010000 sub $1, $2, $3
will result in a binary file containing the opcodes for the add and the sub, in that order.
Labels can appear on their own line or before an instruction or other directive. A valid label is either an underscore or a letter followed by zero or more underscores or alphanumeric characters. A label delcaration is always followed by a colon.
l1: add $1, $2, $3
DIRECTIVES:
.align
Ideas for future improvement are listed in the TODO file.
EMA probably has a bug or two.
Enjoy! -Adam (unfactorable dawt polynomial aht gmail dawt cawm)