mirror of
https://github.com/TomHarte/CLK.git
synced 2025-04-09 00:37:27 +00:00
Tidy up slightly, without fixing failure.
This commit is contained in:
parent
6c9fc0ac75
commit
22c0b588c4
@ -258,7 +258,7 @@ namespace {
|
||||
|
||||
// Test results.
|
||||
auto testMemory =
|
||||
^(NSString *type, void (^ applyTest)(int logical, int physical)) {
|
||||
^(NSString *type, void (^ applyTest)(int logical, int physical, const MemoryMap::Region ®ion)) {
|
||||
for(NSArray<NSNumber *> *region in test[type]) {
|
||||
const auto logicalStart = [region[0] intValue];
|
||||
const auto logicalEnd = [region[1] intValue];
|
||||
@ -271,8 +271,19 @@ namespace {
|
||||
|
||||
int physical = physicalStart;
|
||||
for(int logical = logicalStart; logical < logicalEnd; logical++) {
|
||||
applyTest(logical, physical);
|
||||
if(*stop) return;
|
||||
const auto ®ion = self->_memoryMap.regions[self->_memoryMap.region_map[logical]];
|
||||
|
||||
// Don't worry about IO pages here; they'll be compared shortly.
|
||||
if(!(region.flags & MemoryMap::Region::IsIO)) {
|
||||
const auto ®ion = self->_memoryMap.regions[self->_memoryMap.region_map[logical]];
|
||||
applyTest(logical, physical, region);
|
||||
|
||||
if(*stop) {
|
||||
NSLog(@"Stopping after first failure");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(physical != physicalEnd) ++physical;
|
||||
}
|
||||
}
|
||||
@ -305,15 +316,8 @@ namespace {
|
||||
};
|
||||
|
||||
// Test read pointers.
|
||||
testMemory(@"read", ^(int logical, int physical) {
|
||||
const auto ®ion = self->_memoryMap.regions[self->_memoryMap.region_map[logical]];
|
||||
testMemory(@"read", ^(int logical, int physical, const MemoryMap::Region ®ion) {
|
||||
XCTAssert(region.read != nullptr);
|
||||
|
||||
// Don't worry about IO pages here; they'll be compared shortly.
|
||||
if(region.flags & MemoryMap::Region::IsIO) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int foundPhysical = physicalOffset(®ion.read[logical << 8]);
|
||||
|
||||
// Compare to correct value.
|
||||
@ -324,20 +328,12 @@ namespace {
|
||||
foundPhysical);
|
||||
|
||||
if(physical != foundPhysical) {
|
||||
NSLog(@"Stopping after first failure");
|
||||
*stop = YES;
|
||||
}
|
||||
});
|
||||
|
||||
// Test write pointers.
|
||||
testMemory(@"write", ^(int logical, int physical) {
|
||||
const auto ®ion = self->_memoryMap.regions[self->_memoryMap.region_map[logical]];
|
||||
|
||||
// Don't worry about IO pages here.
|
||||
if(region.flags & MemoryMap::Region::IsIO) {
|
||||
return;
|
||||
}
|
||||
|
||||
testMemory(@"write", ^(int logical, int physical, const MemoryMap::Region ®ion) {
|
||||
// This emulator guards writes to ROM by setting those pointers to nullptr;
|
||||
// so allow a nullptr write target if ROM is mapped here.
|
||||
if(region.write == nullptr && physical >= 0xfc00) {
|
||||
@ -355,7 +351,6 @@ namespace {
|
||||
foundPhysical);
|
||||
|
||||
if(physical != foundPhysical) {
|
||||
NSLog(@"Stopping after first failure");
|
||||
*stop = YES;
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user