mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-16 18:30:32 +00:00
Implement SALC, SETMO, SETMOC.
This commit is contained in:
parent
97d3a9fa78
commit
d35377c776
@ -890,6 +890,24 @@ inline void std(Status &status) { status.set_from<Flag::Direction>(1); }
|
||||
inline void sti(Status &status) { status.set_from<Flag::Interrupt>(1); }
|
||||
inline void cmc(Status &status) { status.set_from<Flag::Carry>(!status.flag<Flag::Carry>()); }
|
||||
|
||||
inline void salc(uint8_t &al, const Status &status) {
|
||||
al = status.flag<Flag::Carry>() ? 0xff : 0x00;
|
||||
}
|
||||
|
||||
template <typename IntT>
|
||||
void setmo(IntT &destination, Status &status) {
|
||||
destination = ~0;
|
||||
status.set_from<Flag::Carry, Flag::AuxiliaryCarry, Flag::Overflow>(0);
|
||||
status.set_from<IntT, Flag::Sign, Flag::Zero, Flag::ParityOdd>(destination);
|
||||
}
|
||||
|
||||
template <typename IntT>
|
||||
void setmoc(IntT &destination, uint8_t cl, Status &status) {
|
||||
if(cl) {
|
||||
setmo(destination, status);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <
|
||||
@ -1051,6 +1069,22 @@ template <
|
||||
case Operation::CMC: Primitive::cmc(status); return;
|
||||
|
||||
case Operation::XCHG: Primitive::xchg(destination(), source()); return;
|
||||
|
||||
case Operation::SALC: Primitive::salc(registers.al(), status); return;
|
||||
case Operation::SETMO:
|
||||
if constexpr (model == Model::i8086) {
|
||||
Primitive::setmo(destination(), status);
|
||||
} else {
|
||||
// TODO.
|
||||
}
|
||||
return;
|
||||
case Operation::SETMOC:
|
||||
if constexpr (model == Model::i8086) {
|
||||
Primitive::setmoc(destination(), registers.cl(), status);
|
||||
} else {
|
||||
// TODO.
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Write to memory if required to complete this operation.
|
||||
|
@ -82,7 +82,7 @@ class Status {
|
||||
using FlagT = uint32_t;
|
||||
|
||||
// Flag getters.
|
||||
template <Flag flag> bool flag() {
|
||||
template <Flag flag> bool flag() const {
|
||||
switch(flag) {
|
||||
case Flag::Carry: return carry;
|
||||
case Flag::AuxiliaryCarry: return auxiliary_carry;
|
||||
@ -97,7 +97,7 @@ class Status {
|
||||
}
|
||||
|
||||
// Condition evaluation.
|
||||
template <Condition test> bool condition() {
|
||||
template <Condition test> bool condition() const {
|
||||
switch(test) {
|
||||
case Condition::Overflow: return flag<Flag::Overflow>();
|
||||
case Condition::Below: return flag<Flag::Carry>();
|
||||
|
@ -377,13 +377,14 @@ struct FailedExecution {
|
||||
|
||||
@"C5.json.gz", // LDS
|
||||
@"C4.json.gz", // LES
|
||||
*/
|
||||
@"8D.json.gz", // LEA
|
||||
*/
|
||||
|
||||
// TODO: CMPS, LODS, MOVS, SCAS, STOS
|
||||
|
||||
// TODO: LOOP, LOOPE, LOOPNE
|
||||
|
||||
/*
|
||||
// MOV
|
||||
@"88.json.gz", @"89.json.gz", @"8A.json.gz", @"8B.json.gz",
|
||||
@"8C.json.gz", @"8E.json.gz",
|
||||
@ -394,7 +395,6 @@ struct FailedExecution {
|
||||
@"BC.json.gz", @"BD.json.gz", @"BE.json.gz", @"BF.json.gz",
|
||||
@"C6.json.gz", @"C7.json.gz",
|
||||
|
||||
/*
|
||||
// AND
|
||||
@"20.json.gz", @"21.json.gz", @"22.json.gz", @"23.json.gz", @"24.json.gz", @"25.json.gz",
|
||||
@"80.4.json.gz", @"81.4.json.gz", @"83.4.json.gz",
|
||||
@ -443,8 +443,14 @@ struct FailedExecution {
|
||||
@"95.json.gz", @"96.json.gz", @"97.json.gz",
|
||||
|
||||
// TODO: XLAT
|
||||
// TODO: SALC, SETMO, SETMOC
|
||||
*/
|
||||
@"D6.json.gz", // SALC
|
||||
|
||||
// SETMO
|
||||
@"D0.6.json.gz", @"D1.6.json.gz",
|
||||
// SETMOC
|
||||
@"D2.6.json.gz", @"D3.6.json.gz",
|
||||
|
||||
]];
|
||||
|
||||
NSSet *ignoreList = nil;
|
||||
|
Loading…
x
Reference in New Issue
Block a user