mirror of https://github.com/stella-emu/stella.git
savestate and loadstate commands for the debugger, which do the same thing
as the regular emulator F9 and F11 save/load state. Will add the debugger state to the statefile in future. "Frying" support, using Fred Quimby's code from [stella]. Press Backspace during emulation (or slam it repeatedly like you would the power button on a real 2600). So far I've been able to duplicate the classic frying effects from Space Invaders (double shots) and H.E.R.O. (infinite lives). Also added a "fry" command to the debugger, but it's not very useful (you need visual feedback when trying to duplicate a known effect, so the emulator should be running). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@575 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
0dd6f51378
commit
b500522dda
|
@ -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.37 2005-06-27 15:07:40 urchlay Exp $
|
||||
// $Id: Debugger.cxx,v 1.38 2005-06-28 03:34:40 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -371,6 +371,18 @@ void Debugger::quit()
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::saveState(int state)
|
||||
{
|
||||
myOSystem->eventHandler().saveState(state);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::loadState(int state)
|
||||
{
|
||||
myOSystem->eventHandler().loadState(state);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int Debugger::step()
|
||||
{
|
||||
|
@ -716,3 +728,9 @@ const char *Debugger::getCartType() {
|
|||
bool Debugger::patchROM(int addr, int value) {
|
||||
return myConsole->cartridge().patch(addr, value);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::fry() {
|
||||
for (int ZPmem=0; ZPmem<255; ZPmem += rand() % 4)
|
||||
mySystem->poke(ZPmem, mySystem->peek(ZPmem) & (uInt8)rand() % 256);
|
||||
}
|
||||
|
|
|
@ -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.34 2005-06-27 15:07:42 urchlay Exp $
|
||||
// $Id: Debugger.hxx,v 1.35 2005-06-28 03:34:40 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_HXX
|
||||
|
@ -51,7 +51,7 @@ enum {
|
|||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Debugger.hxx,v 1.34 2005-06-27 15:07:42 urchlay Exp $
|
||||
@version $Id: Debugger.hxx,v 1.35 2005-06-28 03:34:40 urchlay Exp $
|
||||
*/
|
||||
class Debugger : public DialogContainer
|
||||
{
|
||||
|
@ -235,6 +235,9 @@ class Debugger : public DialogContainer
|
|||
int getBank();
|
||||
const char *getCartType();
|
||||
bool patchROM(int addr, int value);
|
||||
void saveState(int state);
|
||||
void loadState(int state);
|
||||
void fry();
|
||||
|
||||
protected:
|
||||
Console* myConsole;
|
||||
|
|
|
@ -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: DebuggerParser.cxx,v 1.40 2005-06-28 01:53:41 urchlay Exp $
|
||||
// $Id: DebuggerParser.cxx,v 1.41 2005-06-28 03:34:40 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -137,6 +137,14 @@ Command DebuggerParser::commands[] = {
|
|||
&DebuggerParser::executeFrame
|
||||
},
|
||||
|
||||
{
|
||||
"fry",
|
||||
"\"Fry\" console (randomly corrupt memory)",
|
||||
false,
|
||||
{ kARG_END_ARGS },
|
||||
&DebuggerParser::executeFry
|
||||
},
|
||||
|
||||
// TODO: height command
|
||||
|
||||
{
|
||||
|
@ -171,6 +179,14 @@ Command DebuggerParser::commands[] = {
|
|||
&DebuggerParser::executeListwatches
|
||||
},
|
||||
|
||||
{
|
||||
"loadstate",
|
||||
"Load emulator state (0-9)",
|
||||
true,
|
||||
{ kARG_BYTE, kARG_END_ARGS },
|
||||
&DebuggerParser::executeLoadstate
|
||||
},
|
||||
|
||||
{
|
||||
"loadsym",
|
||||
"Load symbol file",
|
||||
|
@ -259,6 +275,14 @@ Command DebuggerParser::commands[] = {
|
|||
&DebuggerParser::executeSaveses
|
||||
},
|
||||
|
||||
{
|
||||
"savestate",
|
||||
"Save emulator state (valid args 0-9)",
|
||||
true,
|
||||
{ kARG_BYTE, kARG_END_ARGS },
|
||||
&DebuggerParser::executeSavestate
|
||||
},
|
||||
|
||||
{
|
||||
"savesym",
|
||||
"Save symbols to file",
|
||||
|
@ -1056,6 +1080,11 @@ void DebuggerParser::executeFrame() {
|
|||
if(count != 1) commandResult += "s";
|
||||
}
|
||||
|
||||
// "fry"
|
||||
void DebuggerParser::executeFry() {
|
||||
debugger->fry();
|
||||
}
|
||||
|
||||
// "listbreaks"
|
||||
void DebuggerParser::executeListbreaks() {
|
||||
commandResult = listBreaks();
|
||||
|
@ -1072,6 +1101,16 @@ void DebuggerParser::executeListwatches() {
|
|||
commandResult = "command not yet implemented (sorry)";
|
||||
}
|
||||
|
||||
// "loadstate"
|
||||
void DebuggerParser::executeLoadstate() {
|
||||
if(args[0] >= 0 && args[0] <= 9) {
|
||||
debugger->loadState(args[0]);
|
||||
commandResult = "state loaded";
|
||||
} else {
|
||||
commandResult = "invalid slot (must be 0-9)";
|
||||
}
|
||||
}
|
||||
|
||||
// "loadsym"
|
||||
void DebuggerParser::executeLoadsym() {
|
||||
commandResult = debugger->equateList->loadFile(argStrings[0]);
|
||||
|
@ -1150,6 +1189,16 @@ void DebuggerParser::executeSaveses() {
|
|||
commandResult = "I/O error";
|
||||
}
|
||||
|
||||
// "savestate"
|
||||
void DebuggerParser::executeSavestate() {
|
||||
if(args[0] >= 0 && args[0] <= 9) {
|
||||
debugger->saveState(args[0]);
|
||||
commandResult = "state saved";
|
||||
} else {
|
||||
commandResult = "invalid slot (must be 0-9)";
|
||||
}
|
||||
}
|
||||
|
||||
// "savesym"
|
||||
void DebuggerParser::executeSavesym() {
|
||||
if(debugger->equateList->saveFile(argStrings[0]))
|
||||
|
|
|
@ -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: DebuggerParser.hxx,v 1.21 2005-06-27 15:07:45 urchlay Exp $
|
||||
// $Id: DebuggerParser.hxx,v 1.22 2005-06-28 03:34:40 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_PARSER_HXX
|
||||
|
@ -100,11 +100,13 @@ class DebuggerParser
|
|||
void executeDisasm();
|
||||
void executeDump();
|
||||
void executeFrame();
|
||||
void executeFry();
|
||||
void executeHelp();
|
||||
void executeListbreaks();
|
||||
void executeListtraps();
|
||||
void executeListwatches();
|
||||
void executeLoadsym();
|
||||
void executeLoadstate();
|
||||
void executeN();
|
||||
void executePc();
|
||||
void executePrint();
|
||||
|
@ -115,6 +117,7 @@ class DebuggerParser
|
|||
void executeRun();
|
||||
void executeS();
|
||||
void executeSaveses();
|
||||
void executeSavestate();
|
||||
void executeSavesym();
|
||||
void executeStep();
|
||||
void executeTia();
|
||||
|
|
|
@ -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: Event.hxx,v 1.11 2005-06-16 01:11:27 stephena Exp $
|
||||
// $Id: Event.hxx,v 1.12 2005-06-28 03:34:41 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef EVENT_HXX
|
||||
|
@ -25,7 +25,7 @@ class Event;
|
|||
|
||||
/**
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Event.hxx,v 1.11 2005-06-16 01:11:27 stephena Exp $
|
||||
@version $Id: Event.hxx,v 1.12 2005-06-28 03:34:41 urchlay Exp $
|
||||
*/
|
||||
class Event
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ class Event
|
|||
DrivingOneFire,
|
||||
|
||||
ChangeState, LoadState, SaveState, TakeSnapshot, Pause, Quit,
|
||||
MenuMode, DebuggerMode, LauncherMode,
|
||||
MenuMode, DebuggerMode, LauncherMode, Fry,
|
||||
|
||||
LastType
|
||||
};
|
||||
|
|
|
@ -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.76 2005-06-23 14:33:11 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.77 2005-06-28 03:34:41 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -842,6 +842,10 @@ void EventHandler::handleEvent(Event::Type event, Int32 state)
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if(myState == S_EMULATE && event == Event::Fry)
|
||||
{
|
||||
myOSystem->debugger().fry();
|
||||
}
|
||||
else if(event == Event::Quit)
|
||||
{
|
||||
myQuitFlag = true;
|
||||
|
@ -1104,6 +1108,7 @@ void EventHandler::setDefaultKeymap()
|
|||
myKeyTable[ SDLK_TAB ] = Event::MenuMode;
|
||||
myKeyTable[ SDLK_BACKQUOTE ] = Event::DebuggerMode;
|
||||
myKeyTable[ SDLK_ESCAPE ] = Event::LauncherMode;
|
||||
myKeyTable[ SDLK_BACKSPACE ] = Event::Fry;
|
||||
|
||||
saveKeyMapping();
|
||||
}
|
||||
|
@ -1194,6 +1199,13 @@ void EventHandler::saveState()
|
|||
myOSystem->frameBuffer().showMessage(buf.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::saveState(int state)
|
||||
{
|
||||
myLSState = state;
|
||||
saveState();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::changeState()
|
||||
{
|
||||
|
@ -1231,6 +1243,13 @@ void EventHandler::loadState()
|
|||
myOSystem->frameBuffer().showMessage(buf.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::loadState(int state)
|
||||
{
|
||||
myLSState = state;
|
||||
loadState();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::takeSnapshot()
|
||||
{
|
||||
|
|
|
@ -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.hxx,v 1.40 2005-06-16 01:11:27 stephena Exp $
|
||||
// $Id: EventHandler.hxx,v 1.41 2005-06-28 03:34:41 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef EVENTHANDLER_HXX
|
||||
|
@ -74,7 +74,7 @@ struct Stella_Joystick {
|
|||
mapping can take place.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: EventHandler.hxx,v 1.40 2005-06-16 01:11:27 stephena Exp $
|
||||
@version $Id: EventHandler.hxx,v 1.41 2005-06-28 03:34:41 urchlay Exp $
|
||||
*/
|
||||
class EventHandler
|
||||
{
|
||||
|
@ -172,6 +172,16 @@ class EventHandler
|
|||
*/
|
||||
inline void quit() { handleEvent(Event::Quit, 1); }
|
||||
|
||||
/**
|
||||
Save state to explicit state number (debugger uses this)
|
||||
*/
|
||||
void saveState(int state);
|
||||
|
||||
/**
|
||||
Load state from explicit state number (debugger uses this)
|
||||
*/
|
||||
void loadState(int state);
|
||||
|
||||
/**
|
||||
Sets the mouse to act as paddle 'num'
|
||||
|
||||
|
|
Loading…
Reference in New Issue