From 02ad41e60a41069bbefb61f89b7b025146333680 Mon Sep 17 00:00:00 2001 From: stephena Date: Mon, 12 Mar 2012 20:45:24 +0000 Subject: [PATCH] Tweaked EF bankswitch autodetection. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2410 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/emucore/Cart.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx index 0386d72d7..337a2904a 100644 --- a/src/emucore/Cart.cxx +++ b/src/emucore/Cart.cxx @@ -641,14 +641,17 @@ bool Cartridge::isProbablyEF(const uInt8* image, uInt32 size) // EF cart bankswitching switches banks by accessing addresses 0xFE0 // to 0xFEF, usually with either a NOP or LDA // It's likely that the code will switch to bank 0, so that's what is tested - uInt8 signature[2][3] = { + uInt8 signature[4][3] = { { 0x0C, 0xE0, 0xFF }, // NOP $FFE0 - { 0xAD, 0xE0, 0xFF } // LDA $FFE0 + { 0xAD, 0xE0, 0xFF }, // LDA $FFE0 + { 0x0C, 0xE0, 0x1F }, // NOP $1FE0 + { 0xAD, 0xE0, 0x1F } // LDA $1FE0 }; - if(searchForBytes(image, size, signature[0], 3, 1)) - return true; - else - return searchForBytes(image, size, signature[1], 3, 1); + for(uInt32 i = 0; i < 4; ++i) + if(searchForBytes(image, size, signature[i], 3, 1)) + return true; + + return false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -