diff --git a/stella/src/emucore/Cart.cxx b/stella/src/emucore/Cart.cxx index 8aafd83ef..1c56b641e 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.51 2009-04-10 15:04:31 stephena Exp $ +// $Id: Cart.cxx,v 1.52 2009-04-11 19:48:25 stephena Exp $ //============================================================================ #include @@ -280,7 +280,7 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size) else type = "MB"; } - else if(size == 131072) // 128K + else if(size == 128*1024) // 128K { if(isProbably3E(image, size)) type = "3E"; @@ -293,6 +293,15 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size) else type = "MC"; } + else if(size == 256*1024) // 256K + { + if(isProbably3E(image, size)) + type = "3E"; + else if(isProbably3F(image, size)) + type = "3F"; + else /*if(isProbablySB(image, size))*/ + type = "SB"; + } else // what else can we do? { if(isProbably3E(image, size)) @@ -467,8 +476,15 @@ bool Cartridge::isProbably4A50(const uInt8* image, uInt32 size) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Cartridge::isProbablySB(const uInt8* image, uInt32 size) { - // TODO - add autodetection for this type - return false; + // SB cart bankswitching switches banks by accessing address 0x0800 + uInt8 signature[2][3] = { + { 0xBD, 0x00, 0x08 }, // LDA $0800,x + { 0xAD, 0x00, 0x08 } // LDA $0800 + }; + if(searchForBytes(image, size, signature[0], 3, 1)) + return true; + else + return searchForBytes(image, size, signature[1], 3, 1); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/CartEF.cxx b/stella/src/emucore/CartEF.cxx index 3a4af7ea7..9ffac32a7 100644 --- a/stella/src/emucore/CartEF.cxx +++ b/stella/src/emucore/CartEF.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: CartEF.cxx,v 1.2 2009-04-05 19:02:56 stephena Exp $ +// $Id: CartEF.cxx,v 1.3 2009-04-11 19:48:25 stephena Exp $ //============================================================================ #include @@ -38,7 +38,7 @@ CartridgeEF::~CartridgeEF() void CartridgeEF::reset() { // Upon reset we switch to bank 1 - myCurrentBank = 1; + bank(1); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/CartSB.cxx b/stella/src/emucore/CartSB.cxx index 4979843bb..c4d907199 100644 --- a/stella/src/emucore/CartSB.cxx +++ b/stella/src/emucore/CartSB.cxx @@ -164,7 +164,6 @@ bool CartridgeSB::patch(uInt16 address, uInt8 value) return true; } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8* CartridgeSB::getImage(int& size) {