diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-10-17 21:45:37 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-10-17 21:45:37 +0200 |
commit | 8f28495ab9a8ebf53868405541e907394895e51f (patch) | |
tree | 51b27870ed64522e1d54e4f031276e18fe181ee8 /intel.cpp | |
parent | 72ff79d76c7ec16ea1b95c72af0838f0e1150735 (diff) |
Add add
Diffstat (limited to 'intel.cpp')
-rw-r--r-- | intel.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
@@ -22,21 +22,6 @@ using namespace std::placeholders; namespace { - // REX prefix: 0b0100WRXB - std::vector<uint8_t> 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<uint8_t> imm8(std::string s) { long value{ std::stol(s) }; uint8_t* bin = reinterpret_cast<uint8_t*>(&value); @@ -138,20 +123,6 @@ namespace { std::unordered_map<std::string, std::function<InstructionCodeList(const std::vector<Token>&)>> ops_old{ - // Integer Addition - {"add", [](const std::vector<Token>& sl) -> InstructionCodeList { - if (sl.size() == 3) { - if (sl[1].value == "eax") { // ADD EAX, imm32 - return { { std::vector<uint8_t>{ 0x05 } +imm32(sl[2].value), {} } }; - } else if (sl[1].value == "rax") { // ADD RAX, imm32 - return { { REX("W") + std::vector<uint8_t>{ 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 })}, |