summaryrefslogtreecommitdiff
path: root/emulate/emulator.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'emulate/emulator.hpp')
-rw-r--r--emulate/emulator.hpp28
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();