From 7a414429be961b5437d6a876a9f55a7b7fbdf846 Mon Sep 17 00:00:00 2001 From: stephena Date: Sat, 11 Apr 2009 20:09:31 +0000 Subject: [PATCH] Added bankswitch autodetection for '0840' ROMs. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1696 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/Cart.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/stella/src/emucore/Cart.cxx b/stella/src/emucore/Cart.cxx index 1c56b641e..3a404dee8 100644 --- a/stella/src/emucore/Cart.cxx +++ b/stella/src/emucore/Cart.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Cart.cxx,v 1.52 2009-04-11 19:48:25 stephena Exp $ +// $Id: Cart.cxx,v 1.53 2009-04-11 20:09:31 stephena Exp $ //============================================================================ #include @@ -490,8 +490,16 @@ bool Cartridge::isProbablySB(const uInt8* image, uInt32 size) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Cartridge::isProbably0840(const uInt8* image, uInt32 size) { - // TODO - add autodetection for this type - return false; + // 0840 cart bankswitching is triggered by accessing addresses 0x0800 + // or 0x0840 + uInt8 signature[2][3] = { + { 0xAD, 0x00, 0x08 }, // LDA $0800 + { 0xAD, 0x40, 0x08 } // LDA $0840 + }; + if(searchForBytes(image, size, signature[0], 3, 1)) + return true; + else + return searchForBytes(image, size, signature[1], 3, 1); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -