1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-05 10:28:58 +00:00

Expose more information about the E clock state.

This commit is contained in:
Thomas Harte 2021-07-23 19:22:00 -04:00
parent de208ead4e
commit 68fe19818e
2 changed files with 11 additions and 2 deletions

View File

@ -451,6 +451,13 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform = false> cla
halt_ = halt;
}
/// @returns The current phase of the E clock; this will be a number of
/// half-cycles between 0 and 19 inclusive, indicating how far the 68000
/// is into the current E cycle.
HalfCycles get_e_clock_phase() {
return e_clock_phase_;
}
private:
T &bus_handler_;
};

View File

@ -139,7 +139,9 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
// Extend length by: (i) distance to next E low, plus (ii) difference between
// current length and a whole E cycle.
cycle_copy.length = HalfCycles(20); // i.e. one E cycle in length.
cycle_copy.length += (e_clock_phase_ + cycles_run_for) % 10;
cycle_copy.length += (e_clock_phase_ + cycles_run_for) % 20;
// TODO: verify logic above; I'm not persuaded.
cycles_run_for +=
cycle_copy.length +
@ -2191,7 +2193,7 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
#undef destination_address
bus_handler_.flush();
e_clock_phase_ = (e_clock_phase_ + cycles_run_for) % 10;
e_clock_phase_ = (e_clock_phase_ + cycles_run_for) % 20;
half_cycles_left_to_run_ = remaining_duration - cycles_run_for;
}