mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Fix repetition. Sufficient for tests.
This commit is contained in:
parent
387a952328
commit
efb854ddfa
@ -1401,18 +1401,22 @@ void cmps(const InstructionT &instruction, MemoryT &memory, RegistersT ®ister
|
||||
}
|
||||
|
||||
Source source_segment = instruction.segment_override();
|
||||
if(source_segment == Source::None) source_segment = Source::DS;
|
||||
if(source_segment == Source::None) {
|
||||
source_segment = Source::DS;
|
||||
} else {
|
||||
printf("");
|
||||
}
|
||||
|
||||
if constexpr (std::is_same_v<AddressT, uint16_t>) {
|
||||
IntT source = memory.template access<IntT>(source_segment, registers.si());
|
||||
IntT destination = memory.template access<IntT>(Source::ES, registers.di());
|
||||
Primitive::sub<false, false>(destination, source, status);
|
||||
IntT lhs = memory.template access<IntT>(source_segment, registers.si());
|
||||
IntT rhs = memory.template access<IntT>(Source::ES, registers.di());
|
||||
Primitive::sub<false, false>(lhs, rhs, status);
|
||||
registers.si() += status.direction<AddressT>();
|
||||
registers.di() += status.direction<AddressT>();
|
||||
} else {
|
||||
IntT source = memory.template access<IntT>(source_segment, registers.esi());
|
||||
IntT destination = memory.template access<IntT>(Source::ES, registers.edi());
|
||||
Primitive::sub<false, false>(destination, source, status);
|
||||
IntT lhs = memory.template access<IntT>(source_segment, registers.esi());
|
||||
IntT rhs = memory.template access<IntT>(Source::ES, registers.edi());
|
||||
Primitive::sub<false, false>(lhs, rhs, status);
|
||||
registers.esi() += status.direction<AddressT>();
|
||||
registers.edi() += status.direction<AddressT>();
|
||||
}
|
||||
|
@ -230,14 +230,21 @@ class FlowController {
|
||||
void halt() {}
|
||||
void wait() {}
|
||||
|
||||
void begin_instruction() {
|
||||
should_repeat_ = false;
|
||||
}
|
||||
void repeat_last() {
|
||||
// TODO.
|
||||
should_repeat_ = true;
|
||||
}
|
||||
bool should_repeat() const {
|
||||
return should_repeat_;
|
||||
}
|
||||
|
||||
private:
|
||||
Memory &memory_;
|
||||
Registers ®isters_;
|
||||
Status &status_;
|
||||
bool should_repeat_ = false;
|
||||
|
||||
void push(uint16_t value, bool is_flags = false) {
|
||||
// Perform the push in two steps because it's possible for SP to underflow, and so that FlagsL and
|
||||
@ -708,14 +715,17 @@ struct FailedExecution {
|
||||
|
||||
// Execute instruction.
|
||||
execution_support.registers.ip_ += decoded.first;
|
||||
InstructionSet::x86::perform<InstructionSet::x86::Model::i8086>(
|
||||
decoded.second,
|
||||
execution_support.status,
|
||||
execution_support.flow_controller,
|
||||
execution_support.registers,
|
||||
execution_support.memory,
|
||||
execution_support.io
|
||||
);
|
||||
do {
|
||||
execution_support.flow_controller.begin_instruction();
|
||||
InstructionSet::x86::perform<InstructionSet::x86::Model::i8086>(
|
||||
decoded.second,
|
||||
execution_support.status,
|
||||
execution_support.flow_controller,
|
||||
execution_support.registers,
|
||||
execution_support.memory,
|
||||
execution_support.io
|
||||
);
|
||||
} while (execution_support.flow_controller.should_repeat());
|
||||
|
||||
// Compare final state.
|
||||
Registers intended_registers;
|
||||
|
Loading…
Reference in New Issue
Block a user