From 1c1d7652e839eb0a4b3985a48cfc4c35c9f2aa90 Mon Sep 17 00:00:00 2001 From: stephena Date: Fri, 28 Mar 2008 23:29:14 +0000 Subject: [PATCH] Bumped version to 2.5.1_cvs. Fixed long-standing bug where debugger mode didn't work for E0 carts. It seems at some point I refactored a section of code, and the debugger wasn't being locked before entering it. Hence, bankswitching was occuring when the debugger attempted to read the emulation state. Fixed a similar debugger issue for 4A50 support. This might necessitate a 2.5.1 release ... git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1450 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/common/Version.hxx | 4 +- stella/src/debugger/Debugger.cxx | 28 ++++------ stella/src/emucore/Cart.hxx | 12 ++--- stella/src/emucore/Cart0840.cxx | 2 +- stella/src/emucore/Cart3E.cxx | 4 +- stella/src/emucore/Cart3F.cxx | 4 +- stella/src/emucore/Cart4A50.cxx | 16 +++--- stella/src/emucore/CartAR.cxx | 4 +- stella/src/emucore/CartDPC.cxx | 4 +- stella/src/emucore/CartE0.cxx | 68 +++++++++++++------------ stella/src/emucore/CartE7.cxx | 4 +- stella/src/emucore/CartF4.cxx | 4 +- stella/src/emucore/CartF4SC.cxx | 4 +- stella/src/emucore/CartF6.cxx | 4 +- stella/src/emucore/CartF6SC.cxx | 4 +- stella/src/emucore/CartF8.cxx | 4 +- stella/src/emucore/CartF8SC.cxx | 60 ++++++++++------------ stella/src/emucore/CartFASC.cxx | 4 +- stella/src/emucore/CartMB.cxx | 6 +-- stella/src/emucore/CartSB.cxx | 2 +- stella/src/emucore/CartUA.cxx | 4 +- stella/src/emucore/CartX07.cxx | 4 +- stella/src/emucore/EventHandler.cxx | 11 ++-- stella/src/emucore/m6502/src/System.cxx | 5 +- 24 files changed, 131 insertions(+), 135 deletions(-) diff --git a/stella/src/common/Version.hxx b/stella/src/common/Version.hxx index bd2c402ba..a8a938a49 100644 --- a/stella/src/common/Version.hxx +++ b/stella/src/common/Version.hxx @@ -13,13 +13,13 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Version.hxx,v 1.33 2008-03-26 23:59:21 stephena Exp $ +// $Id: Version.hxx,v 1.34 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #ifndef VERSION_HXX #define VERSION_HXX -#define STELLA_BASE_VERSION "2.5" +#define STELLA_BASE_VERSION "2.5.1_cvs" #ifdef NIGHTLY_BUILD #define STELLA_VERSION STELLA_BASE_VERSION "pre-" NIGHTLY_BUILD diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index af97f6008..c7a31b057 100644 --- a/stella/src/debugger/Debugger.cxx +++ b/stella/src/debugger/Debugger.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: Debugger.cxx,v 1.120 2008-03-23 17:43:21 stephena Exp $ +// $Id: Debugger.cxx,v 1.121 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include "bspf.hxx" @@ -669,11 +669,10 @@ int Debugger::step() saveOldState(); int cyc = mySystem->cycles(); - // mySystem->unlockDataBus(); + unlockState(); myOSystem->console().mediaSource().updateScanlineByStep(); - // mySystem->lockDataBus(); - unlockState(); + lockState(); return mySystem->cycles() - cyc; } @@ -692,22 +691,21 @@ int Debugger::step() int Debugger::trace() { // 32 is the 6502 JSR instruction: - if(mySystem->peek(myCpuDebug->pc()) == 32) { + if(mySystem->peek(myCpuDebug->pc()) == 32) + { saveOldState(); int cyc = mySystem->cycles(); int targetPC = myCpuDebug->pc() + 3; // return address - // mySystem->unlockDataBus(); - unlockState(); + unlockState(); myOSystem->console().mediaSource().updateScanlineByTrace(targetPC); - // mySystem->lockDataBus(); - lockState(); + lockState(); return mySystem->cycles() - cyc; - } else { - return step(); } + else + return step(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -838,10 +836,9 @@ void Debugger::disassemble(IntArray& addr, StringList& addrLabel, void Debugger::nextScanline(int lines) { saveOldState(); - // mySystem->unlockDataBus(); + unlockState(); myTiaOutput->advanceScanline(lines); - // mySystem->lockDataBus(); lockState(); } @@ -849,10 +846,9 @@ void Debugger::nextScanline(int lines) void Debugger::nextFrame(int frames) { saveOldState(); - // mySystem->unlockDataBus(); + unlockState(); myTiaOutput->advance(frames); - // mySystem->lockDataBus(); lockState(); } @@ -953,7 +949,6 @@ void Debugger::saveOldState() void Debugger::setStartState() { // Lock the bus each time the debugger is entered, so we don't disturb anything - // mySystem->lockDataBus(); lockState(); } @@ -961,7 +956,6 @@ void Debugger::setStartState() void Debugger::setQuitState() { // Bus must be unlocked for normal operation when leaving debugger mode - // mySystem->unlockDataBus(); unlockState(); // execute one instruction on quit. If we're diff --git a/stella/src/emucore/Cart.hxx b/stella/src/emucore/Cart.hxx index 62d1fe993..b30b27d07 100644 --- a/stella/src/emucore/Cart.hxx +++ b/stella/src/emucore/Cart.hxx @@ -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.hxx,v 1.23 2008-02-27 20:13:55 stephena Exp $ +// $Id: Cart.hxx,v 1.24 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #ifndef CARTRIDGE_HXX @@ -34,7 +34,7 @@ class Settings; game and handles any bankswitching performed by the cartridge. @author Bradford W. Mott - @version $Id: Cart.hxx,v 1.23 2008-02-27 20:13:55 stephena Exp $ + @version $Id: Cart.hxx,v 1.24 2008-03-28 23:29:13 stephena Exp $ */ class Cartridge : public Device { @@ -77,8 +77,8 @@ class Cartridge : public Device /** Lock/unlock bankswitching capability. */ - void lockBank() { bankLocked = true; } - void unlockBank() { bankLocked = false; } + void lockBank() { myBankLocked = true; } + void unlockBank() { myBankLocked = false; } public: ////////////////////////////////////////////////////////////////////// @@ -143,9 +143,9 @@ class Cartridge : public Device virtual string name() const = 0; protected: - // If bankLocked is true, ignore attempts at bankswitching. This is used + // If myBankLocked is true, ignore attempts at bankswitching. This is used // by the debugger, when disassembling/dumping ROM. - bool bankLocked; + bool myBankLocked; private: /** diff --git a/stella/src/emucore/Cart0840.cxx b/stella/src/emucore/Cart0840.cxx index 8fc827dfc..bbad1356d 100644 --- a/stella/src/emucore/Cart0840.cxx +++ b/stella/src/emucore/Cart0840.cxx @@ -145,7 +145,7 @@ void Cartridge0840::poke(uInt16 address, uInt8 value) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Cartridge0840::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank = bank; diff --git a/stella/src/emucore/Cart3E.cxx b/stella/src/emucore/Cart3E.cxx index a4b3309fb..e56ba8c53 100644 --- a/stella/src/emucore/Cart3E.cxx +++ b/stella/src/emucore/Cart3E.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: Cart3E.cxx,v 1.14 2008-02-06 13:45:20 stephena Exp $ +// $Id: Cart3E.cxx,v 1.15 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -136,7 +136,7 @@ void Cartridge3E::poke(uInt16 address, uInt8 value) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Cartridge3E::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; if(bank < 256) { diff --git a/stella/src/emucore/Cart3F.cxx b/stella/src/emucore/Cart3F.cxx index f52461454..08d3f29a3 100644 --- a/stella/src/emucore/Cart3F.cxx +++ b/stella/src/emucore/Cart3F.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: Cart3F.cxx,v 1.17 2008-02-06 13:45:20 stephena Exp $ +// $Id: Cart3F.cxx,v 1.18 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -117,7 +117,7 @@ void Cartridge3F::poke(uInt16 address, uInt8 value) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Cartridge3F::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Make sure the bank they're asking for is reasonable if((uInt32)bank * 2048 < mySize) diff --git a/stella/src/emucore/Cart4A50.cxx b/stella/src/emucore/Cart4A50.cxx index 651f221af..13f8ef3ca 100644 --- a/stella/src/emucore/Cart4A50.cxx +++ b/stella/src/emucore/Cart4A50.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: Cart4A50.cxx,v 1.13 2008-02-22 16:27:07 stephena Exp $ +// $Id: Cart4A50.cxx,v 1.14 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -120,7 +120,7 @@ uInt8 Cartridge4A50::peek(uInt16 address) else if((address & 0x1f00) == 0x1f00) // 256B region from 0x1f00 - 0x1fff { value = myImage[(address & 0xff) + 0x1ff00]; - if(((myLastData & 0xe0) == 0x60) && + if(!myBankLocked && ((myLastData & 0xe0) == 0x60) && ((myLastAddress >= 0x1000) || (myLastAddress < 0x200))) mySliceHigh = (mySliceHigh & 0xf0ff) | ((address & 0x8) << 8) | ((address & 0x70) << 4); @@ -166,7 +166,7 @@ void Cartridge4A50::poke(uInt16 address, uInt8 value) } else if((address & 0x1f00) == 0x1f00) // 256B region at 0x1f00 - 0x1fff { - if(((myLastData & 0xe0) == 0x60) && + if(!myBankLocked && ((myLastData & 0xe0) == 0x60) && ((myLastAddress >= 0x1000) || (myLastAddress < 0x200))) mySliceHigh = (mySliceHigh & 0xf0ff) | ((address & 0x8) << 8) | ((address & 0x70) << 4); @@ -179,6 +179,8 @@ void Cartridge4A50::poke(uInt16 address, uInt8 value) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Cartridge4A50::checkBankSwitch(uInt16 address, uInt8 value) { + if(myBankLocked) return; + // This scheme contains so many hotspots that it's easier to just check // all of them if(((myLastData & 0xe0) == 0x60) && // Switch lower/middle/upper bank @@ -293,7 +295,8 @@ int Cartridge4A50::bank() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int Cartridge4A50::bankCount() { - return 1; // TODO + // Doesn't support bankswitching in the normal sense + return 1; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -305,11 +308,10 @@ bool Cartridge4A50::patch(uInt16 address, uInt8 value) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8* Cartridge4A50::getImage(int& size) { - size = 0; // TODO - return 0; + size = 131072; + return &myImage[0]; } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Cartridge4A50::save(Serializer& out) const { diff --git a/stella/src/emucore/CartAR.cxx b/stella/src/emucore/CartAR.cxx index 2e9b86f48..5589394ec 100644 --- a/stella/src/emucore/CartAR.cxx +++ b/stella/src/emucore/CartAR.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: CartAR.cxx,v 1.20 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartAR.cxx,v 1.21 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -423,7 +423,7 @@ void CartridgeAR::loadIntoRAM(uInt8 load) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeAR::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; bankConfiguration(bank); } diff --git a/stella/src/emucore/CartDPC.cxx b/stella/src/emucore/CartDPC.cxx index d618c9e90..c14a03192 100644 --- a/stella/src/emucore/CartDPC.cxx +++ b/stella/src/emucore/CartDPC.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: CartDPC.cxx,v 1.20 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartDPC.cxx,v 1.21 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -423,7 +423,7 @@ void CartridgeDPC::poke(uInt16 address, uInt8 value) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeDPC::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank = bank; diff --git a/stella/src/emucore/CartE0.cxx b/stella/src/emucore/CartE0.cxx index 75cda3b65..f6de970d0 100644 --- a/stella/src/emucore/CartE0.cxx +++ b/stella/src/emucore/CartE0.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: CartE0.cxx,v 1.15 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartE0.cxx,v 1.16 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -87,20 +87,18 @@ uInt8 CartridgeE0::peek(uInt16 address) { address = address & 0x0FFF; - if(!bankLocked) { - // Switch banks if necessary - if((address >= 0x0FE0) && (address <= 0x0FE7)) - { - segmentZero(address & 0x0007); - } - else if((address >= 0x0FE8) && (address <= 0x0FEF)) - { - segmentOne(address & 0x0007); - } - else if((address >= 0x0FF0) && (address <= 0x0FF7)) - { - segmentTwo(address & 0x0007); - } + // Switch banks if necessary + if((address >= 0x0FE0) && (address <= 0x0FE7)) + { + segmentZero(address & 0x0007); + } + else if((address >= 0x0FE8) && (address <= 0x0FEF)) + { + segmentOne(address & 0x0007); + } + else if((address >= 0x0FF0) && (address <= 0x0FF7)) + { + segmentTwo(address & 0x0007); } return myImage[(myCurrentSlice[address >> 10] << 10) + (address & 0x03FF)]; @@ -111,26 +109,26 @@ void CartridgeE0::poke(uInt16 address, uInt8) { address = address & 0x0FFF; - if(!bankLocked) { - // Switch banks if necessary - if((address >= 0x0FE0) && (address <= 0x0FE7)) - { - segmentZero(address & 0x0007); - } - else if((address >= 0x0FE8) && (address <= 0x0FEF)) - { - segmentOne(address & 0x0007); - } - else if((address >= 0x0FF0) && (address <= 0x0FF7)) - { - segmentTwo(address & 0x0007); - } + // Switch banks if necessary + if((address >= 0x0FE0) && (address <= 0x0FE7)) + { + segmentZero(address & 0x0007); + } + else if((address >= 0x0FE8) && (address <= 0x0FEF)) + { + segmentOne(address & 0x0007); + } + else if((address >= 0x0FF0) && (address <= 0x0FF7)) + { + segmentTwo(address & 0x0007); } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeE0::segmentZero(uInt16 slice) { + if(myBankLocked) return; + // Remember the new slice myCurrentSlice[0] = slice; uInt16 offset = slice << 10; @@ -151,6 +149,8 @@ void CartridgeE0::segmentZero(uInt16 slice) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeE0::segmentOne(uInt16 slice) { + if(myBankLocked) return; + // Remember the new slice myCurrentSlice[1] = slice; uInt16 offset = slice << 10; @@ -171,6 +171,8 @@ void CartridgeE0::segmentOne(uInt16 slice) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeE0::segmentTwo(uInt16 slice) { + if(myBankLocked) return; + // Remember the new slice myCurrentSlice[2] = slice; uInt16 offset = slice << 10; @@ -189,22 +191,22 @@ void CartridgeE0::segmentTwo(uInt16 slice) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeE0::bank(uInt16 bank) +void CartridgeE0::bank(uInt16) { - // FIXME - get this working, so we can debug E0 carts + // Doesn't support bankswitching in the normal sense } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int CartridgeE0::bank() { - // FIXME - get this working, so we can debug E0 carts + // Doesn't support bankswitching in the normal sense return 0; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int CartridgeE0::bankCount() { - // FIXME - get this working, so we can debug E0 carts + // Doesn't support bankswitching in the normal sense return 1; } diff --git a/stella/src/emucore/CartE7.cxx b/stella/src/emucore/CartE7.cxx index 5df697f44..99e010f7c 100644 --- a/stella/src/emucore/CartE7.cxx +++ b/stella/src/emucore/CartE7.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: CartE7.cxx,v 1.18 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartE7.cxx,v 1.19 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -163,7 +163,7 @@ void CartridgeE7::bankRAM(uInt16 bank) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeE7::bank(uInt16 slice) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentSlice[0] = slice; diff --git a/stella/src/emucore/CartF4.cxx b/stella/src/emucore/CartF4.cxx index 7b15ef1bf..2afbff1c8 100644 --- a/stella/src/emucore/CartF4.cxx +++ b/stella/src/emucore/CartF4.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: CartF4.cxx,v 1.13 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartF4.cxx,v 1.14 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -97,7 +97,7 @@ void CartridgeF4::poke(uInt16 address, uInt8) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF4::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank = bank; diff --git a/stella/src/emucore/CartF4SC.cxx b/stella/src/emucore/CartF4SC.cxx index b31d02a3c..cb8bd1964 100644 --- a/stella/src/emucore/CartF4SC.cxx +++ b/stella/src/emucore/CartF4SC.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: CartF4SC.cxx,v 1.16 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartF4SC.cxx,v 1.17 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -127,7 +127,7 @@ void CartridgeF4SC::poke(uInt16 address, uInt8) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF4SC::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank = bank; diff --git a/stella/src/emucore/CartF6.cxx b/stella/src/emucore/CartF6.cxx index c661868bc..1bcfa6249 100644 --- a/stella/src/emucore/CartF6.cxx +++ b/stella/src/emucore/CartF6.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: CartF6.cxx,v 1.15 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartF6.cxx,v 1.16 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -140,7 +140,7 @@ void CartridgeF6::poke(uInt16 address, uInt8) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF6::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank = bank; diff --git a/stella/src/emucore/CartF6SC.cxx b/stella/src/emucore/CartF6SC.cxx index 2a6fbc8c6..fcf0155c9 100644 --- a/stella/src/emucore/CartF6SC.cxx +++ b/stella/src/emucore/CartF6SC.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: CartF6SC.cxx,v 1.15 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartF6SC.cxx,v 1.16 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -171,7 +171,7 @@ void CartridgeF6SC::poke(uInt16 address, uInt8) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF6SC::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank = bank; diff --git a/stella/src/emucore/CartF8.cxx b/stella/src/emucore/CartF8.cxx index 7e7eba944..6c126fa18 100644 --- a/stella/src/emucore/CartF8.cxx +++ b/stella/src/emucore/CartF8.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: CartF8.cxx,v 1.17 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartF8.cxx,v 1.18 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -122,7 +122,7 @@ void CartridgeF8::poke(uInt16 address, uInt8) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF8::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank = bank; diff --git a/stella/src/emucore/CartF8SC.cxx b/stella/src/emucore/CartF8SC.cxx index e1f02a069..643f73e68 100644 --- a/stella/src/emucore/CartF8SC.cxx +++ b/stella/src/emucore/CartF8SC.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: CartF8SC.cxx,v 1.15 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartF8SC.cxx,v 1.16 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -98,23 +98,21 @@ uInt8 CartridgeF8SC::peek(uInt16 address) { address = address & 0x0FFF; - if(!bankLocked) { - // Switch banks if necessary - switch(address) - { - case 0x0FF8: - // Set the current bank to the lower 4k bank - bank(0); - break; + // Switch banks if necessary + switch(address) + { + case 0x0FF8: + // Set the current bank to the lower 4k bank + bank(0); + break; - case 0x0FF9: - // Set the current bank to the upper 4k bank - bank(1); - break; + case 0x0FF9: + // Set the current bank to the upper 4k bank + bank(1); + break; - default: - break; - } + default: + break; } // NOTE: This does not handle accessing RAM, however, this function @@ -128,23 +126,21 @@ void CartridgeF8SC::poke(uInt16 address, uInt8) { address = address & 0x0FFF; - if(!bankLocked) { - // Switch banks if necessary - switch(address) - { - case 0x0FF8: - // Set the current bank to the lower 4k bank - bank(0); - break; + // Switch banks if necessary + switch(address) + { + case 0x0FF8: + // Set the current bank to the lower 4k bank + bank(0); + break; - case 0x0FF9: - // Set the current bank to the upper 4k bank - bank(1); - break; + case 0x0FF9: + // Set the current bank to the upper 4k bank + bank(1); + break; - default: - break; - } + default: + break; } // NOTE: This does not handle accessing RAM, however, this function @@ -155,7 +151,7 @@ void CartridgeF8SC::poke(uInt16 address, uInt8) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF8SC::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank = bank; diff --git a/stella/src/emucore/CartFASC.cxx b/stella/src/emucore/CartFASC.cxx index 0dc011d87..713d4fc8b 100644 --- a/stella/src/emucore/CartFASC.cxx +++ b/stella/src/emucore/CartFASC.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: CartFASC.cxx,v 1.15 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartFASC.cxx,v 1.16 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -167,7 +167,7 @@ void CartridgeFASC::poke(uInt16 address, uInt8) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeFASC::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank = bank; diff --git a/stella/src/emucore/CartMB.cxx b/stella/src/emucore/CartMB.cxx index 5856a7a48..b6ca10cc3 100644 --- a/stella/src/emucore/CartMB.cxx +++ b/stella/src/emucore/CartMB.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: CartMB.cxx,v 1.13 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartMB.cxx,v 1.14 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -92,7 +92,7 @@ void CartridgeMB::poke(uInt16 address, uInt8) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeMB::incbank() { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank ++; @@ -118,7 +118,7 @@ void CartridgeMB::incbank() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeMB::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; myCurrentBank = (bank - 1); incbank(); diff --git a/stella/src/emucore/CartSB.cxx b/stella/src/emucore/CartSB.cxx index f74ba7281..f16f1fb8d 100644 --- a/stella/src/emucore/CartSB.cxx +++ b/stella/src/emucore/CartSB.cxx @@ -123,7 +123,7 @@ void CartridgeSB::poke(uInt16 address, uInt8 value) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeSB::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank = bank; diff --git a/stella/src/emucore/CartUA.cxx b/stella/src/emucore/CartUA.cxx index 9dc2dbd71..2bb83444a 100644 --- a/stella/src/emucore/CartUA.cxx +++ b/stella/src/emucore/CartUA.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: CartUA.cxx,v 1.12 2008-02-06 13:45:21 stephena Exp $ +// $Id: CartUA.cxx,v 1.13 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -132,7 +132,7 @@ void CartridgeUA::poke(uInt16 address, uInt8 value) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeUA::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank = bank; diff --git a/stella/src/emucore/CartX07.cxx b/stella/src/emucore/CartX07.cxx index 51ae36225..8129f7b65 100644 --- a/stella/src/emucore/CartX07.cxx +++ b/stella/src/emucore/CartX07.cxx @@ -116,13 +116,12 @@ void CartridgeX07::poke(uInt16 address, uInt8 value) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeX07::bank(uInt16 bank) { - if(bankLocked) return; + if(myBankLocked) return; // Remember what bank we're in myCurrentBank = (bank & 0x0f); uInt32 offset = myCurrentBank * 4096; uInt16 shift = mySystem->pageShift(); -// uInt16 mask = mySystem->pageMask(); // Setup the page access methods for the current bank System::PageAccess access; @@ -158,7 +157,6 @@ bool CartridgeX07::patch(uInt16 address, uInt8 value) return true; } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8* CartridgeX07::getImage(int& size) { diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index d1a4b6025..804286469 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.cxx @@ -14,7 +14,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: EventHandler.cxx,v 1.219 2008-03-22 17:35:02 stephena Exp $ +// $Id: EventHandler.cxx,v 1.220 2008-03-28 23:29:13 stephena Exp $ //============================================================================ #include @@ -1875,15 +1875,18 @@ bool EventHandler::enterDebugMode() if(myState == S_DEBUGGER) return false; + // Make sure debugger starts in a consistent state + // This absolutely *has* to come before we actually change to debugger + // mode, since it takes care of locking the debugger state, which will + // probably be modified below + myOSystem->debugger().setStartState(); + setEventState(S_DEBUGGER); myOSystem->createFrameBuffer(); myOverlay->reStack(); myOSystem->frameBuffer().setCursorState(); myOSystem->sound().mute(true); myEvent->clear(); - - // Make sure debugger starts in a consistent state - myOSystem->debugger().setStartState(); #else myOSystem->frameBuffer().showMessage("Debugger unsupported"); #endif diff --git a/stella/src/emucore/m6502/src/System.cxx b/stella/src/emucore/m6502/src/System.cxx index 60c53e838..6669d7787 100644 --- a/stella/src/emucore/m6502/src/System.cxx +++ b/stella/src/emucore/m6502/src/System.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: System.cxx,v 1.25 2008-02-19 12:33:07 stephena Exp $ +// $Id: System.cxx,v 1.26 2008-03-28 23:29:14 stephena Exp $ //============================================================================ #include @@ -35,7 +35,8 @@ System::System(uInt16 n, uInt16 m) myM6502(0), myTIA(0), myCycles(0), - myDataBusState(0) + myDataBusState(0), + myDataBusLocked(false) { // Make sure the arguments are reasonable assert((1 <= m) && (m <= n) && (n <= 16));