Tweaked EF bankswitch autodetection.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2410 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-03-12 20:45:24 +00:00
parent f6e8c25546
commit 02ad41e60a
1 changed files with 9 additions and 6 deletions

View File

@ -641,14 +641,17 @@ bool Cartridge::isProbablyEF(const uInt8* image, uInt32 size)
// EF cart bankswitching switches banks by accessing addresses 0xFE0 // EF cart bankswitching switches banks by accessing addresses 0xFE0
// to 0xFEF, usually with either a NOP or LDA // 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 // 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 { 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)) for(uInt32 i = 0; i < 4; ++i)
if(searchForBytes(image, size, signature[i], 3, 1))
return true; return true;
else
return searchForBytes(image, size, signature[1], 3, 1); return false;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -