mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-28 07:29:45 +00:00
Merge branch 'master' into ARM2Ops
This commit is contained in:
commit
0de8240238
@ -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
|
||||
|
@ -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_;
|
||||
|
@ -310,7 +310,14 @@ template <typename TimeUnit> class VideoSwitches {
|
||||
bool annunciator_3 = false;
|
||||
} external_, internal_;
|
||||
|
||||
int flash_length = 8406;
|
||||
// 8406 lines covers a complete on-off cycle, i.e. because the Apple II has a line
|
||||
// rate of around 15734.26 lines/second, flashing has a frequency of roughly
|
||||
// 15734.26 / 8406, or roughly 1.83Hz.
|
||||
//
|
||||
// Internally that's modelled by a counter that goes to **twice** the value of the
|
||||
// constant specified below. Hence the divide by two.
|
||||
static constexpr int flash_length = 8406 / 2;
|
||||
|
||||
int flash_ = 0;
|
||||
uint8_t flash_mask() const {
|
||||
return uint8_t((flash_ / flash_length) * 0xff);
|
||||
|
Loading…
Reference in New Issue
Block a user