1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-29 16:55:59 +00:00

Avoid permitting writes in the Cx00 region after uninhibiting the language card.

This commit is contained in:
Thomas Harte 2022-06-28 16:35:47 -04:00
parent 22c0b588c4
commit 6abc317986
2 changed files with 11 additions and 2 deletions

View File

@ -379,6 +379,7 @@ class MemoryMap {
c0_region.flags |= Region::IsIO; c0_region.flags |= Region::IsIO;
#define apply_region(flag, region) \ #define apply_region(flag, region) \
region.write = nullptr; \
if(flag) { \ if(flag) { \
region.read = rom; \ region.read = rom; \
region.flags &= ~Region::IsIO; \ region.flags &= ~Region::IsIO; \

View File

@ -318,9 +318,13 @@ namespace {
// Test read pointers. // Test read pointers.
testMemory(@"read", ^(int logical, int physical, const MemoryMap::Region &region) { testMemory(@"read", ^(int logical, int physical, const MemoryMap::Region &region) {
XCTAssert(region.read != nullptr); XCTAssert(region.read != nullptr);
const int foundPhysical = physicalOffset(&region.read[logical << 8]); if(region.read == nullptr) {
*stop = YES;
return;
}
// Compare to correct value. // Compare to correct value.
const int foundPhysical = physicalOffset(&region.read[logical << 8]);
XCTAssert(physical == foundPhysical, XCTAssert(physical == foundPhysical,
@"Logical page %04x should be mapped to read physical %04x; is instead %04x", @"Logical page %04x should be mapped to read physical %04x; is instead %04x",
logical, logical,
@ -341,9 +345,13 @@ namespace {
} }
XCTAssert(region.write != nullptr); XCTAssert(region.write != nullptr);
const int foundPhysical = physicalOffset(&region.write[logical << 8]); if(region.write == nullptr) {
*stop = YES;
return;
}
// Compare to correct value. // Compare to correct value.
const int foundPhysical = physicalOffset(&region.write[logical << 8]);
XCTAssert(physical == foundPhysical, XCTAssert(physical == foundPhysical,
@"Logical page %04x should be mapped to write physical %04x; is instead %04x", @"Logical page %04x should be mapped to write physical %04x; is instead %04x",
logical, logical,