summaryrefslogtreecommitdiffhomepage
path: root/intel.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-10-17 17:37:50 +0200
committerRoland Reichwein <mail@reichwein.it>2020-10-17 17:37:50 +0200
commit7b49d17f90f26394a116348befb5edcdffcedcb6 (patch)
treec32e76a9bea5851bfac92708fa626373573e4f06 /intel.cpp
parentf86999e137f43372236f2dccd1fe3572a85c0dcd (diff)
Add ret and int
Diffstat (limited to 'intel.cpp')
-rw-r--r--intel.cpp33
1 files changed, 0 insertions, 33 deletions
diff --git a/intel.cpp b/intel.cpp
index 9dac6c0..9f24f1d 100644
--- a/intel.cpp
+++ b/intel.cpp
@@ -22,17 +22,6 @@ using namespace std::placeholders;
namespace {
- // binary code operators
- std::vector<uint8_t> operator+(std::vector<uint8_t> a, const std::vector<uint8_t>& b) {
- a.insert(a.end(), b.begin(), b.end());
- return a;
- }
-
- std::vector<uint8_t> operator+(std::vector<uint8_t> a, const uint8_t& b) {
- a.push_back(b);
- return a;
- }
-
// REX prefix: 0b0100WRXB
std::vector<uint8_t> REX(std::string s) {
uint8_t result{0b01000000};
@@ -166,23 +155,6 @@ namespace {
// Call Procedure
{"call", std::bind(op_jmp, _1, OP_T{}, OP_T{ 0xE8 })},
- // Interrupt
- {"int", [](const std::vector<Token>& sl) -> InstructionCodeList {
- if (sl.size() == 2) {
- if (sl[1].value == "0") { // INT 0
- return { { std::vector<uint8_t>{ 0xCE }} };
- } else if (sl[1].value == "1") { // INT 1
- return { { std::vector<uint8_t>{ 0xF1 }} };
- } else if (sl[1].value == "3") { // INT 3
- return { { std::vector<uint8_t>{ 0xCC }} };
- } else { // INT <...>
- return { { std::vector<uint8_t>{ 0xCD } +imm8(sl[2].value) } };
- }
- }
-
- // ... TODO
- throw std::runtime_error("Unknown command: "s + sl[0].value);
- }},
// Unconditional Jump
{"jmp", std::bind(op_jmp, _1, OP_T{ 0xEB }, OP_T{ 0xE9 })},
@@ -231,11 +203,6 @@ namespace {
throw std::runtime_error("Unknown command: "s + sl[0].value);
}},
- // Return from procedure
- { "ret", [](const std::vector<Token>& sl) -> InstructionCodeList {
- return {{ std::vector<uint8_t>{ 0xC3 }, {}}}; // near return; TODO: far return is 0xCB
- }},
-
{ "xor", [](const std::vector<Token>& sl) -> InstructionCodeList {
if (sl.size() == 3) {
return { { std::vector<uint8_t>{ 0x33 } + ModRM(sl[1].value, sl[2].value) } }; // r8, r/m8: ModRM:reg (w), ModRM:r/m (r)