diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2018-06-16 16:11:01 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2018-06-16 16:11:01 +0200 |
| commit | 95bc5cd73abd425045889638ccd7dc756419ac15 (patch) | |
| tree | b028dce9fb6bb81feae1c6b2ce3f80f614c89932 /emulate/emulator.hpp | |
| parent | ca642d0c8b0a3dd5f768749b58ba66ac35472610 (diff) | |
| download | openwar-95bc5cd73abd425045889638ccd7dc756419ac15.tar.gz openwar-95bc5cd73abd425045889638ccd7dc756419ac15.tar.bz2 openwar-95bc5cd73abd425045889638ccd7dc756419ac15.zip | |
Implements CLD and O_SMEM as src operand.
Diffstat (limited to 'emulate/emulator.hpp')
| -rw-r--r-- | emulate/emulator.hpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/emulate/emulator.hpp b/emulate/emulator.hpp index ce0e1c6..fc33722 100644 --- a/emulate/emulator.hpp +++ b/emulate/emulator.hpp @@ -206,6 +206,33 @@ public: } break; } + case O_SMEM: { + auto segment = register_getters.at(SEGMENT_GET(inst.segment))(); + auto segment_offset = ldt[boost::apply_visitor(return_visitor(), segment) >> 3].offset; + auto register_contents = register_getters.at(src_op.index)(); + int32_t offset = boost::apply_visitor(return_visitor(), register_contents) + inst.disp; + std::cout << segment_offset << std::endl << offset << std::endl << inst.disp << std::endl; + std::cout << segment_offset + offset + inst.disp << std::endl; + auto memory_offset = segment_offset + offset + inst.disp; + switch(src_op.size) { + case 8: { + src = *reinterpret_cast<uint8_t*>(&memory[memory_offset]); + break; + } + case 16: { + src = *reinterpret_cast<uint16_t*>(&memory[memory_offset]); + break; + } + case 32: { + src = *reinterpret_cast<uint32_t*>(&memory[memory_offset]); + break; + } + default: { + throw UnhandledInstruction(); + } + } + break; + } default: { throw UnhandledInstruction(); } @@ -231,6 +258,7 @@ public: void handle_I_OR (_DInst inst); void handle_I_ADD (_DInst inst); void handle_I_PUSH(_DInst inst); + void handle_I_CLD (_DInst inst); void int_0x21(); void int_0x31(); |
