From f3c1b6308aa7241a7e2070febdb130f4a09a3be9 Mon Sep 17 00:00:00 2001 From: stephena Date: Fri, 22 Feb 2008 15:29:52 +0000 Subject: [PATCH] Added 4A50 bankswitch autodetection. Currently, it only works with one ROM that follows the specs. Also, it seems the final ROM that wasn't working with this scheme actually *does* work; it just doesn't work when display format autodetection is turned on. So that's what I'll work on next. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1401 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/Cart.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/stella/src/emucore/Cart.cxx b/stella/src/emucore/Cart.cxx index 981856b07..378836b5c 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.37 2008-02-19 12:33:03 stephena Exp $ +// $Id: Cart.cxx,v 1.38 2008-02-22 15:29:52 stephena Exp $ //============================================================================ #include @@ -428,8 +428,11 @@ bool Cartridge::isProbablyUA(const uInt8* image, uInt32 size) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Cartridge::isProbably4A50(const uInt8* image, uInt32 size) { - // TODO - add autodetection for this type - return false; + // 4A50 carts store address $4A50 at the NMI vector, which + // in this scheme is always in the last page of ROM at + // $1FFA - $1FFB + int idx = size - 6; // $1FFA + return (image[idx] == 0x50 && image[idx+1] == 0x4A); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -