From f86999e137f43372236f2dccd1fe3572a85c0dcd Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 17 Oct 2020 14:16:46 +0200 Subject: Separate-out assembler --- asm/assembler.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 asm/assembler.cpp (limited to 'asm/assembler.cpp') diff --git a/asm/assembler.cpp b/asm/assembler.cpp new file mode 100644 index 0000000..275bd4a --- /dev/null +++ b/asm/assembler.cpp @@ -0,0 +1,17 @@ +#include "assembler.h" + +std::unordered_map ops; + +bool registerOp(const std::string& mnemonic, FactoryFunction f) +{ + if (ops.contains(mnemonic)) { + std::cout << "Warning: mnemonic |" << mnemonic << "| already registered." << std::endl; + return false; + } + + std::cout << "Registering mnemonic |" << mnemonic << "|." << std::endl; + + ops[mnemonic] = f; + + return true; +} -- cgit v1.2.3