mirror of
https://github.com/TomHarte/CLK.git
synced 2025-03-20 03:29:47 +00:00
Implement CMP.
This commit is contained in:
parent
d0a9b5cb81
commit
08867f4970
InstructionSets/x86/Implementation
OSBindings/Mac/Clock SignalTests
@ -455,7 +455,7 @@ void sbb(IntT &destination, IntT source, Status &status) {
|
||||
destination = result;
|
||||
}
|
||||
|
||||
template <typename IntT>
|
||||
template <bool write_back, typename IntT>
|
||||
void sub(IntT &destination, IntT source, Status &status) {
|
||||
/*
|
||||
DEST ← DEST - SRC;
|
||||
@ -471,7 +471,9 @@ void sub(IntT &destination, IntT source, Status &status) {
|
||||
status.zero = status.parity = result;
|
||||
status.overflow = overflow<false, IntT>(destination, source, result);
|
||||
|
||||
destination = result;
|
||||
if constexpr (write_back) {
|
||||
destination = result;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename IntT>
|
||||
@ -931,10 +933,13 @@ template <
|
||||
case Operation::HLT: flow_controller.halt(); return;
|
||||
case Operation::WAIT: flow_controller.wait(); return;
|
||||
|
||||
case Operation::ADC: Primitive::adc(destination(), source(), status); break;
|
||||
case Operation::ADD: Primitive::add(destination(), source(), status); break;
|
||||
case Operation::SBB: Primitive::sbb(destination(), source(), status); break;
|
||||
case Operation::SUB: Primitive::sub(destination(), source(), status); break;
|
||||
case Operation::ADC: Primitive::adc(destination(), source(), status); break;
|
||||
case Operation::ADD: Primitive::add(destination(), source(), status); break;
|
||||
case Operation::SBB: Primitive::sbb(destination(), source(), status); break;
|
||||
case Operation::SUB: Primitive::sub<true>(destination(), source(), status); break;
|
||||
case Operation::CMP: Primitive::sub<false>(destination(), source(), status); break;
|
||||
|
||||
// TODO: all the below could call a common registers getter?
|
||||
case Operation::MUL:
|
||||
if constexpr (data_size == DataSize::Byte) {
|
||||
Primitive::mul(registers.ah(), registers.al(), source(), status);
|
||||
|
@ -390,11 +390,11 @@ struct FailedExecution {
|
||||
@"80.6.json.gz", @"81.6.json.gz", @"83.6.json.gz",
|
||||
*/
|
||||
|
||||
// NEG
|
||||
@"F6.3.json.gz", @"F7.3.json.gz",
|
||||
|
||||
// NOT
|
||||
@"F6.2.json.gz", @"F7.2.json.gz",
|
||||
// // NEG
|
||||
// @"F6.3.json.gz", @"F7.3.json.gz",
|
||||
//
|
||||
// // NOT
|
||||
// @"F6.2.json.gz", @"F7.2.json.gz",
|
||||
|
||||
/*
|
||||
// NOP
|
||||
@ -412,6 +412,11 @@ struct FailedExecution {
|
||||
@"F5.json.gz", // CMC
|
||||
*/
|
||||
|
||||
// CMP
|
||||
@"38.json.gz", @"39.json.gz", @"3A.json.gz",
|
||||
@"3B.json.gz", @"3C.json.gz", @"3D.json.gz",
|
||||
@"80.7.json.gz", @"81.7.json.gz", @"83.7.json.gz",
|
||||
|
||||
// TODO: CMP, TEST
|
||||
// TODO: XCHG, XLAT
|
||||
// TODO: SALC, SETMO, SETMOC
|
||||
|
Loading…
x
Reference in New Issue
Block a user