1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-26 15:32:04 +00:00

Add LODS; somehow manage to fail some of its tests.

This commit is contained in:
Thomas Harte 2023-10-20 17:13:56 -04:00
parent bcebb2e520
commit bee094eba1
2 changed files with 23 additions and 1 deletions

View File

@ -1390,6 +1390,22 @@ void cmps(const InstructionT &instruction, AddressT &eCX, AddressT &eSI, Address
repeat<AddressT>(instruction, status, eCX, flow_controller);
}
template <typename IntT, typename AddressT, typename InstructionT, typename MemoryT, typename FlowControllerT>
void lods(const InstructionT &instruction, AddressT &eCX, AddressT &eSI, IntT &eAX, MemoryT &memory, Status &status, FlowControllerT &flow_controller) {
if(repetition_over<AddressT>(instruction, eCX)) {
return;
}
Source source_segment = instruction.segment_override();
if(source_segment == Source::None) source_segment = Source::DS;
eAX = memory.template access<IntT>(source_segment, eSI);
eSI += status.direction<AddressT>() * sizeof(IntT);
repeat<AddressT>(instruction, status, eCX, flow_controller);
}
}
template <
@ -1633,6 +1649,9 @@ template <
case Operation::CMPS:
Primitive::cmps<IntT, AddressT>(instruction, eCX(), eSI(), eDI(), memory, status, flow_controller);
break;
case Operation::LODS:
Primitive::lods<IntT, AddressT>(instruction, eCX(), eSI(), pair_low(), memory, status, flow_controller);
break;
}
// Write to memory if required to complete this operation.

View File

@ -401,10 +401,13 @@ struct FailedExecution {
@"C4.json.gz", // LES
@"8D.json.gz", // LEA
// TODO: LODS, MOVS, SCAS, STOS
// TODO: MOVS, SCAS, STOS
*/
// CMPS
@"A6.json.gz", @"A7.json.gz",
// LODS
@"AC.json.gz", @"AD.json.gz",
/*
@"E0.json.gz", // LOOPNE
@"E1.json.gz", // LOOPE