C++ library of assembler / disassembler that can run on embedded system
// readme
libasm: cross assemble/disassemble library
The libasm allows assembling and disassembling supported retro CPUs on a small environment (less than 9kB-17kB Flash and 350B RAM on AVR Arduino).
Assembler library interface
Assembling MC68HC11 instruction in string to binary can be done in a
minute. You can also add symbol table lookup via
SymbolTable
interface.
#include <asm_mc6800.h>
libasm::mc6800::AsmMc6800 asm6800;
asm6800.setCpu("68HC11");
const char *text = "SUBD $90";
libasm::Insn insn{0x1000};
asm6800.encode(text, insn);
assert(insn.getError() == OK);
assert(insn.address() == 0x1000);
assert(insn.length() == 2); // direct addressing
assert(insn.bytes()[0] == 0x93); // SUBD
assert(insn.bytes()[1] == 0x90); // $90
Disassembler library interface
To disassemble MC68000 binaries, you need to wrap memory by
ArrayMemory
or implements your own
DisMemory
interface to feed binaries. You can also add symbol table lookup via…