1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Add SETMO and SETMOC.

This commit is contained in:
Thomas Harte 2023-09-29 22:28:23 -04:00
parent ff9237be9f
commit 92c46faf84
4 changed files with 27 additions and 12 deletions

View File

@ -833,7 +833,17 @@ std::pair<int, typename Decoder<model>::InstructionT> Decoder<model>::decode(con
destination_ = memreg; destination_ = memreg;
switch(reg) { 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 0: SetOperation(Operation::ROL); break;
case 1: SetOperation(Operation::ROR); break; case 1: SetOperation(Operation::ROR); break;

View File

@ -138,6 +138,9 @@ std::string InstructionSet::x86::to_string(Operation operation, DataSize size) {
case Operation::XLAT: return "xlat"; case Operation::XLAT: return "xlat";
case Operation::SALC: return "salc"; case Operation::SALC: return "salc";
case Operation::SETMO: return "setmo";
case Operation::SETMOC: return "setmoc";
case Operation::Invalid: return "invalid"; case Operation::Invalid: return "invalid";
default: default:

View File

@ -214,6 +214,15 @@ enum class Operation: uint8_t {
/// Set AL to FFh if carry is set; 00h otherwise. /// Set AL to FFh if carry is set; 00h otherwise.
SALC, SALC,
//
// 8086 exclusives.
//
/// Set destination to ~0 if CL is non-zero.
SETMOC,
/// Set destination to ~0.
SETMO,
// //
// 80186 additions. // 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 /// 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. /// 16- or 32-bit words, the first being a signed lower bound and the signed upper.
/// Raises a bounds exception if not. /// Raises a bounds exception if not.
BOUND = SALC, BOUND = SETMOC,
/// Create stack frame. See operand() for the nesting level and offset() /// Create stack frame. See operand() for the nesting level and offset()

View File

@ -148,15 +148,7 @@ std::string to_string(
NSSet *allowList = [NSSet setWithArray:@[ NSSet *allowList = [NSSet setWithArray:@[
]]; ]];
// Unofficial opcodes; ignored for now. NSSet *ignoreList = nil;
NSSet *ignoreList =
[NSSet setWithObjects:
// Undocumented instructions.
@"D0.6.json.gz", @"D1.6.json.gz", @"D2.6.json.gz", @"D3.6.json.gz",
nil
];
NSArray<NSString *> *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; NSArray<NSString *> *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil];
files = [files filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSString* evaluatedObject, NSDictionary<NSString *,id> *) { files = [files filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSString* evaluatedObject, NSDictionary<NSString *,id> *) {
@ -210,9 +202,9 @@ std::string to_string(
operation += " "; operation += " ";
if(operands > 1 && instruction.destination().source() != Source::None) { if(operands > 1 && instruction.destination().source() != Source::None) {
operation += to_string(instruction.destination(), instruction, offsetLength, immediateLength); operation += to_string(instruction.destination(), instruction, offsetLength, immediateLength);
operation += ", ";
} }
if(operands > 0 && instruction.source().source() != Source::None) { if(operands > 0 && instruction.source().source() != Source::None) {
if(operands > 1) operation += ", ";
operation += to_string(instruction.source(), instruction, offsetLength, immediateLength); operation += to_string(instruction.source(), instruction, offsetLength, immediateLength);
} }
if(displacement) { if(displacement) {
@ -279,6 +271,7 @@ std::string to_string(
case Operation::ROL: case Operation::ROR: case Operation::ROL: case Operation::ROR:
case Operation::SAL: case Operation::SAR: case Operation::SAL: case Operation::SAR:
case Operation::SHR: case Operation::SHR:
case Operation::SETMO: case Operation::SETMOC:
const int operands = max_num_operands(instruction.operation); const int operands = max_num_operands(instruction.operation);
const bool displacement = has_displacement(instruction.operation); const bool displacement = has_displacement(instruction.operation);
operation += " "; operation += " ";