Previous: ARM Assembler, Up: Assembler and Code Words


5.27.10 Other assemblers

If you want to contribute another assembler/disassembler, please contact us (anton@mips.complang.tuwien.ac.at) to check if we have such an assembler already. If you are writing them from scratch, please use a similar syntax style as the one we use (i.e., postfix, commas at the end of the instruction names, see Common Assembler); make the output of the disassembler be valid input for the assembler, and keep the style similar to the style we used.

Hints on implementation: The most important part is to have a good test suite that contains all instructions. Once you have that, the rest is easy. For actual coding you can take a look at arch/mips/disasm.fs to get some ideas on how to use data for both the assembler and disassembler, avoiding redundancy and some potential bugs. You can also look at that file (and see Advanced does> usage example) to get ideas how to factor a disassembler.

Start with the disassembler, because it's easier to reuse data from the disassembler for the assembler than the other way round.

For the assembler, take a look at arch/alpha/asm.fs, which shows how simple it can be.