diff --git a/InstructionSets/x86/Implementation/PerformImplementation.hpp b/InstructionSets/x86/Implementation/PerformImplementation.hpp index af4602a33..aacad8c6d 100644 --- a/InstructionSets/x86/Implementation/PerformImplementation.hpp +++ b/InstructionSets/x86/Implementation/PerformImplementation.hpp @@ -1460,6 +1460,16 @@ void stos(const InstructionT &instruction, AddressT &eCX, AddressT &eDI, IntT &e repeat(instruction, eCX, flow_controller); } +template +void out(uint16_t port, IntT value, IOT &io) { + io.template out(port, value); +} + +template +void in(uint16_t port, IntT &value, IOT &io) { + value = io.template in(port); +} + } template < @@ -1476,7 +1486,7 @@ template < FlowControllerT &flow_controller, RegistersT ®isters, MemoryT &memory, - [[maybe_unused]] IOT &io + IOT &io ) { using IntT = typename DataSizeType::type; using AddressT = uint16_t; // TODO. @@ -1693,6 +1703,23 @@ template < } return; + case Operation::OUT: { + uint16_t port; + switch(instruction.destination().source()) { + case Source::DirectAddress: port = instruction.operand(); break; + default: port = registers.dx(); break; + } + Primitive::out(port, pair_low(), io); + } return; + case Operation::IN: { + uint16_t port; + switch(instruction.source().source()) { + case Source::DirectAddress: port = instruction.operand(); break; + default: port = registers.dx(); break; + } + Primitive::in(port, pair_low(), io); + } return; + case Operation::XLAT: Primitive::xlat(instruction, memory, registers); return; case Operation::POP: source() = Primitive::pop(memory, registers); break; diff --git a/OSBindings/Mac/Clock SignalTests/8088Tests.mm b/OSBindings/Mac/Clock SignalTests/8088Tests.mm index 2fd82d375..d63b25555 100644 --- a/OSBindings/Mac/Clock SignalTests/8088Tests.mm +++ b/OSBindings/Mac/Clock SignalTests/8088Tests.mm @@ -179,6 +179,8 @@ struct Memory { uint16_t write_back_value_; }; struct IO { + template void out([[maybe_unused]] uint16_t port, [[maybe_unused]] IntT value) {} + template IntT in([[maybe_unused]] uint16_t port) { return IntT(~0); } }; class FlowController { public: @@ -352,9 +354,15 @@ struct FailedExecution { @"4C.json.gz", @"4D.json.gz", @"4E.json.gz", @"4F.json.gz", @"FE.1.json.gz", @"FF.1.json.gz", +*/ + // OUT + @"E6.json.gz", @"E7.json.gz", + @"EE.json.gz", @"EF.json.gz", - // TODO: IN, OUT - + // IN + @"E4.json.gz", @"E5.json.gz", + @"EC.json.gz", @"ED.json.gz", +/* @"70.json.gz", // JO @"71.json.gz", // JNO @"72.json.gz", // JB @@ -413,11 +421,11 @@ struct FailedExecution { // STOS @"AA.json.gz", @"AB.json.gz", - // TODO: INS, OUTS -*/ // SCAS @"AE.json.gz", @"AF.json.gz", -/* + + // TODO: INS, OUTS + @"E0.json.gz", // LOOPNE @"E1.json.gz", // LOOPE @"E2.json.gz", // LOOP