// mnemonic.h #ifndef MNEMONIC_H #define MNEMONIC_H #include #include #include #include #include "opcode.h" struct Empty {}; struct Register { int num; }; struct Immediate { int value; }; struct SymbolRef { std::string name; bool indexed = false; bool immediate = false; bool indirect = false; }; using Operand = std::variant; class Mnemonic { public: Mnemonic(std::uint8_t opcode, InstructionType type, bool extended) : _opcode(opcode), _extended(extended), _type(type) {} std::uint8_t opcode() const { return _opcode; } bool extended() const { return _extended; } InstructionType type() const { return _type; } std::vector& operands() { return _operands; } const std::vector& operands() const { return _operands; } std::string toString() const; private: std::uint8_t _opcode; bool _extended; InstructionType _type; std::vector _operands; }; #endif // MNEMONIC_H