diff --git a/Machines/Apple/AppleII/AuxiliaryMemorySwitches.hpp b/Machines/Apple/AppleII/AuxiliaryMemorySwitches.hpp index 5653905ec..74514ccce 100644 --- a/Machines/Apple/AppleII/AuxiliaryMemorySwitches.hpp +++ b/Machines/Apple/AppleII/AuxiliaryMemorySwitches.hpp @@ -176,6 +176,15 @@ template class AuxiliaryMemorySwitches { 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 { return main_state_; } diff --git a/Machines/Apple/AppleII/LanguageCardSwitches.hpp b/Machines/Apple/AppleII/LanguageCardSwitches.hpp index 63ddefaac..7b638e976 100644 --- a/Machines/Apple/AppleII/LanguageCardSwitches.hpp +++ b/Machines/Apple/AppleII/LanguageCardSwitches.hpp @@ -93,6 +93,12 @@ template class LanguageCardSwitches { } } + uint8_t get_state() const { + return + (state_.read ? 0x00 : 0x08) | + (state_.bank1 ? 0x04 : 0x00); + } + private: Machine &machine_; State state_; diff --git a/Machines/Apple/AppleIIgs/MemoryMap.hpp b/Machines/Apple/AppleIIgs/MemoryMap.hpp index b06d47feb..676f25983 100644 --- a/Machines/Apple/AppleIIgs/MemoryMap.hpp +++ b/Machines/Apple/AppleIIgs/MemoryMap.hpp @@ -213,17 +213,7 @@ class MemoryMap { } uint8_t get_state_register() const { - const auto auxiliary_switches = auxiliary_switches_.switches(); - 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); + return language_card_.get_state() | auxiliary_switches_.get_state(); } void access(uint16_t address, bool is_read) {