mirror of https://github.com/stella-emu/stella.git
First pass at getting '--disable-developer' configure option to work.
It's still broken; just not as much as before. So you should still compile in debugger support for now. This will probably involve moving around some classes in the codebase, such as all GUI related classes used by the debugger will go in 'debugger/gui'. Sorry for any inconvenience this may cause, but the debugger support has almost doubled the size of the executable, and there are some platforms that can neither use it nor deal with its overhead. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@740 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
2370bb9764
commit
ed135b1aa5
|
@ -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.65 2005-07-03 01:36:40 urchlay Exp $
|
||||
// $Id: Console.cxx,v 1.66 2005-08-24 22:54:30 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -45,13 +45,16 @@
|
|||
#include "FrameBuffer.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "Menu.hxx"
|
||||
#include "Debugger.hxx"
|
||||
#include "Version.hxx"
|
||||
|
||||
#ifdef SNAPSHOT_SUPPORT
|
||||
#include "Snapshot.hxx"
|
||||
#endif
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
#include "Debugger.hxx"
|
||||
#endif
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
|
||||
: myOSystem(osystem)
|
||||
|
@ -137,7 +140,9 @@ Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
|
|||
|
||||
M6502* m6502;
|
||||
m6502 = new M6502High(1);
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
m6502->attach(myOSystem->debugger());
|
||||
#endif
|
||||
|
||||
M6532* m6532 = new M6532(*this);
|
||||
TIA *tia = new TIA(*this, myOSystem->settings());
|
||||
|
@ -185,9 +190,11 @@ Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
|
|||
myOSystem->menu().initialize();
|
||||
myOSystem->menu().setGameProfile(myProperties);
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
// Finally, initialize the debugging system, since it depends on the current ROM
|
||||
myOSystem->debugger().setConsole(this);
|
||||
myOSystem->debugger().initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -374,7 +381,6 @@ void Console::fry()
|
|||
mySystem->poke(ZPmem, mySystem->peek(ZPmem) & (uInt8)rand() % 256);
|
||||
}
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Console::changeXStart(const uInt32 direction)
|
||||
{
|
||||
|
@ -612,5 +618,3 @@ void Console::setDeveloperProperties()
|
|||
if(s != "")
|
||||
myProperties.set("Emulation.HmoveBlanks", s);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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.hxx,v 1.37 2005-07-02 17:15:42 urchlay Exp $
|
||||
// $Id: Console.hxx,v 1.38 2005-08-24 22:54:30 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef CONSOLE_HXX
|
||||
|
@ -37,7 +37,7 @@ class System;
|
|||
This class represents the entire game console.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Console.hxx,v 1.37 2005-07-02 17:15:42 urchlay Exp $
|
||||
@version $Id: Console.hxx,v 1.38 2005-08-24 22:54:30 stephena Exp $
|
||||
*/
|
||||
class Console
|
||||
{
|
||||
|
@ -172,7 +172,6 @@ class Console
|
|||
*/
|
||||
void fry();
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
public:
|
||||
/**
|
||||
Change the "Display.XStart" variable. Currently, a system reset is issued
|
||||
|
@ -220,7 +219,6 @@ class Console
|
|||
private:
|
||||
void toggleTIABit(TIA::TIABit bit, const string& bitname, bool show = true);
|
||||
void setDeveloperProperties();
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Pointer to the osystem object
|
||||
|
|
|
@ -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: EventHandler.cxx,v 1.85 2005-08-11 19:12:38 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.86 2005-08-24 22:54:30 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -30,10 +30,13 @@
|
|||
#include "OSystem.hxx"
|
||||
#include "Menu.hxx"
|
||||
#include "Launcher.hxx"
|
||||
#include "Debugger.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
#include "Debugger.hxx"
|
||||
#endif
|
||||
|
||||
#ifdef SNAPSHOT_SUPPORT
|
||||
#include "Snapshot.hxx"
|
||||
#endif
|
||||
|
@ -171,9 +174,11 @@ void EventHandler::refreshDisplay()
|
|||
myOSystem->launcher().refresh();
|
||||
break;
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
case S_DEBUGGER:
|
||||
myOSystem->debugger().refresh();
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -630,9 +635,11 @@ void EventHandler::poll(uInt32 time)
|
|||
myOSystem->launcher().updateTime(time);
|
||||
break;
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
case S_DEBUGGER:
|
||||
myOSystem->debugger().updateTime(time);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -679,6 +686,7 @@ void EventHandler::handleKeyEvent(int unicode, SDLKey key, SDLMod mod, uInt8 sta
|
|||
myOSystem->launcher().handleKeyEvent(unicode, key, mod, state);
|
||||
break;
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
case S_DEBUGGER:
|
||||
if(myKeyTable[key] == Event::DebuggerMode && state == 1 &&
|
||||
!(kbdAlt(mod) || kbdControl(mod) || kbdShift(mod)))
|
||||
|
@ -688,8 +696,9 @@ void EventHandler::handleKeyEvent(int unicode, SDLKey key, SDLMod mod, uInt8 sta
|
|||
}
|
||||
myOSystem->debugger().handleKeyEvent(unicode, key, mod, state);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case S_NONE:
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
@ -726,11 +735,13 @@ void EventHandler::handleMouseMotionEvent(SDL_Event& event)
|
|||
myOSystem->launcher().handleMouseMotionEvent(x, y, 0);
|
||||
break;
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
case S_DEBUGGER:
|
||||
myOSystem->debugger().handleMouseMotionEvent(x, y, 0);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case S_NONE:
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
@ -784,8 +795,10 @@ void EventHandler::handleMouseButtonEvent(SDL_Event& event, uInt8 state)
|
|||
myOSystem->menu().handleMouseButtonEvent(button, x, y, state);
|
||||
else if(myState == S_LAUNCHER)
|
||||
myOSystem->launcher().handleMouseButtonEvent(button, x, y, state);
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
else
|
||||
myOSystem->debugger().handleMouseButtonEvent(button, x, y, state);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -813,11 +826,13 @@ void EventHandler::handleJoyEvent(uInt8 stick, uInt32 code, uInt8 state)
|
|||
myOSystem->launcher().handleJoyEvent(stick, code, state);
|
||||
break;
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
case S_DEBUGGER:
|
||||
myOSystem->debugger().handleJoyEvent(stick, code, state);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case S_NONE:
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
@ -1366,6 +1381,7 @@ void EventHandler::leaveMenuMode()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool EventHandler::enterDebugMode()
|
||||
{
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
if(myState == S_DEBUGGER)
|
||||
return false;
|
||||
|
||||
|
@ -1384,6 +1400,7 @@ bool EventHandler::enterDebugMode()
|
|||
// Make sure screen is always refreshed when entering debug mode
|
||||
// (sometimes entering on a breakpoint doesn't draw contents)
|
||||
refreshDisplay();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1391,6 +1408,7 @@ bool EventHandler::enterDebugMode()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::leaveDebugMode()
|
||||
{
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
// paranoia: this should never happen:
|
||||
if(myState != S_DEBUGGER)
|
||||
return;
|
||||
|
@ -1406,6 +1424,7 @@ void EventHandler::leaveDebugMode()
|
|||
|
||||
if(myPauseFlag) // Un-Pause when leaving debugger mode
|
||||
handleEvent(Event::Pause, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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: FrameBuffer.cxx,v 1.62 2005-08-24 05:29:59 markgrebe Exp $
|
||||
// $Id: FrameBuffer.cxx,v 1.63 2005-08-24 22:54:30 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -29,8 +29,12 @@
|
|||
#include "GuiUtils.hxx"
|
||||
#include "Menu.hxx"
|
||||
#include "Launcher.hxx"
|
||||
#include "Debugger.hxx"
|
||||
#include "OSystem.hxx"
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
#include "Debugger.hxx"
|
||||
#endif
|
||||
|
||||
#ifdef MAC_OSX
|
||||
extern "C" {
|
||||
uInt16 macOSXDisplayWidth(void);
|
||||
|
@ -213,13 +217,15 @@ void FrameBuffer::update()
|
|||
break; // S_LAUNCHER
|
||||
}
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
case EventHandler::S_DEBUGGER:
|
||||
{
|
||||
myOSystem->debugger().draw();
|
||||
break; // S_DEBUGGER
|
||||
}
|
||||
#endif
|
||||
|
||||
case EventHandler::S_NONE:
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -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: OSystem.cxx,v 1.31 2005-08-24 01:07:36 stephena Exp $
|
||||
// $Id: OSystem.cxx,v 1.32 2005-08-24 22:54:30 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -34,13 +34,16 @@
|
|||
#include "SoundSDL.hxx"
|
||||
#endif
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
#include "Debugger.hxx"
|
||||
#endif
|
||||
|
||||
#include "FSNode.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "PropsSet.hxx"
|
||||
#include "EventHandler.hxx"
|
||||
#include "Menu.hxx"
|
||||
#include "Launcher.hxx"
|
||||
#include "Debugger.hxx"
|
||||
#include "Font.hxx"
|
||||
#include "StellaFont.hxx"
|
||||
#include "ConsoleFont.hxx"
|
||||
|
@ -66,7 +69,9 @@ OSystem::OSystem()
|
|||
// Create menu and launcher GUI objects
|
||||
myMenu = new Menu(this);
|
||||
myLauncher = new Launcher(this);
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
myDebugger = new Debugger(this);
|
||||
#endif
|
||||
|
||||
// Create fonts to draw text
|
||||
myFont = new GUI::Font(GUI::stellaDesc);
|
||||
|
@ -97,10 +102,13 @@ OSystem::~OSystem()
|
|||
|
||||
delete myMenu;
|
||||
delete myLauncher;
|
||||
delete myDebugger;
|
||||
delete myFont;
|
||||
delete myConsoleFont;
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
delete myDebugger;
|
||||
#endif
|
||||
|
||||
// Remove any game console that is currently attached
|
||||
delete myConsole;
|
||||
|
||||
|
@ -220,11 +228,13 @@ cout << " ==> video: " << video << endl;
|
|||
myLauncher->initializeVideo();
|
||||
break; // S_LAUNCHER
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
case EventHandler::S_DEBUGGER:
|
||||
myDebugger->initializeVideo();
|
||||
break; // S_DEBUGGER
|
||||
#endif
|
||||
|
||||
case EventHandler::S_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -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: OSystem.hxx,v 1.26 2005-08-10 12:23:42 stephena Exp $
|
||||
// $Id: OSystem.hxx,v 1.27 2005-08-24 22:54:30 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef OSYSTEM_HXX
|
||||
|
@ -42,7 +42,7 @@ class Debugger;
|
|||
other objects belong.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: OSystem.hxx,v 1.26 2005-08-10 12:23:42 stephena Exp $
|
||||
@version $Id: OSystem.hxx,v 1.27 2005-08-24 22:54:30 stephena Exp $
|
||||
*/
|
||||
class OSystem
|
||||
{
|
||||
|
@ -135,20 +135,14 @@ class OSystem
|
|||
*/
|
||||
Launcher& launcher(void) const { return *myLauncher; }
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
/**
|
||||
Get the ROM debugger of the system.
|
||||
|
||||
@return The debugger object
|
||||
*/
|
||||
Debugger& debugger(void) const { return *myDebugger; }
|
||||
|
||||
/**
|
||||
Get the TIA debugger of the system.
|
||||
|
||||
@return The debugger object
|
||||
I can't make this compile, weird header dependencies
|
||||
*/
|
||||
//TIADebug& tiaDebug(void) const { return *myDebugger->tiaDebug(); }
|
||||
#endif
|
||||
|
||||
/**
|
||||
Get the font object of the system
|
||||
|
|
|
@ -13,25 +13,30 @@
|
|||
// 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.13 2005-08-11 19:12:38 stephena Exp $
|
||||
// $Id: M6502.cxx,v 1.14 2005-08-24 22:54:30 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "M6502.hxx"
|
||||
#include "Expression.hxx"
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
#include "Expression.hxx"
|
||||
#endif
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
M6502::M6502(uInt32 systemCyclesPerProcessorCycle)
|
||||
: myExecutionStatus(0),
|
||||
mySystem(0),
|
||||
myDebugger(0),
|
||||
mySystemCyclesPerProcessorCycle(systemCyclesPerProcessorCycle)
|
||||
{
|
||||
uInt16 t;
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
myDebugger = NULL;
|
||||
breakPoints = NULL;
|
||||
readTraps = NULL;
|
||||
writeTraps = NULL;
|
||||
readTraps = NULL;
|
||||
writeTraps = NULL;
|
||||
#endif
|
||||
|
||||
// Compute the BCD lookup table
|
||||
uInt16 t;
|
||||
for(t = 0; t < 256; ++t)
|
||||
{
|
||||
ourBCDTable[0][t] = ((t >> 4) * 10) + (t & 0x0f);
|
||||
|
@ -51,8 +56,10 @@ M6502::M6502(uInt32 systemCyclesPerProcessorCycle)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
M6502::~M6502()
|
||||
{
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
myBreakConds.clear();
|
||||
myBreakCondNames.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -62,13 +69,6 @@ void M6502::install(System& system)
|
|||
mySystem = &system;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6502::attach(Debugger& debugger)
|
||||
{
|
||||
// Remember the debugger for this microprocessor
|
||||
myDebugger = &debugger;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6502::reset()
|
||||
{
|
||||
|
@ -102,54 +102,6 @@ void M6502::stop()
|
|||
myExecutionStatus |= StopExecutionBit;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
unsigned int M6502::addCondBreak(Expression *e, string name)
|
||||
{
|
||||
myBreakConds.push_back(e);
|
||||
myBreakCondNames.push_back(name);
|
||||
return myBreakConds.size() - 1;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6502::delCondBreak(unsigned int brk)
|
||||
{
|
||||
if(brk < myBreakConds.size()) {
|
||||
delete myBreakConds[brk];
|
||||
myBreakConds.remove_at(brk);
|
||||
myBreakCondNames.remove_at(brk);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6502::clearCondBreaks()
|
||||
{
|
||||
for(unsigned int i=0; i<myBreakConds.size(); i++)
|
||||
delete myBreakConds[i];
|
||||
myBreakConds.clear();
|
||||
myBreakCondNames.clear();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const StringList& M6502::getCondBreakNames()
|
||||
{
|
||||
return myBreakCondNames;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int M6502::evalCondBreaks()
|
||||
{
|
||||
for(unsigned int i=0; i<myBreakConds.size(); i++) {
|
||||
Expression *e = myBreakConds[i];
|
||||
if(e->evaluate()) {
|
||||
string name = myBreakCondNames[i]; // TODO: use this
|
||||
cerr << "breakpoint due to condition: " << name << endl;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1; // no break hit
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
M6502::AddressingMode M6502::addressingMode(uInt8 opcode) const
|
||||
{
|
||||
|
@ -397,6 +349,63 @@ const char* M6502::ourInstructionMnemonicTable[256] = {
|
|||
"SED", "SBC", "nop", "isb", "nop", "SBC", "INC", "isb"
|
||||
};
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6502::attach(Debugger& debugger)
|
||||
{
|
||||
// Remember the debugger for this microprocessor
|
||||
myDebugger = &debugger;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
unsigned int M6502::addCondBreak(Expression *e, string name)
|
||||
{
|
||||
myBreakConds.push_back(e);
|
||||
myBreakCondNames.push_back(name);
|
||||
return myBreakConds.size() - 1;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6502::delCondBreak(unsigned int brk)
|
||||
{
|
||||
if(brk < myBreakConds.size()) {
|
||||
delete myBreakConds[brk];
|
||||
myBreakConds.remove_at(brk);
|
||||
myBreakCondNames.remove_at(brk);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6502::clearCondBreaks()
|
||||
{
|
||||
for(unsigned int i=0; i<myBreakConds.size(); i++)
|
||||
delete myBreakConds[i];
|
||||
myBreakConds.clear();
|
||||
myBreakCondNames.clear();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const StringList& M6502::getCondBreakNames()
|
||||
{
|
||||
return myBreakCondNames;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int M6502::evalCondBreaks()
|
||||
{
|
||||
for(unsigned int i=0; i<myBreakConds.size(); i++) {
|
||||
Expression *e = myBreakConds[i];
|
||||
if(e->evaluate()) {
|
||||
string name = myBreakCondNames[i]; // TODO: use this
|
||||
cerr << "breakpoint due to condition: " << name << endl;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1; // no break hit
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6502::setBreakPoints(PackedBitArray *bp) {
|
||||
breakPoints = bp;
|
||||
}
|
||||
|
@ -406,4 +415,4 @@ void M6502::setTraps(PackedBitArray *read, PackedBitArray *write) {
|
|||
readTraps = read;
|
||||
writeTraps = write;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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.12 2005-08-11 19:12:38 stephena Exp $
|
||||
// $Id: M6502.hxx,v 1.13 2005-08-24 22:54:30 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef M6502_HXX
|
||||
|
@ -26,10 +26,10 @@ class Deserializer;
|
|||
class Debugger;
|
||||
class CpuDebug;
|
||||
class Expression;
|
||||
class PackedBitArray;
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "System.hxx"
|
||||
#include "PackedBitArray.hxx"
|
||||
#include "Array.hxx"
|
||||
#include "StringList.hxx"
|
||||
|
||||
|
@ -41,7 +41,7 @@ typedef GUI::Array<Expression*> ExpressionList;
|
|||
has a 64K addressing space.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: M6502.hxx,v 1.12 2005-08-11 19:12:38 stephena Exp $
|
||||
@version $Id: M6502.hxx,v 1.13 2005-08-24 22:54:30 stephena Exp $
|
||||
*/
|
||||
class M6502
|
||||
{
|
||||
|
@ -86,14 +86,6 @@ 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
|
||||
be invoked until the entire 6502 system is constructed and installed
|
||||
|
@ -182,6 +174,15 @@ class M6502
|
|||
friend ostream& operator<<(ostream& out, const AddressingMode& mode);
|
||||
|
||||
public:
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
/**
|
||||
Attach the specified debugger.
|
||||
|
||||
@param debugger The debugger to attach to the microprocessor.
|
||||
*/
|
||||
void attach(Debugger& debugger);
|
||||
|
||||
// TODO - document these methods
|
||||
void setBreakPoints(PackedBitArray *bp);
|
||||
void setTraps(PackedBitArray *read, PackedBitArray *write);
|
||||
int totalInstructionCount() { return myTotalInstructionCount; }
|
||||
|
@ -191,6 +192,7 @@ class M6502
|
|||
void clearCondBreaks();
|
||||
const StringList& getCondBreakNames();
|
||||
int evalCondBreaks();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -223,10 +225,21 @@ class M6502
|
|||
bool notZ; // Z flag complement for processor status register
|
||||
bool C; // C flag for processor status register
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
/// Pointer to the debugger for this processor or the null pointer
|
||||
Debugger* myDebugger;
|
||||
|
||||
PackedBitArray *breakPoints;
|
||||
PackedBitArray *readTraps;
|
||||
PackedBitArray *writeTraps;
|
||||
|
||||
// did we just now hit a trap?
|
||||
bool justHitTrap;
|
||||
|
||||
StringList myBreakCondNames;
|
||||
ExpressionList myBreakConds;
|
||||
#endif
|
||||
|
||||
/**
|
||||
Bit fields used to indicate that certain conditions need to be
|
||||
handled such as stopping execution, fatal errors, maskable interrupts
|
||||
|
@ -248,9 +261,6 @@ 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;
|
||||
|
||||
|
@ -273,13 +283,7 @@ class M6502
|
|||
/// Table of instruction mnemonics
|
||||
static const char* ourInstructionMnemonicTable[256];
|
||||
|
||||
// did we just now hit a trap?
|
||||
bool justHitTrap;
|
||||
|
||||
int myTotalInstructionCount;
|
||||
|
||||
StringList myBreakCondNames;
|
||||
ExpressionList myBreakConds;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,13 +13,16 @@
|
|||
// 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.11 2005-07-17 02:26:50 urchlay Exp $
|
||||
// $Id: M6502Hi.cxx,v 1.12 2005-08-24 22:54:30 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "M6502Hi.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
#include "Debugger.hxx"
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
#include "Debugger.hxx"
|
||||
#endif
|
||||
|
||||
#define debugStream cout
|
||||
|
||||
|
@ -29,7 +32,10 @@ M6502High::M6502High(uInt32 systemCyclesPerProcessorCycle)
|
|||
{
|
||||
myNumberOfDistinctAccesses = 0;
|
||||
myLastAddress = 0;
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
justHitTrap = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -47,10 +53,11 @@ inline uInt8 M6502High::peek(uInt16 address)
|
|||
}
|
||||
mySystem->incrementCycles(mySystemCyclesPerProcessorCycle);
|
||||
|
||||
if(readTraps != NULL) {
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
if(readTraps != NULL)
|
||||
if(readTraps->isSet(address))
|
||||
justHitTrap = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return mySystem->peek(address);
|
||||
}
|
||||
|
@ -65,10 +72,11 @@ inline void M6502High::poke(uInt16 address, uInt8 value)
|
|||
}
|
||||
mySystem->incrementCycles(mySystemCyclesPerProcessorCycle);
|
||||
|
||||
if(writeTraps != NULL) {
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
if(writeTraps != NULL)
|
||||
if(writeTraps->isSet(address))
|
||||
justHitTrap = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
mySystem->poke(address, value);
|
||||
}
|
||||
|
@ -87,6 +95,7 @@ bool M6502High::execute(uInt32 number)
|
|||
uInt16 operandAddress = 0;
|
||||
uInt8 operand = 0;
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
if(justHitTrap)
|
||||
{
|
||||
if(myDebugger->start()) {
|
||||
|
@ -110,6 +119,7 @@ bool M6502High::execute(uInt32 number)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
debugStream << "PC=" << hex << setw(4) << PC << " ";
|
||||
|
|
|
@ -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.hxx,v 1.10 2005-07-09 23:44:08 urchlay Exp $
|
||||
// $Id: System.hxx,v 1.11 2005-08-24 22:54:30 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SYSTEM_HXX
|
||||
|
@ -29,7 +29,6 @@ class Deserializer;
|
|||
#include "bspf.hxx"
|
||||
#include "Device.hxx"
|
||||
#include "NullDev.hxx"
|
||||
#include "PackedBitArray.hxx"
|
||||
|
||||
/**
|
||||
This class represents a system consisting of a 6502 microprocessor
|
||||
|
@ -48,7 +47,7 @@ class Deserializer;
|
|||
dynamic code for that page of memory.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: System.hxx,v 1.10 2005-07-09 23:44:08 urchlay Exp $
|
||||
@version $Id: System.hxx,v 1.11 2005-08-24 22:54:30 stephena Exp $
|
||||
*/
|
||||
class System
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue