From 8f28495ab9a8ebf53868405541e907394895e51f Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 17 Oct 2020 21:45:37 +0200 Subject: Add add --- intel.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'intel.cpp') diff --git a/intel.cpp b/intel.cpp index 9f24f1d..65b9f3f 100644 --- a/intel.cpp +++ b/intel.cpp @@ -22,21 +22,6 @@ using namespace std::placeholders; namespace { - // REX prefix: 0b0100WRXB - std::vector REX(std::string s) { - uint8_t result{0b01000000}; - if (s == "W") - result |= 0b00001000; - if (s == "R") - result |= 0b00000100; - if (s == "X") - result |= 0b00000010; - if (s == "B") - result |= 0b00000001; - - return { result }; - } - std::vector imm8(std::string s) { long value{ std::stol(s) }; uint8_t* bin = reinterpret_cast(&value); @@ -138,20 +123,6 @@ namespace { std::unordered_map&)>> ops_old{ - // Integer Addition - {"add", [](const std::vector& sl) -> InstructionCodeList { - if (sl.size() == 3) { - if (sl[1].value == "eax") { // ADD EAX, imm32 - return { { std::vector{ 0x05 } +imm32(sl[2].value), {} } }; - } else if (sl[1].value == "rax") { // ADD RAX, imm32 - return { { REX("W") + std::vector{ 0x05 } +imm32(sl[2].value), {} } }; - } - } - - // ... TODO - throw std::runtime_error("Unknown command: "s + sl[0].value); - }}, - // Call Procedure {"call", std::bind(op_jmp, _1, OP_T{}, OP_T{ 0xE8 })}, -- cgit v1.2.3