// // Executor.cpp // Clock Signal // // Created by Thomas Harte on 29/04/2022. // Copyright © 2022 Thomas Harte. All rights reserved. // #include "Executor.hpp" #include "Perform.hpp" #include using namespace InstructionSet::M68k; template Executor::Executor(BusHandler &handler) : bus_handler_(handler) { reset(); } template void Executor::reset() { // TODO. } template void Executor::run_for_instructions(int count) { while(count--) { // TODO: check interrupt level, trace flag. // Read the next instruction. const Preinstruction instruction = decoder_.decode(bus_handler_.template read(program_counter_.l)); const auto instruction_address = program_counter_.l; program_counter_.l += 2; // Obtain the appropriate sequence. Sequence sequence(instruction.operation); // Temporary storage. CPU::SlicedInt32 source, dest; // Perform it. while(!sequence.empty()) { const auto step = sequence.pop_front(); switch(step) { default: assert(false); // i.e. TODO case Step::Perform: perform(instruction, source, dest, status_, this); break; } } } }