diff --git a/InstructionSets/x86/Decoder.cpp b/InstructionSets/x86/Decoder.cpp index 622b81bf4..2487223cc 100644 --- a/InstructionSets/x86/Decoder.cpp +++ b/InstructionSets/x86/Decoder.cpp @@ -833,7 +833,17 @@ std::pair::InstructionT> Decoder::decode(con destination_ = memreg; switch(reg) { - default: undefined(); + default: + if constexpr (model == Model::i8086) { + if(source_ == Source::eCX) { + SetOperation(Operation::SETMOC); + } else { + SetOperation(Operation::SETMO); + } + } else { + undefined(); + } + break; case 0: SetOperation(Operation::ROL); break; case 1: SetOperation(Operation::ROR); break; diff --git a/InstructionSets/x86/Instruction.cpp b/InstructionSets/x86/Instruction.cpp index 0c50b996e..bacbbd9d7 100644 --- a/InstructionSets/x86/Instruction.cpp +++ b/InstructionSets/x86/Instruction.cpp @@ -138,6 +138,9 @@ std::string InstructionSet::x86::to_string(Operation operation, DataSize size) { case Operation::XLAT: return "xlat"; case Operation::SALC: return "salc"; + case Operation::SETMO: return "setmo"; + case Operation::SETMOC: return "setmoc"; + case Operation::Invalid: return "invalid"; default: diff --git a/InstructionSets/x86/Instruction.hpp b/InstructionSets/x86/Instruction.hpp index 714ce6aae..44b9316fb 100644 --- a/InstructionSets/x86/Instruction.hpp +++ b/InstructionSets/x86/Instruction.hpp @@ -214,6 +214,15 @@ enum class Operation: uint8_t { /// Set AL to FFh if carry is set; 00h otherwise. SALC, + // + // 8086 exclusives. + // + + /// Set destination to ~0 if CL is non-zero. + SETMOC, + /// Set destination to ~0. + SETMO, + // // 80186 additions. // @@ -222,7 +231,7 @@ enum class Operation: uint8_t { /// stored at the location indicated by the source register, which will point to two /// 16- or 32-bit words, the first being a signed lower bound and the signed upper. /// Raises a bounds exception if not. - BOUND = SALC, + BOUND = SETMOC, /// Create stack frame. See operand() for the nesting level and offset() diff --git a/OSBindings/Mac/Clock SignalTests/8088Tests.mm b/OSBindings/Mac/Clock SignalTests/8088Tests.mm index d52e20aca..fe45246bc 100644 --- a/OSBindings/Mac/Clock SignalTests/8088Tests.mm +++ b/OSBindings/Mac/Clock SignalTests/8088Tests.mm @@ -148,15 +148,7 @@ std::string to_string( NSSet *allowList = [NSSet setWithArray:@[ ]]; - // Unofficial opcodes; ignored for now. - NSSet *ignoreList = - [NSSet setWithObjects: - - // Undocumented instructions. - @"D0.6.json.gz", @"D1.6.json.gz", @"D2.6.json.gz", @"D3.6.json.gz", - - nil - ]; + NSSet *ignoreList = nil; NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; files = [files filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSString* evaluatedObject, NSDictionary *) { @@ -210,9 +202,9 @@ std::string to_string( operation += " "; if(operands > 1 && instruction.destination().source() != Source::None) { operation += to_string(instruction.destination(), instruction, offsetLength, immediateLength); - operation += ", "; } if(operands > 0 && instruction.source().source() != Source::None) { + if(operands > 1) operation += ", "; operation += to_string(instruction.source(), instruction, offsetLength, immediateLength); } if(displacement) { @@ -279,6 +271,7 @@ std::string to_string( case Operation::ROL: case Operation::ROR: case Operation::SAL: case Operation::SAR: case Operation::SHR: + case Operation::SETMO: case Operation::SETMOC: const int operands = max_num_operands(instruction.operation); const bool displacement = has_displacement(instruction.operation); operation += " ";