mirror of
https://github.com/TomHarte/CLK.git
synced 2025-03-25 06:30:38 +00:00
Implement XCHG.
This commit is contained in:
parent
5125907048
commit
a83b43a1ae
InstructionSets/x86/Implementation
OSBindings/Mac/Clock SignalTests
@ -502,6 +502,16 @@ void test(IntT &destination, IntT source, Status &status) {
|
||||
status.parity = result;
|
||||
}
|
||||
|
||||
template <typename IntT>
|
||||
void xchg(IntT &destination, IntT &source) {
|
||||
/*
|
||||
TEMP ← DEST
|
||||
DEST ← SRC
|
||||
SRC ← TEMP
|
||||
*/
|
||||
std::swap(destination, source);
|
||||
}
|
||||
|
||||
template <typename IntT>
|
||||
void mul(IntT &destination_high, IntT &destination_low, IntT source, Status &status) {
|
||||
/*
|
||||
@ -1029,112 +1039,112 @@ template <
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JNO:
|
||||
Primitive::jump(
|
||||
!status.condition<Status::Condition::Overflow>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JB:
|
||||
Primitive::jump(
|
||||
status.condition<Status::Condition::Below>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JNB:
|
||||
Primitive::jump(
|
||||
!status.condition<Status::Condition::Below>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JZ:
|
||||
Primitive::jump(
|
||||
status.condition<Status::Condition::Zero>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JNZ:
|
||||
Primitive::jump(
|
||||
!status.condition<Status::Condition::Zero>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JBE:
|
||||
Primitive::jump(
|
||||
status.condition<Status::Condition::BelowOrEqual>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JNBE:
|
||||
Primitive::jump(
|
||||
!status.condition<Status::Condition::BelowOrEqual>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JS:
|
||||
Primitive::jump(
|
||||
status.condition<Status::Condition::Sign>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JNS:
|
||||
Primitive::jump(
|
||||
!status.condition<Status::Condition::Sign>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JP:
|
||||
Primitive::jump(
|
||||
!status.condition<Status::Condition::ParityOdd>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JNP:
|
||||
Primitive::jump(
|
||||
status.condition<Status::Condition::ParityOdd>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JL:
|
||||
Primitive::jump(
|
||||
status.condition<Status::Condition::Less>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JNL:
|
||||
Primitive::jump(
|
||||
!status.condition<Status::Condition::Less>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JLE:
|
||||
Primitive::jump(
|
||||
status.condition<Status::Condition::LessOrEqual>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
case Operation::JNLE:
|
||||
Primitive::jump(
|
||||
!status.condition<Status::Condition::LessOrEqual>(),
|
||||
instruction.displacement(),
|
||||
registers,
|
||||
flow_controller);
|
||||
break;
|
||||
return;
|
||||
|
||||
case Operation::CLC: Primitive::clc(status); return;
|
||||
case Operation::CLD: Primitive::cld(status); return;
|
||||
@ -1143,6 +1153,8 @@ template <
|
||||
case Operation::STD: Primitive::std(status); return;
|
||||
case Operation::STI: Primitive::sti(status); return;
|
||||
case Operation::CMC: Primitive::cmc(status); return;
|
||||
|
||||
case Operation::XCHG: Primitive::xchg(destination(), source()); return;
|
||||
}
|
||||
|
||||
// Write to memory if required to complete this operation.
|
||||
|
@ -418,11 +418,16 @@ struct FailedExecution {
|
||||
// @"80.7.json.gz", @"81.7.json.gz", @"83.7.json.gz",
|
||||
|
||||
// TEST
|
||||
@"84.json.gz", @"85.json.gz",
|
||||
@"A8.json.gz", @"A9.json.gz",
|
||||
@"F6.0.json.gz", @"F7.0.json.gz",
|
||||
// @"84.json.gz", @"85.json.gz",
|
||||
// @"A8.json.gz", @"A9.json.gz",
|
||||
// @"F6.0.json.gz", @"F7.0.json.gz",
|
||||
|
||||
// TODO: XCHG, XLAT
|
||||
// XCHG
|
||||
@"86.json.gz", @"87.json.gz",
|
||||
@"91.json.gz", @"92.json.gz", @"93.json.gz", @"94.json.gz",
|
||||
@"95.json.gz", @"96.json.gz", @"97.json.gz",
|
||||
|
||||
// TODO: XLAT
|
||||
// TODO: SALC, SETMO, SETMOC
|
||||
|
||||
]];
|
||||
|
Loading…
x
Reference in New Issue
Block a user