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
This commit is contained in:
stephena 2008-03-28 23:29:14 +00:00
parent 56ab631429
commit 1c1d7652e8
24 changed files with 131 additions and 135 deletions

View File

@ -13,13 +13,13 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef VERSION_HXX
#define VERSION_HXX #define VERSION_HXX
#define STELLA_BASE_VERSION "2.5" #define STELLA_BASE_VERSION "2.5.1_cvs"
#ifdef NIGHTLY_BUILD #ifdef NIGHTLY_BUILD
#define STELLA_VERSION STELLA_BASE_VERSION "pre-" NIGHTLY_BUILD #define STELLA_VERSION STELLA_BASE_VERSION "pre-" NIGHTLY_BUILD

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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" #include "bspf.hxx"
@ -669,11 +669,10 @@ int Debugger::step()
saveOldState(); saveOldState();
int cyc = mySystem->cycles(); int cyc = mySystem->cycles();
// mySystem->unlockDataBus();
unlockState(); unlockState();
myOSystem->console().mediaSource().updateScanlineByStep(); myOSystem->console().mediaSource().updateScanlineByStep();
// mySystem->lockDataBus(); lockState();
unlockState();
return mySystem->cycles() - cyc; return mySystem->cycles() - cyc;
} }
@ -692,22 +691,21 @@ int Debugger::step()
int Debugger::trace() int Debugger::trace()
{ {
// 32 is the 6502 JSR instruction: // 32 is the 6502 JSR instruction:
if(mySystem->peek(myCpuDebug->pc()) == 32) { if(mySystem->peek(myCpuDebug->pc()) == 32)
{
saveOldState(); saveOldState();
int cyc = mySystem->cycles(); int cyc = mySystem->cycles();
int targetPC = myCpuDebug->pc() + 3; // return address int targetPC = myCpuDebug->pc() + 3; // return address
// mySystem->unlockDataBus(); unlockState();
unlockState();
myOSystem->console().mediaSource().updateScanlineByTrace(targetPC); myOSystem->console().mediaSource().updateScanlineByTrace(targetPC);
// mySystem->lockDataBus(); lockState();
lockState();
return mySystem->cycles() - cyc; 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) void Debugger::nextScanline(int lines)
{ {
saveOldState(); saveOldState();
// mySystem->unlockDataBus();
unlockState(); unlockState();
myTiaOutput->advanceScanline(lines); myTiaOutput->advanceScanline(lines);
// mySystem->lockDataBus();
lockState(); lockState();
} }
@ -849,10 +846,9 @@ void Debugger::nextScanline(int lines)
void Debugger::nextFrame(int frames) void Debugger::nextFrame(int frames)
{ {
saveOldState(); saveOldState();
// mySystem->unlockDataBus();
unlockState(); unlockState();
myTiaOutput->advance(frames); myTiaOutput->advance(frames);
// mySystem->lockDataBus();
lockState(); lockState();
} }
@ -953,7 +949,6 @@ void Debugger::saveOldState()
void Debugger::setStartState() void Debugger::setStartState()
{ {
// Lock the bus each time the debugger is entered, so we don't disturb anything // Lock the bus each time the debugger is entered, so we don't disturb anything
// mySystem->lockDataBus();
lockState(); lockState();
} }
@ -961,7 +956,6 @@ void Debugger::setStartState()
void Debugger::setQuitState() void Debugger::setQuitState()
{ {
// Bus must be unlocked for normal operation when leaving debugger mode // Bus must be unlocked for normal operation when leaving debugger mode
// mySystem->unlockDataBus();
unlockState(); unlockState();
// execute one instruction on quit. If we're // execute one instruction on quit. If we're

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef CARTRIDGE_HXX
@ -34,7 +34,7 @@ class Settings;
game and handles any bankswitching performed by the cartridge. game and handles any bankswitching performed by the cartridge.
@author Bradford W. Mott @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 class Cartridge : public Device
{ {
@ -77,8 +77,8 @@ class Cartridge : public Device
/** /**
Lock/unlock bankswitching capability. Lock/unlock bankswitching capability.
*/ */
void lockBank() { bankLocked = true; } void lockBank() { myBankLocked = true; }
void unlockBank() { bankLocked = false; } void unlockBank() { myBankLocked = false; }
public: public:
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
@ -143,9 +143,9 @@ class Cartridge : public Device
virtual string name() const = 0; virtual string name() const = 0;
protected: 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. // by the debugger, when disassembling/dumping ROM.
bool bankLocked; bool myBankLocked;
private: private:
/** /**

View File

@ -145,7 +145,7 @@ void Cartridge0840::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge0840::bank(uInt16 bank) void Cartridge0840::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank = bank; myCurrentBank = bank;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -136,7 +136,7 @@ void Cartridge3E::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3E::bank(uInt16 bank) void Cartridge3E::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
if(bank < 256) if(bank < 256)
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -117,7 +117,7 @@ void Cartridge3F::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3F::bank(uInt16 bank) void Cartridge3F::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Make sure the bank they're asking for is reasonable // Make sure the bank they're asking for is reasonable
if((uInt32)bank * 2048 < mySize) if((uInt32)bank * 2048 < mySize)

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -120,7 +120,7 @@ uInt8 Cartridge4A50::peek(uInt16 address)
else if((address & 0x1f00) == 0x1f00) // 256B region from 0x1f00 - 0x1fff else if((address & 0x1f00) == 0x1f00) // 256B region from 0x1f00 - 0x1fff
{ {
value = myImage[(address & 0xff) + 0x1ff00]; value = myImage[(address & 0xff) + 0x1ff00];
if(((myLastData & 0xe0) == 0x60) && if(!myBankLocked && ((myLastData & 0xe0) == 0x60) &&
((myLastAddress >= 0x1000) || (myLastAddress < 0x200))) ((myLastAddress >= 0x1000) || (myLastAddress < 0x200)))
mySliceHigh = (mySliceHigh & 0xf0ff) | ((address & 0x8) << 8) | mySliceHigh = (mySliceHigh & 0xf0ff) | ((address & 0x8) << 8) |
((address & 0x70) << 4); ((address & 0x70) << 4);
@ -166,7 +166,7 @@ void Cartridge4A50::poke(uInt16 address, uInt8 value)
} }
else if((address & 0x1f00) == 0x1f00) // 256B region at 0x1f00 - 0x1fff else if((address & 0x1f00) == 0x1f00) // 256B region at 0x1f00 - 0x1fff
{ {
if(((myLastData & 0xe0) == 0x60) && if(!myBankLocked && ((myLastData & 0xe0) == 0x60) &&
((myLastAddress >= 0x1000) || (myLastAddress < 0x200))) ((myLastAddress >= 0x1000) || (myLastAddress < 0x200)))
mySliceHigh = (mySliceHigh & 0xf0ff) | ((address & 0x8) << 8) | mySliceHigh = (mySliceHigh & 0xf0ff) | ((address & 0x8) << 8) |
((address & 0x70) << 4); ((address & 0x70) << 4);
@ -179,6 +179,8 @@ void Cartridge4A50::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4A50::checkBankSwitch(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 // This scheme contains so many hotspots that it's easier to just check
// all of them // all of them
if(((myLastData & 0xe0) == 0x60) && // Switch lower/middle/upper bank if(((myLastData & 0xe0) == 0x60) && // Switch lower/middle/upper bank
@ -293,7 +295,8 @@ int Cartridge4A50::bank()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Cartridge4A50::bankCount() 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) uInt8* Cartridge4A50::getImage(int& size)
{ {
size = 0; // TODO size = 131072;
return 0; return &myImage[0];
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge4A50::save(Serializer& out) const bool Cartridge4A50::save(Serializer& out) const
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -423,7 +423,7 @@ void CartridgeAR::loadIntoRAM(uInt8 load)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeAR::bank(uInt16 bank) void CartridgeAR::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
bankConfiguration(bank); bankConfiguration(bank);
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -423,7 +423,7 @@ void CartridgeDPC::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDPC::bank(uInt16 bank) void CartridgeDPC::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank = bank; myCurrentBank = bank;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -87,20 +87,18 @@ uInt8 CartridgeE0::peek(uInt16 address)
{ {
address = address & 0x0FFF; address = address & 0x0FFF;
if(!bankLocked) { // Switch banks if necessary
// Switch banks if necessary if((address >= 0x0FE0) && (address <= 0x0FE7))
if((address >= 0x0FE0) && (address <= 0x0FE7)) {
{ segmentZero(address & 0x0007);
segmentZero(address & 0x0007); }
} else if((address >= 0x0FE8) && (address <= 0x0FEF))
else if((address >= 0x0FE8) && (address <= 0x0FEF)) {
{ segmentOne(address & 0x0007);
segmentOne(address & 0x0007); }
} else if((address >= 0x0FF0) && (address <= 0x0FF7))
else if((address >= 0x0FF0) && (address <= 0x0FF7)) {
{ segmentTwo(address & 0x0007);
segmentTwo(address & 0x0007);
}
} }
return myImage[(myCurrentSlice[address >> 10] << 10) + (address & 0x03FF)]; return myImage[(myCurrentSlice[address >> 10] << 10) + (address & 0x03FF)];
@ -111,26 +109,26 @@ void CartridgeE0::poke(uInt16 address, uInt8)
{ {
address = address & 0x0FFF; address = address & 0x0FFF;
if(!bankLocked) { // Switch banks if necessary
// Switch banks if necessary if((address >= 0x0FE0) && (address <= 0x0FE7))
if((address >= 0x0FE0) && (address <= 0x0FE7)) {
{ segmentZero(address & 0x0007);
segmentZero(address & 0x0007); }
} else if((address >= 0x0FE8) && (address <= 0x0FEF))
else if((address >= 0x0FE8) && (address <= 0x0FEF)) {
{ segmentOne(address & 0x0007);
segmentOne(address & 0x0007); }
} else if((address >= 0x0FF0) && (address <= 0x0FF7))
else if((address >= 0x0FF0) && (address <= 0x0FF7)) {
{ segmentTwo(address & 0x0007);
segmentTwo(address & 0x0007);
}
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE0::segmentZero(uInt16 slice) void CartridgeE0::segmentZero(uInt16 slice)
{ {
if(myBankLocked) return;
// Remember the new slice // Remember the new slice
myCurrentSlice[0] = slice; myCurrentSlice[0] = slice;
uInt16 offset = slice << 10; uInt16 offset = slice << 10;
@ -151,6 +149,8 @@ void CartridgeE0::segmentZero(uInt16 slice)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE0::segmentOne(uInt16 slice) void CartridgeE0::segmentOne(uInt16 slice)
{ {
if(myBankLocked) return;
// Remember the new slice // Remember the new slice
myCurrentSlice[1] = slice; myCurrentSlice[1] = slice;
uInt16 offset = slice << 10; uInt16 offset = slice << 10;
@ -171,6 +171,8 @@ void CartridgeE0::segmentOne(uInt16 slice)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE0::segmentTwo(uInt16 slice) void CartridgeE0::segmentTwo(uInt16 slice)
{ {
if(myBankLocked) return;
// Remember the new slice // Remember the new slice
myCurrentSlice[2] = slice; myCurrentSlice[2] = slice;
uInt16 offset = slice << 10; 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() int CartridgeE0::bank()
{ {
// FIXME - get this working, so we can debug E0 carts // Doesn't support bankswitching in the normal sense
return 0; return 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeE0::bankCount() int CartridgeE0::bankCount()
{ {
// FIXME - get this working, so we can debug E0 carts // Doesn't support bankswitching in the normal sense
return 1; return 1;
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -163,7 +163,7 @@ void CartridgeE7::bankRAM(uInt16 bank)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE7::bank(uInt16 slice) void CartridgeE7::bank(uInt16 slice)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentSlice[0] = slice; myCurrentSlice[0] = slice;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -97,7 +97,7 @@ void CartridgeF4::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4::bank(uInt16 bank) void CartridgeF4::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank = bank; myCurrentBank = bank;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -127,7 +127,7 @@ void CartridgeF4SC::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4SC::bank(uInt16 bank) void CartridgeF4SC::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank = bank; myCurrentBank = bank;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -140,7 +140,7 @@ void CartridgeF6::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6::bank(uInt16 bank) void CartridgeF6::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank = bank; myCurrentBank = bank;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -171,7 +171,7 @@ void CartridgeF6SC::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6SC::bank(uInt16 bank) void CartridgeF6SC::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank = bank; myCurrentBank = bank;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -122,7 +122,7 @@ void CartridgeF8::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF8::bank(uInt16 bank) void CartridgeF8::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank = bank; myCurrentBank = bank;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -98,23 +98,21 @@ uInt8 CartridgeF8SC::peek(uInt16 address)
{ {
address = address & 0x0FFF; address = address & 0x0FFF;
if(!bankLocked) { // Switch banks if necessary
// Switch banks if necessary switch(address)
switch(address) {
{ case 0x0FF8:
case 0x0FF8: // Set the current bank to the lower 4k bank
// Set the current bank to the lower 4k bank bank(0);
bank(0); break;
break;
case 0x0FF9: case 0x0FF9:
// Set the current bank to the upper 4k bank // Set the current bank to the upper 4k bank
bank(1); bank(1);
break; break;
default: default:
break; break;
}
} }
// NOTE: This does not handle accessing RAM, however, this function // NOTE: This does not handle accessing RAM, however, this function
@ -128,23 +126,21 @@ void CartridgeF8SC::poke(uInt16 address, uInt8)
{ {
address = address & 0x0FFF; address = address & 0x0FFF;
if(!bankLocked) { // Switch banks if necessary
// Switch banks if necessary switch(address)
switch(address) {
{ case 0x0FF8:
case 0x0FF8: // Set the current bank to the lower 4k bank
// Set the current bank to the lower 4k bank bank(0);
bank(0); break;
break;
case 0x0FF9: case 0x0FF9:
// Set the current bank to the upper 4k bank // Set the current bank to the upper 4k bank
bank(1); bank(1);
break; break;
default: default:
break; break;
}
} }
// NOTE: This does not handle accessing RAM, however, this function // 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) void CartridgeF8SC::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank = bank; myCurrentBank = bank;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -167,7 +167,7 @@ void CartridgeFASC::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFASC::bank(uInt16 bank) void CartridgeFASC::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank = bank; myCurrentBank = bank;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -92,7 +92,7 @@ void CartridgeMB::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeMB::incbank() void CartridgeMB::incbank()
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank ++; myCurrentBank ++;
@ -118,7 +118,7 @@ void CartridgeMB::incbank()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeMB::bank(uInt16 bank) void CartridgeMB::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
myCurrentBank = (bank - 1); myCurrentBank = (bank - 1);
incbank(); incbank();

View File

@ -123,7 +123,7 @@ void CartridgeSB::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeSB::bank(uInt16 bank) void CartridgeSB::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank = bank; myCurrentBank = bank;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -132,7 +132,7 @@ void CartridgeUA::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeUA::bank(uInt16 bank) void CartridgeUA::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank = bank; myCurrentBank = bank;

View File

@ -116,13 +116,12 @@ void CartridgeX07::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeX07::bank(uInt16 bank) void CartridgeX07::bank(uInt16 bank)
{ {
if(bankLocked) return; if(myBankLocked) return;
// Remember what bank we're in // Remember what bank we're in
myCurrentBank = (bank & 0x0f); myCurrentBank = (bank & 0x0f);
uInt32 offset = myCurrentBank * 4096; uInt32 offset = myCurrentBank * 4096;
uInt16 shift = mySystem->pageShift(); uInt16 shift = mySystem->pageShift();
// uInt16 mask = mySystem->pageMask();
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
@ -158,7 +157,6 @@ bool CartridgeX07::patch(uInt16 address, uInt8 value)
return true; return true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeX07::getImage(int& size) uInt8* CartridgeX07::getImage(int& size)
{ {

View File

@ -14,7 +14,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <sstream> #include <sstream>
@ -1875,15 +1875,18 @@ bool EventHandler::enterDebugMode()
if(myState == S_DEBUGGER) if(myState == S_DEBUGGER)
return false; 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); setEventState(S_DEBUGGER);
myOSystem->createFrameBuffer(); myOSystem->createFrameBuffer();
myOverlay->reStack(); myOverlay->reStack();
myOSystem->frameBuffer().setCursorState(); myOSystem->frameBuffer().setCursorState();
myOSystem->sound().mute(true); myOSystem->sound().mute(true);
myEvent->clear(); myEvent->clear();
// Make sure debugger starts in a consistent state
myOSystem->debugger().setStartState();
#else #else
myOSystem->frameBuffer().showMessage("Debugger unsupported"); myOSystem->frameBuffer().showMessage("Debugger unsupported");
#endif #endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <assert.h> #include <assert.h>
@ -35,7 +35,8 @@ System::System(uInt16 n, uInt16 m)
myM6502(0), myM6502(0),
myTIA(0), myTIA(0),
myCycles(0), myCycles(0),
myDataBusState(0) myDataBusState(0),
myDataBusLocked(false)
{ {
// Make sure the arguments are reasonable // Make sure the arguments are reasonable
assert((1 <= m) && (m <= n) && (n <= 16)); assert((1 <= m) && (m <= n) && (n <= 16));