mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Be consistent in shadowing physical addresses.
This commit is contained in:
parent
ad31c50dfd
commit
cf00a709ec
@ -954,7 +954,7 @@ class ConcreteMachine:
|
|||||||
// get by adding periodic NOPs within their copy-to-shadow step.
|
// 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?
|
// 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;
|
is_1Mhz |= is_shadowed;
|
||||||
|
|
||||||
// Use a very broad test for flushing video: any write to $e0 or $e1, or any write that is shadowed.
|
// Use a very broad test for flushing video: any write to $e0 or $e1, or any write that is shadowed.
|
||||||
|
@ -633,18 +633,15 @@ class MemoryMap {
|
|||||||
// adjust as required.
|
// adjust as required.
|
||||||
|
|
||||||
// The below encapsulates an assumption that Apple intends to shadow physical addresses (i.e. after mapping).
|
// 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]]; }
|
const Region ®ion(uint32_t address) { return regions[region_map[address >> 8]]; }
|
||||||
uint8_t read(const Region ®ion, uint32_t address) {
|
uint8_t read(const Region ®ion, uint32_t address) {
|
||||||
return region.read ? region.read[address] : 0xff;
|
return region.read ? region.read[address] : 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_shadowed(uint32_t address) const {
|
bool is_shadowed(const Region ®ion, uint32_t address) const {
|
||||||
// Logical mapping alternative:
|
return shadow_pages[((®ion.write[address] - ram_base) >> 10) & 127] & shadow_banks[address >> 17];
|
||||||
// shadow_pages[((®ion.write[address] - ram_base) >> 10) & 127] & shadow_banks[address >> 17]
|
|
||||||
|
|
||||||
return shadow_pages[(address >> 10) & 127] & shadow_banks[address >> 17];
|
|
||||||
|
|
||||||
// Quick notes on contortions above:
|
// Quick notes on contortions above:
|
||||||
//
|
//
|
||||||
@ -666,11 +663,8 @@ class MemoryMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
region.write[address] = value;
|
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;
|
shadow_base[shadowed][(®ion.write[address] - ram_base) & shadow_mask[shadowed]] = value;
|
||||||
|
|
||||||
// Logical mapping alternative:
|
|
||||||
// shadow_base[shadowed][address & shadow_mask[shadowed]]
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ namespace {
|
|||||||
while(logical < [next intValue]) {
|
while(logical < [next intValue]) {
|
||||||
[[maybe_unused]] const auto ®ion =
|
[[maybe_unused]] const auto ®ion =
|
||||||
self->_memoryMap.regions[self->_memoryMap.region_map[logical]];
|
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(
|
XCTAssertEqual(
|
||||||
isShadowed,
|
isShadowed,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user