1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Gives the two sets of switches responsibility for supplying 'state'.

(And fixes language-card state value.)
This commit is contained in:
Thomas Harte 2020-11-09 22:11:20 -05:00
parent 54352cb1cb
commit dc8d4d49f5
3 changed files with 16 additions and 11 deletions

View File

@ -176,6 +176,15 @@ template <typename Machine> class AuxiliaryMemorySwitches {
set_card_paging(); set_card_paging();
} }
uint8_t get_state() const {
return
(switches_.alternative_zero_page ? 0x80 : 0x00) |
(switches_.video_page_2 ? 0x40 : 0x00) |
(switches_.read_auxiliary_memory ? 0x20 : 0x00) |
(switches_.write_auxiliary_memory ? 0x10 : 0x00) |
(switches_.internal_CX_rom ? 0x01 : 0x00);
}
const MainState &main_state() const { const MainState &main_state() const {
return main_state_; return main_state_;
} }

View File

@ -93,6 +93,12 @@ template <typename Machine> class LanguageCardSwitches {
} }
} }
uint8_t get_state() const {
return
(state_.read ? 0x00 : 0x08) |
(state_.bank1 ? 0x04 : 0x00);
}
private: private:
Machine &machine_; Machine &machine_;
State state_; State state_;

View File

@ -213,17 +213,7 @@ class MemoryMap {
} }
uint8_t get_state_register() const { uint8_t get_state_register() const {
const auto auxiliary_switches = auxiliary_switches_.switches(); return language_card_.get_state() | auxiliary_switches_.get_state();
const auto language_state = language_card_.state();
return
(auxiliary_switches.alternative_zero_page ? 0x80 : 0x00) |
(auxiliary_switches.video_page_2 ? 0x40 : 0x00) |
(auxiliary_switches.read_auxiliary_memory ? 0x20 : 0x00) |
(auxiliary_switches.write_auxiliary_memory ? 0x10 : 0x00) |
(language_state.read ? 0x08 : 0x00) |
(language_state.bank1 ? 0x04 : 0x00) |
(auxiliary_switches.internal_CX_rom ? 0x01 : 0x00);
} }
void access(uint16_t address, bool is_read) { void access(uint16_t address, bool is_read) {