From de347ad7c8dd7be8551b5c9a637dfcb117251241 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 12 Mar 2017 14:03:17 -0400 Subject: [PATCH] Improved CBS RAM Plus and Super Chip detection exclusion, reducing error count to 15. --- .../AtariStaticAnalyserTests.mm | 5 +--- StaticAnalyser/Atari/StaticAnalyser.cpp | 24 ++++++++++--------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/AtariStaticAnalyserTests.mm b/OSBindings/Mac/Clock SignalTests/AtariStaticAnalyserTests.mm index d64217189..b9f0a6bc0 100644 --- a/OSBindings/Mac/Clock SignalTests/AtariStaticAnalyserTests.mm +++ b/OSBindings/Mac/Clock SignalTests/AtariStaticAnalyserTests.mm @@ -598,10 +598,7 @@ static NSDictionary *romRecordsBySHA1 = @{ // grab the ROM record AtariROMRecord *romRecord = [self romRecordForSHA1:sha1]; - if(!romRecord) - { - continue; - } + if(!romRecord) continue; // assert equality XCTAssert(targets.front().atari.paging_model == romRecord.pagingModel, @"%@; should be %d, is %d", testFile, romRecord.pagingModel, targets.front().atari.paging_model); diff --git a/StaticAnalyser/Atari/StaticAnalyser.cpp b/StaticAnalyser/Atari/StaticAnalyser.cpp index 73f93db42..1e6cb3ea2 100644 --- a/StaticAnalyser/Atari/StaticAnalyser.cpp +++ b/StaticAnalyser/Atari/StaticAnalyser.cpp @@ -148,6 +148,9 @@ static void DeterminePagingForCartridge(StaticAnalyser::Target &target, const St case 8192: DeterminePagingFor8kCartridge(target, segment, disassemblies); break; + case 12288: + target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::CBSRamPlus; + break; case 16384: target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::Atari16k; break; @@ -158,22 +161,21 @@ static void DeterminePagingForCartridge(StaticAnalyser::Target &target, const St break; } - // check for any sort of on-cartridge RAM; that might imply a Super Chip or else immediately tip the - // hat that this is a CBS RAM+ cartridge. Atari ROM images always have the same value stored over RAM + // check for a Super Chip. Atari ROM images [almost] always have the same value stored over RAM // regions. - bool has_superchip = true; - bool is_ram_plus = true; - for(size_t address = 0; address < 512; address++) + if(target.atari.paging_model != StaticAnalyser::Atari2600PagingModel::CBSRamPlus) { - if(segment.data[address] != segment.data[0]) + bool has_superchip = true; + for(size_t address = 0; address < 256; address++) { - if(address < 256) has_superchip = false; - is_ram_plus = false; - if(!has_superchip && !is_ram_plus) break; + if(segment.data[address] != segment.data[0]) + { + has_superchip = false; + break; + } } + target.atari.uses_superchip = has_superchip; } - target.atari.uses_superchip = has_superchip; - if(is_ram_plus) target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::CBSRamPlus; // check for a Tigervision or Tigervision-esque scheme if(target.atari.paging_model == StaticAnalyser::Atari2600PagingModel::None && segment.data.size() > 4096)