Added support for informing the M6502 of the debugger, so it can call it

directly.

Updated M6502 classes to call Debugger::start when a breakpoint is hit.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@510 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-06-16 12:28:54 +00:00
parent c693074377
commit 9473ca0dd5
8 changed files with 44 additions and 16 deletions

View File

@ -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: makefile,v 1.99 2005-06-16 02:16:25 urchlay Exp $
## $Id: makefile,v 1.100 2005-06-16 12:28:53 stephena Exp $
##============================================================================
##============================================================================
@ -373,10 +373,10 @@ M6502.o: $(CORE)/m6502/src/M6502.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/M6502.cxx
M6502Low.o: $(CORE)/m6502/src/M6502Low.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/M6502Low.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/m6502/src/M6502Low.cxx
M6502Hi.o: $(CORE)/m6502/src/M6502Hi.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/M6502Hi.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/m6502/src/M6502Hi.cxx
NullDev.o: $(CORE)/m6502/src/NullDev.cxx $(CORE)/m6502/src/NullDev.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/NullDev.cxx

View File

@ -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.10 2005-06-16 02:16:25 urchlay Exp $
// $Id: Debugger.cxx,v 1.11 2005-06-16 12:28:53 stephena Exp $
//============================================================================
#include "bspf.hxx"
@ -256,6 +256,12 @@ const string Debugger::dumpTIA()
return result;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::start()
{
myOSystem->eventHandler().enterDebugMode();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::quit()
{

View File

@ -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.hxx,v 1.7 2005-06-16 02:16:25 urchlay Exp $
// $Id: Debugger.hxx,v 1.8 2005-06-16 12:28:53 stephena Exp $
//============================================================================
#ifndef DEBUGGER_HXX
@ -48,7 +48,7 @@ enum {
for all debugging operations in Stella (parser, 6502 debugger, etc).
@author Stephen Anthony
@version $Id: Debugger.hxx,v 1.7 2005-06-16 02:16:25 urchlay Exp $
@version $Id: Debugger.hxx,v 1.8 2005-06-16 12:28:53 stephena Exp $
*/
class Debugger : public DialogContainer
{
@ -124,6 +124,7 @@ class Debugger : public DialogContainer
// set a bunch of RAM locations at once
const string setRAM(int argCount, int *args);
void start();
void quit();
void trace();
void step();
@ -148,7 +149,7 @@ class Debugger : public DialogContainer
DebuggerParser* myParser;
D6502* myDebugger;
EquateList *equateList;
EquateList *equateList;
PackedBitArray *breakPoints;
};

View File

@ -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: Console.cxx,v 1.56 2005-06-16 00:55:57 stephena Exp $
// $Id: Console.cxx,v 1.57 2005-06-16 12:28:53 stephena Exp $
//============================================================================
#include <assert.h>
@ -144,6 +144,7 @@ Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
{
m6502 = new M6502High(1);
}
m6502->attach(myOSystem->debugger());
M6532* m6532 = new M6532(*this);
TIA* tia = new TIA(*this, myOSystem->settings());

View File

@ -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: M6502.cxx,v 1.5 2005-06-16 02:16:26 urchlay Exp $
// $Id: M6502.cxx,v 1.6 2005-06-16 12:28:54 stephena Exp $
//============================================================================
#include "M6502.hxx"
@ -22,6 +22,7 @@
M6502::M6502(uInt32 systemCyclesPerProcessorCycle)
: myExecutionStatus(0),
mySystem(0),
myDebugger(0),
mySystemCyclesPerProcessorCycle(systemCyclesPerProcessorCycle)
{
uInt16 t;
@ -54,6 +55,13 @@ void M6502::install(System& system)
mySystem = &system;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6502::attach(Debugger& debugger)
{
// Remember the debugger for this microprocessor
myDebugger = &debugger;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6502::reset()
{

View File

@ -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: M6502.hxx,v 1.4 2005-06-16 02:16:26 urchlay Exp $
// $Id: M6502.hxx,v 1.5 2005-06-16 12:28:54 stephena Exp $
//============================================================================
#ifndef M6502_HXX
@ -23,6 +23,7 @@ class D6502;
class M6502;
class Serializer;
class Deserializer;
class Debugger;
#include "bspf.hxx"
#include "System.hxx"
@ -34,7 +35,7 @@ class Deserializer;
has a 64K addressing space.
@author Bradford W. Mott
@version $Id: M6502.hxx,v 1.4 2005-06-16 02:16:26 urchlay Exp $
@version $Id: M6502.hxx,v 1.5 2005-06-16 12:28:54 stephena Exp $
*/
class M6502
{
@ -79,6 +80,13 @@ class M6502
*/
virtual void install(System& system);
/**
Attach the specified debugger.
@param debugger The debugger to attach to the microprocessor.
*/
void attach(Debugger& debugger);
public:
/**
Reset the processor to its power-on state. This method should not
@ -224,6 +232,9 @@ class M6502
/// Pointer to the system the processor is installed in or the null pointer
System* mySystem;
/// Pointer to the debugger for this processor or the null pointer
Debugger* myDebugger;
/// Indicates the number of system cycles per processor cycle
const uInt32 mySystemCyclesPerProcessorCycle;
@ -247,4 +258,3 @@ class M6502
static const char* ourInstructionMnemonicTable[256];
};
#endif

View File

@ -13,12 +13,13 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: M6502Hi.cxx,v 1.4 2005-06-16 02:16:26 urchlay Exp $
// $Id: M6502Hi.cxx,v 1.5 2005-06-16 12:28:54 stephena Exp $
//============================================================================
#include "M6502Hi.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include "Debugger.hxx"
#define debugStream cout
@ -76,7 +77,7 @@ bool M6502High::execute(uInt32 number)
if(breakPoints != NULL)
{
if(breakPoints->isSet(PC))
cerr << "hit breakpoint at " << PC << endl;
myDebugger->start();
}
#ifdef DEBUG

View File

@ -13,12 +13,13 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: M6502Low.cxx,v 1.4 2005-06-16 02:16:26 urchlay Exp $
// $Id: M6502Low.cxx,v 1.5 2005-06-16 12:28:54 stephena Exp $
//============================================================================
#include "M6502Low.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include "Debugger.hxx"
#define debugStream cout
@ -62,7 +63,7 @@ bool M6502Low::execute(uInt32 number)
if(breakPoints != NULL)
{
if(breakPoints->isSet(PC))
cerr << "hit breakpoint at " << PC << endl;
myDebugger->start();
}
#ifdef DEBUG