From 33bda2d40c27af6575b3906e053e2991a166ea4c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 11 Mar 2017 13:04:23 -0500 Subject: [PATCH] Switched to image inspection for RAM guesses rather than disassembly. Which fixes the other Parker Bros titles. --- Machines/Atari2600/Atari2600.cpp | 12 +++++----- StaticAnalyser/Atari/StaticAnalyser.cpp | 31 ++++++++++++++++++------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/Machines/Atari2600/Atari2600.cpp b/Machines/Atari2600/Atari2600.cpp index de4adfe62..97a907762 100644 --- a/Machines/Atari2600/Atari2600.cpp +++ b/Machines/Atari2600/Atari2600.cpp @@ -93,8 +93,8 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin } break; case StaticAnalyser::Atari2600PagingModel::ParkerBros: - if(masked_address >= 0x1fe0 && masked_address <= 0x1ff8) { - int slot = (masked_address - 0x1fe0) >> 3; + if(masked_address >= 0x1fe0 && masked_address < 0x1ff8) { + int slot = (masked_address >> 3) & 3; int target = masked_address & 7; rom_pages_[slot] = &rom_[target * 1024]; } @@ -290,13 +290,13 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) // On a real paged cartridge, any page may initially be visible. Various homebrew authors appear to have // decided the last page will always be initially visible. So do that. - size_t romMask = rom_size_ - 1; + size_t rom_mask = rom_size_ - 1; uint8_t *rom_base = rom_; if(rom_size_ > 4096) rom_base = &rom_[rom_size_ - 4096]; rom_pages_[0] = rom_base; - rom_pages_[1] = &rom_base[1024 & romMask]; - rom_pages_[2] = &rom_base[2048 & romMask]; - rom_pages_[3] = &rom_base[3072 & romMask]; + rom_pages_[1] = &rom_base[1024 & rom_mask]; + rom_pages_[2] = &rom_base[2048 & rom_mask]; + rom_pages_[3] = &rom_base[3072 & rom_mask]; switch(target.atari.paging_model) { diff --git a/StaticAnalyser/Atari/StaticAnalyser.cpp b/StaticAnalyser/Atari/StaticAnalyser.cpp index 944e74527..e48be34ed 100644 --- a/StaticAnalyser/Atari/StaticAnalyser.cpp +++ b/StaticAnalyser/Atari/StaticAnalyser.cpp @@ -145,19 +145,32 @@ static void DeterminePagingForCartridge(StaticAnalyser::Target &target, const St } // 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 - if(internal_stores.size() > 4) + // hat that this is a CBS RAM+ cartridge. Atari ROM images always have the same value stored over RAM + // regions. + bool has_superchip = true; + bool is_ram_plus = true; + for(size_t address = 0; address < 256; address++) { - bool writes_above_128 = false; - for(uint16_t address : internal_stores) + if(segment.data[address] != segment.data[0]) { - writes_above_128 |= ((address & 0x1fff) > 0x10ff) && ((address & 0x1fff) < 0x1200); + if(address < 128) has_superchip = false; + is_ram_plus = false; } - if(writes_above_128) - target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::CBSRamPlus; - else - target.atari.uses_superchip = true; } + target.atari.uses_superchip = has_superchip; + if(is_ram_plus) target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::CBSRamPlus; +// if(internal_stores.size() > 4) +// { +// bool writes_above_128 = false; +// for(uint16_t address : internal_stores) +// { +// writes_above_128 |= ((address & 0x1fff) > 0x10ff) && ((address & 0x1fff) < 0x1200); +// } +// if(writes_above_128) +// target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::CBSRamPlus; +// else +// target.atari.uses_superchip = true; +// } } void StaticAnalyser::Atari::AddTargets(