diff --git a/src/emucore/CartDetector.cxx b/src/emucore/CartDetector.cxx index d6b319ee3..72e3d7d98 100644 --- a/src/emucore/CartDetector.cxx +++ b/src/emucore/CartDetector.cxx @@ -946,12 +946,12 @@ bool CartDetector::isProbablyFA2(const ByteBuffer& image, size_t) bool CartDetector::isProbablyFC(const ByteBuffer& image, size_t size) { // FC bankswitching uses consecutive writes to 3 hotspots - uInt8 signature[2][6] = { + uInt8 signature[3][6] = { { 0x8d, 0xf8, 0x1f, 0x4a, 0x4a, 0x8d }, // STA $1FF8, LSR, LSR, STA... Power Play Arcade Menus, 3-D Ghost Attack { 0x8d, 0xf8, 0xff, 0x8d, 0xfc, 0xff }, // STA $FFF8, STA $FFFC Surf's Up (4K) - //{ 0x8c, 0xf9, 0xff, 0xad, 0xfc, 0xff } // STY $FFF9, LDA $FFFC 3-D Havoc (patched for F8, ignore!) + { 0x8c, 0xf9, 0xff, 0xad, 0xfc, 0xff } // STY $FFF9, LDA $FFFC 3-D Havoc }; - for (uInt32 i = 0; i < 2; ++i) + for (uInt32 i = 0; i < 3; ++i) if (searchForBytes(image.get(), size, signature[i], 6, 1)) return true; diff --git a/src/emucore/CartFC.cxx b/src/emucore/CartFC.cxx index a5f3e74a0..75082ff36 100644 --- a/src/emucore/CartFC.cxx +++ b/src/emucore/CartFC.cxx @@ -86,8 +86,14 @@ bool CartridgeFC::poke(uInt16 address, uInt8 value) case 0x0FF9: // Set the high bits of target 4k bank - myTargetBank += value << 2; - myTargetBank %= bankCount(); + if (value << 2 < bankCount()) + { + myTargetBank += value << 2; + myTargetBank %= bankCount(); + } + else + // special handling when both values are identical (e.g. 4/4 or 5/5) + myTargetBank = value % bankCount(); break; case 0x0FFC: