1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 01:32:55 +00:00

Merge pull request #1346 from TomHarte/AppleIIReset

Propagate reset to the auxiliary switches.
This commit is contained in:
Thomas Harte 2024-02-28 22:02:08 -05:00 committed by GitHub
commit 3ce05e9de1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 4 deletions

View File

@ -362,7 +362,7 @@ template <Analyser::Static::AppleII::Target::Model model, bool has_mockingboard>
// MARK: - Keyboard and typing.
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 {
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
// reset, in the hope that the user can find
// 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;
default:
@ -556,7 +559,8 @@ template <Analyser::Static::AppleII::Target::Model model, bool has_mockingboard>
std::unique_ptr<Utility::StringSerialiser> string_serialiser_;
// 6502 connection, for applying the reset button.
Processor *const m6502_;
Processor &m6502_;
AuxiliaryMemorySwitches<ConcreteMachine> &auxiliary_switches_;
};
Keyboard keyboard_;
@ -574,7 +578,7 @@ template <Analyser::Static::AppleII::Target::Model model, bool has_mockingboard>
speaker_(lowpass_source()),
language_card_(*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
// equal to the number of cycles of work the 6502 will actually achieve. Which is less than

View File

@ -90,6 +90,10 @@ template <typename Machine> class AuxiliaryMemorySwitches {
bool alternative_zero_page = false;
bool video_page_2 = false;
bool high_resolution = false;
void reset() {
*this = SwitchState();
}
};
AuxiliaryMemorySwitches(Machine &machine) : machine_(machine) {}
@ -208,6 +212,14 @@ template <typename Machine> class AuxiliaryMemorySwitches {
return switches_;
}
void reset() {
switches_.reset();
set_main_paging();
set_zero_page_paging();
set_card_paging();
}
private:
Machine &machine_;
SwitchState switches_;