From 009e450626194299ee4b5ccb8463ac64e127fde6 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 13 Nov 2020 17:50:02 +0100 Subject: Added push and pop --- asm/intel64/pop.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 asm/intel64/pop.cpp (limited to 'asm/intel64/pop.cpp') diff --git a/asm/intel64/pop.cpp b/asm/intel64/pop.cpp new file mode 100644 index 0000000..8528b15 --- /dev/null +++ b/asm/intel64/pop.cpp @@ -0,0 +1,30 @@ +#include "pop.h" + +#include "codes.h" + +#include +#include + +#include + +using namespace std::string_literals; + +Op_pop::Op_pop(Asm::Args& args) +{ + if (args[0].type() == typeid(Asm::Args::Register64)) { // pop reg64 + machine_code = std::vector{ 0x58 } + RegNo(std::any_cast(args[0]).name()); + } else { + throw std::runtime_error("Unimplemented: pop "s + args[0].type().name()); + } +} + +namespace { + +bool registered { + registerOp(mangleName("pop"), [](Asm::Args& args) -> std::shared_ptr{ + return std::make_shared(args); + }) +}; + +} + -- cgit v1.2.3