Improved X07 autodetection.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2580 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-01-04 20:19:01 +00:00
parent c4e5360a18
commit e467441c37
2 changed files with 9 additions and 3 deletions

View File

@ -23,6 +23,9 @@
- The 'volume clipping' option has been removed, since in 16-bit - The 'volume clipping' option has been removed, since in 16-bit
mode it's no longer needed. mode it's no longer needed.
* Improved bankswitch autodetection for X07 ROMs (although there's only
two known ROMs in existence, so the detection probably isn't robust).
-Have fun! -Have fun!

View File

@ -754,12 +754,15 @@ bool Cartridge::isProbablyUA(const uInt8* image, uInt32 size)
bool Cartridge::isProbablyX07(const uInt8* image, uInt32 size) bool Cartridge::isProbablyX07(const uInt8* image, uInt32 size)
{ {
// X07 bankswitching switches to bank 0, 1, 2, etc by accessing address 0x08xd // X07 bankswitching switches to bank 0, 1, 2, etc by accessing address 0x08xd
uInt8 signature[3][3] = { uInt8 signature[6][3] = {
{ 0xAD, 0x0D, 0x08 }, // LDA $080D { 0xAD, 0x0D, 0x08 }, // LDA $080D
{ 0xAD, 0x1D, 0x08 }, // LDA $081D { 0xAD, 0x1D, 0x08 }, // LDA $081D
{ 0xAD, 0x2D, 0x08 } // LDA $082D { 0xAD, 0x2D, 0x08 }, // LDA $082D
{ 0x0C, 0x0D, 0x08 }, // NOP $080D
{ 0x0C, 0x1D, 0x08 }, // NOP $081D
{ 0x0C, 0x2D, 0x08 } // NOP $082D
}; };
for(uInt32 i = 0; i < 3; ++i) for(uInt32 i = 0; i < 6; ++i)
if(searchForBytes(image, size, signature[i], 3, 1)) if(searchForBytes(image, size, signature[i], 3, 1))
return true; return true;