From ec5e3fbe17386ec61da4c1180ddf0c7d5634cdf0 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Fri, 15 Sep 2023 08:44:02 +0200 Subject: [PATCH] changed FE bankswitching code to support up to 8 banks --- src/debugger/gui/CartFEWidget.cxx | 2 +- src/emucore/CartCreator.cxx | 2 +- src/emucore/CartFE.cxx | 2 +- src/emucore/CartFE.hxx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/debugger/gui/CartFEWidget.cxx b/src/debugger/gui/CartFEWidget.cxx index 6d86e062d..bee645e61 100644 --- a/src/debugger/gui/CartFEWidget.cxx +++ b/src/debugger/gui/CartFEWidget.cxx @@ -32,7 +32,7 @@ string CartridgeFEWidget::description() { ostringstream info; - info << "FE (aka SCABS) cartridge, two 4K banks\n" + info << "FE (aka SCABS) cartridge, up to eight 4K banks\n" << "Monitors access to hotspot $01FE, and uses " << "upper 3 bits of databus for bank number:\n" << CartridgeEnhancedWidget::description(); diff --git a/src/emucore/CartCreator.cxx b/src/emucore/CartCreator.cxx index 021cbed2f..53cb152a7 100644 --- a/src/emucore/CartCreator.cxx +++ b/src/emucore/CartCreator.cxx @@ -308,7 +308,7 @@ CartCreator::createFromImage(const ByteBuffer& image, size_t size, case Bankswitch::Type::_FC: return make_unique(image, size, md5, settings); case Bankswitch::Type::_FE: - return make_unique(image, size, md5, settings); + return make_unique(image, size, md5, settings, size); case Bankswitch::Type::_GL: return make_unique(image, size, md5, settings); case Bankswitch::Type::_MDM: diff --git a/src/emucore/CartFE.cxx b/src/emucore/CartFE.cxx index 3ffe04895..965c7e2bc 100644 --- a/src/emucore/CartFE.cxx +++ b/src/emucore/CartFE.cxx @@ -52,7 +52,7 @@ bool CartridgeFE::checkSwitchBank(uInt16 address, uInt8 value) { if(myLastAccessWasFE) { - bank((value & 0x20) ? 0 : 1); + bank((value >> 5) ^ 0b111); myLastAccessWasFE = false; // was: address == 0x01FE; return true; } diff --git a/src/emucore/CartFE.hxx b/src/emucore/CartFE.hxx index 00a7297bc..fb8307a19 100644 --- a/src/emucore/CartFE.hxx +++ b/src/emucore/CartFE.hxx @@ -91,7 +91,7 @@ class CartridgeFE : public CartridgeEnhanced @param bsSize The size specified by the bankswitching scheme */ CartridgeFE(const ByteBuffer& image, size_t size, string_view md5, - const Settings& settings, size_t bsSize = 8_KB); + const Settings& settings, size_t bsSize); ~CartridgeFE() override = default; public: