mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-25 16:31:42 +00:00
Propagate reset to the auxiliary switches.
This commit is contained in:
parent
cd21b39f44
commit
98f5d0cdb7
@ -362,7 +362,7 @@ template <Analyser::Static::AppleII::Target::Model model, bool has_mockingboard>
|
|||||||
// MARK: - Keyboard and typing.
|
// MARK: - Keyboard and typing.
|
||||||
|
|
||||||
struct Keyboard: public Inputs::Keyboard {
|
struct Keyboard: public Inputs::Keyboard {
|
||||||
Keyboard(Processor *m6502) : m6502_(m6502) {}
|
Keyboard(Processor &m6502, AuxiliaryMemorySwitches<ConcreteMachine> &switches) : m6502_(m6502), auxiliary_switches_(switches) {}
|
||||||
|
|
||||||
void reset_all_keys() final {
|
void reset_all_keys() final {
|
||||||
open_apple_is_pressed =
|
open_apple_is_pressed =
|
||||||
@ -454,7 +454,10 @@ template <Analyser::Static::AppleII::Target::Model model, bool has_mockingboard>
|
|||||||
// Accept a bunch non-symbolic other keys, as
|
// Accept a bunch non-symbolic other keys, as
|
||||||
// reset, in the hope that the user can find
|
// reset, in the hope that the user can find
|
||||||
// at least one usable key.
|
// at least one usable key.
|
||||||
m6502_->set_reset_line(is_pressed);
|
m6502_.set_reset_line(is_pressed);
|
||||||
|
if(!is_pressed) {
|
||||||
|
auxiliary_switches_.reset();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -556,7 +559,8 @@ template <Analyser::Static::AppleII::Target::Model model, bool has_mockingboard>
|
|||||||
std::unique_ptr<Utility::StringSerialiser> string_serialiser_;
|
std::unique_ptr<Utility::StringSerialiser> string_serialiser_;
|
||||||
|
|
||||||
// 6502 connection, for applying the reset button.
|
// 6502 connection, for applying the reset button.
|
||||||
Processor *const m6502_;
|
Processor &m6502_;
|
||||||
|
AuxiliaryMemorySwitches<ConcreteMachine> &auxiliary_switches_;
|
||||||
};
|
};
|
||||||
Keyboard keyboard_;
|
Keyboard keyboard_;
|
||||||
|
|
||||||
@ -574,7 +578,7 @@ template <Analyser::Static::AppleII::Target::Model model, bool has_mockingboard>
|
|||||||
speaker_(lowpass_source()),
|
speaker_(lowpass_source()),
|
||||||
language_card_(*this),
|
language_card_(*this),
|
||||||
auxiliary_switches_(*this),
|
auxiliary_switches_(*this),
|
||||||
keyboard_(&m6502_) {
|
keyboard_(m6502_, auxiliary_switches_) {
|
||||||
|
|
||||||
// This is where things get slightly convoluted: establish the machine as having a clock rate
|
// This is where things get slightly convoluted: establish the machine as having a clock rate
|
||||||
// equal to the number of cycles of work the 6502 will actually achieve. Which is less than
|
// equal to the number of cycles of work the 6502 will actually achieve. Which is less than
|
||||||
|
@ -90,6 +90,10 @@ template <typename Machine> class AuxiliaryMemorySwitches {
|
|||||||
bool alternative_zero_page = false;
|
bool alternative_zero_page = false;
|
||||||
bool video_page_2 = false;
|
bool video_page_2 = false;
|
||||||
bool high_resolution = false;
|
bool high_resolution = false;
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
*this = SwitchState();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AuxiliaryMemorySwitches(Machine &machine) : machine_(machine) {}
|
AuxiliaryMemorySwitches(Machine &machine) : machine_(machine) {}
|
||||||
@ -208,6 +212,14 @@ template <typename Machine> class AuxiliaryMemorySwitches {
|
|||||||
return switches_;
|
return switches_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
switches_.reset();
|
||||||
|
|
||||||
|
set_main_paging();
|
||||||
|
set_zero_page_paging();
|
||||||
|
set_card_paging();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Machine &machine_;
|
Machine &machine_;
|
||||||
SwitchState switches_;
|
SwitchState switches_;
|
||||||
|
Loading…
Reference in New Issue
Block a user