diff --git a/Machines/Apple/AppleIIgs/AppleIIgs.cpp b/Machines/Apple/AppleIIgs/AppleIIgs.cpp index 58b3f9220..ce3e2236a 100644 --- a/Machines/Apple/AppleIIgs/AppleIIgs.cpp +++ b/Machines/Apple/AppleIIgs/AppleIIgs.cpp @@ -954,7 +954,7 @@ class ConcreteMachine: // get by adding periodic NOPs within their copy-to-shadow step. // // Maybe the interaction with 2.8Mhz refresh isn't as straightforward as I think? - const bool is_shadowed = memory_.is_shadowed(address); + const bool is_shadowed = memory_.is_shadowed(region, address); is_1Mhz |= is_shadowed; // Use a very broad test for flushing video: any write to $e0 or $e1, or any write that is shadowed. diff --git a/Machines/Apple/AppleIIgs/MemoryMap.hpp b/Machines/Apple/AppleIIgs/MemoryMap.hpp index 40998fcd7..3e38e38f1 100644 --- a/Machines/Apple/AppleIIgs/MemoryMap.hpp +++ b/Machines/Apple/AppleIIgs/MemoryMap.hpp @@ -633,18 +633,15 @@ class MemoryMap { // adjust as required. // The below encapsulates an assumption that Apple intends to shadow physical addresses (i.e. after mapping). - // If the Apple shadows logical addresses (i.e. prior to mapping) then see commented out alternatives. + // I couldn't really find clear documentation on this. const Region ®ion(uint32_t address) { return regions[region_map[address >> 8]]; } uint8_t read(const Region ®ion, uint32_t address) { return region.read ? region.read[address] : 0xff; } - bool is_shadowed(uint32_t address) const { - // Logical mapping alternative: - // shadow_pages[((®ion.write[address] - ram_base) >> 10) & 127] & shadow_banks[address >> 17] - - return shadow_pages[(address >> 10) & 127] & shadow_banks[address >> 17]; + bool is_shadowed(const Region ®ion, uint32_t address) const { + return shadow_pages[((®ion.write[address] - ram_base) >> 10) & 127] & shadow_banks[address >> 17]; // Quick notes on contortions above: // @@ -666,11 +663,8 @@ class MemoryMap { } region.write[address] = value; - const bool shadowed = is_shadowed(address); + const bool shadowed = is_shadowed(region, address); shadow_base[shadowed][(®ion.write[address] - ram_base) & shadow_mask[shadowed]] = value; - - // Logical mapping alternative: - // shadow_base[shadowed][address & shadow_mask[shadowed]] } }; diff --git a/OSBindings/Mac/Clock SignalTests/IIgsMemoryMapTests.mm b/OSBindings/Mac/Clock SignalTests/IIgsMemoryMapTests.mm index 64e098783..e2b5c0cc4 100644 --- a/OSBindings/Mac/Clock SignalTests/IIgsMemoryMapTests.mm +++ b/OSBindings/Mac/Clock SignalTests/IIgsMemoryMapTests.mm @@ -369,7 +369,7 @@ namespace { while(logical < [next intValue]) { [[maybe_unused]] const auto ®ion = self->_memoryMap.regions[self->_memoryMap.region_map[logical]]; - const bool isShadowed = _memoryMap.is_shadowed(logical << 8); + const bool isShadowed = _memoryMap.is_shadowed(region, logical << 8); XCTAssertEqual( isShadowed,