diff --git a/Processors/68000Mk2/68000Mk2.hpp b/Processors/68000Mk2/68000Mk2.hpp index ec71ee100..f9f9c670b 100644 --- a/Processors/68000Mk2/68000Mk2.hpp +++ b/Processors/68000Mk2/68000Mk2.hpp @@ -121,6 +121,9 @@ struct Microcycle { */ SlicedInt16 *value = nullptr; + Microcycle(OperationT operation) : operation(operation) {} + Microcycle() {} + /// @returns @c true if two Microcycles are equal; @c false otherwise. bool operator ==(const Microcycle &rhs) const { if(value != rhs.value) return false; diff --git a/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp b/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp index cf1ad3c47..e514e0c6c 100644 --- a/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp +++ b/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp @@ -9,27 +9,29 @@ #ifndef _8000Mk2Implementation_h #define _8000Mk2Implementation_h +#include + namespace CPU { namespace MC68000Mk2 { template void Processor::run_for(HalfCycles duration) { // Accumulate the newly paid-in cycles. If this instance remains in deficit, exit. - time_remaining += duration; - if(time_remaining <= HalfCycles(0)) return; + time_remaining_ += duration; + if(time_remaining_ <= HalfCycles(0)) return; // Check whether all remaining time has been expended; if so then exit, having set this line up as // the next resumption point. -#define ConsiderExit() if(time_remaining <= HalfCycles(0)) { state = __LINE__; return; } [[fallthrough]]; case __LINE__: +#define ConsiderExit() if(time_remaining_ <= HalfCycles(0)) { state_ = __LINE__; return; } [[fallthrough]]; case __LINE__: - // Subtracts `n` half-cycles from `time_remaining`; if permit_overrun is false, also ConsiderExit() -#define Spend(n) cycles_owed -= HalfCycles(n); if constexpr (!permit_overrun) ConsiderExit() + // Subtracts `n` half-cycles from `time_remaining_`; if permit_overrun is false, also ConsiderExit() +#define Spend(n) time_remaining_ -= (n); if constexpr (!permit_overrun) ConsiderExit() // Performs ConsiderExit() only if permit_overrun is true #define CheckOverrun() if constexpr (permit_overrun) ConsiderExit() // - // So structure is, in general: + // So basic structure is, in general: // // case Action: // do_something(); @@ -40,7 +42,7 @@ void Processor decoder_; + InstructionSet::M68k::Preinstruction instruction_; + uint16_t opcode_; + + InstructionSet::M68k::Status status_; + SlicedInt32 program_counter_; + SlicedInt32 registers_[16]; // D0–D7 followed by A0–A7. + SlicedInt32 stack_pointers_[2]; + + bool dtack_ = false; + bool vpa_ = false; + bool berr_ = false; + + SlicedInt16 prefetch_[2]; }; }