diff --git a/InstructionSets/x86/Implementation/PerformImplementation.hpp b/InstructionSets/x86/Implementation/PerformImplementation.hpp index 9d71babe2..1160b2aaf 100644 --- a/InstructionSets/x86/Implementation/PerformImplementation.hpp +++ b/InstructionSets/x86/Implementation/PerformImplementation.hpp @@ -1360,7 +1360,7 @@ bool repetition_over(const InstructionT &instruction, AddressT &eCX) { } template -void repeat(const InstructionT &instruction, Status &status, AddressT &eCX, FlowControllerT &flow_controller) { +void repeat_ene(const InstructionT &instruction, Status &status, AddressT &eCX, FlowControllerT &flow_controller) { if( instruction.repetition() == Repetition::None || // No repetition => stop. !(--eCX) || // [e]cx is zero after being decremented => stop. @@ -1372,6 +1372,17 @@ void repeat(const InstructionT &instruction, Status &status, AddressT &eCX, Flow flow_controller.repeat_last(); } +template +void repeat(const InstructionT &instruction, AddressT &eCX, FlowControllerT &flow_controller) { + if( + instruction.repetition() == Repetition::None || // No repetition => stop. + !(--eCX) // [e]cx is zero after being decremented => stop. + ) { + return; + } + flow_controller.repeat_last(); +} + template void cmps(const InstructionT &instruction, AddressT &eCX, AddressT &eSI, AddressT &eDI, MemoryT &memory, Status &status, FlowControllerT &flow_controller) { if(repetition_over(instruction, eCX)) { @@ -1388,7 +1399,7 @@ void cmps(const InstructionT &instruction, AddressT &eCX, AddressT &eSI, Address Primitive::sub(lhs, rhs, status); - repeat(instruction, status, eCX, flow_controller); + repeat_ene(instruction, status, eCX, flow_controller); } template @@ -1403,7 +1414,7 @@ void lods(const InstructionT &instruction, AddressT &eCX, AddressT &eSI, IntT &e eAX = memory.template access(source_segment, eSI); eSI += status.direction() * sizeof(IntT); - repeat(instruction, status, eCX, flow_controller); + repeat(instruction, eCX, flow_controller); } diff --git a/OSBindings/Mac/Clock SignalTests/8088Tests.mm b/OSBindings/Mac/Clock SignalTests/8088Tests.mm index 629e99a1e..b4086eff4 100644 --- a/OSBindings/Mac/Clock SignalTests/8088Tests.mm +++ b/OSBindings/Mac/Clock SignalTests/8088Tests.mm @@ -404,7 +404,7 @@ struct FailedExecution { // TODO: MOVS, SCAS, STOS */ // CMPS -// @"A6.json.gz", @"A7.json.gz", + @"A6.json.gz", @"A7.json.gz", // LODS @"AC.json.gz", @"AD.json.gz",