1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 18:30:21 +00:00

Adds get_is_resetting to the Z80, eliminating the CPC's custom version.

This commit is contained in:
Thomas Harte 2020-02-29 19:58:25 -05:00
parent 3c103506c9
commit b971e2a42c
4 changed files with 13 additions and 3 deletions

View File

@ -1052,7 +1052,6 @@ template <bool has_fdc> class ConcreteMachine:
/// Wires virtual-dispatched CRTMachine run_for requests to the static Z80 method.
void run_for(const Cycles cycles) final {
has_run_ = true;
z80_.run_for(cycles);
}
@ -1088,7 +1087,7 @@ template <bool has_fdc> class ConcreteMachine:
}
HalfCycles get_typer_delay() final {
return has_run_ ? Cycles(0) : Cycles(3'400'000);
return z80_.get_is_resetting() ? Cycles(3'400'000) : Cycles(0);
}
HalfCycles get_typer_frequency() final {

View File

@ -705,7 +705,7 @@ void ProcessorBase::set_reset_line(bool active) {
}
bool ProcessorBase::get_is_resetting() {
return !!(interrupt_requests_ & (InterruptRequestFlags::Reset | InterruptRequestFlags::PowerOn));
return interrupt_requests_ & (InterruptRequestFlags::Reset | InterruptRequestFlags::PowerOn);
}
void ProcessorBase::set_power_on(bool active) {

View File

@ -550,3 +550,7 @@ bool ProcessorBase::is_starting_new_instruction() {
current_instruction_page_ == &base_page_ &&
scheduled_program_counter_ == &base_page_.fetch_decode_execute[0];
}
bool ProcessorBase::get_is_resetting() {
return request_status_ & (Interrupt::PowerOn | Interrupt::Reset);
}

View File

@ -219,6 +219,13 @@ class ProcessorBase: public ProcessorStorage {
*/
inline void set_reset_line(bool value);
/*!
Gets whether the Z80 would reset at the next opportunity.
@returns @c true if the line is logically active; @c false otherwise.
*/
bool get_is_resetting();
/*!
This emulation automatically sets itself up in power-on state at creation, which has the effect of triggering a
reset at the first opportunity. Use @c reset_power_on to disable that behaviour.