1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-04 18:29:40 +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;
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;

View File

@ -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:

View File

@ -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()

View File

@ -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<NSString *> *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil];
files = [files filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSString* evaluatedObject, NSDictionary<NSString *,id> *) {
@ -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 += " ";