mirror of https://github.com/stella-emu/stella.git
"saverom" command, to allow us to save patched ROMs.
Every cart type is going to have to support this by having a getImage() method that returns the size of and pointer to its internal ROM image array. Currently only Cartridge4K supports it, but it does work. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@700 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
ab0c70fe45
commit
70de4b2158
|
@ -54,6 +54,12 @@ What the debugger can do:
|
|||
- TIA display is updated during step/trace, so we can see our
|
||||
scanlines being drawn as it happens. This isn't 100% perfect: unlike
|
||||
a real TIA, the one in Stella only updates when it's written to.
|
||||
- Script (batch) file support, including auto-running a script file
|
||||
named after the ROM image.
|
||||
- Saving the current debugger state to a script file (including
|
||||
breakpoints, traps, etc).
|
||||
- Built-in functions for use with "breakif", to support common conditions
|
||||
(such as breaking when the user presses Game Select...)
|
||||
|
||||
Planned features for Stella 2.0 release:
|
||||
- Graphical TIA tab, with register names and GUI buttons for
|
||||
|
@ -66,10 +72,6 @@ Planned features for Stella 2.0 release:
|
|||
that aren't supported.
|
||||
- Patch ROM support for a few cart types doesn't work.
|
||||
- Some way to control joystick/etc. input from within the debugger.
|
||||
- Script (batch) file support, including auto-running a script file
|
||||
named after the ROM image.
|
||||
- Saving the current debugger state to a script file (including
|
||||
breakpoints, traps, etc).
|
||||
- Source-level debugging: if a DASM .lst file is available, we'll show
|
||||
the listing in the ROM tab instead of a disassembly. This is already
|
||||
availabe in a very crude form ("loadlist" and "list" commands).
|
||||
|
@ -78,7 +80,7 @@ Planned features for Stella 2.0 release:
|
|||
use all the CPU registers and flags in expressions (e.g. "print a+1" does
|
||||
what you expect), and the pseudo-variables "_scan" and "_bank" (which
|
||||
evaluate the the current scanline and bank number). Need to add more TIA,
|
||||
RIOT registers too.
|
||||
RIOT registers too. Also, more functions for the builtin function lib.
|
||||
|
||||
Future plans (post 2.0):
|
||||
- Possibly a mini-assembler
|
||||
|
|
|
@ -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.77 2005-07-29 16:37:17 urchlay Exp $
|
||||
// $Id: Debugger.cxx,v 1.78 2005-07-30 16:25:45 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -1006,3 +1006,11 @@ const string Debugger::builtinHelp() {
|
|||
return result;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Debugger::saveROM(string filename) {
|
||||
// TODO: error checking
|
||||
ofstream *out = new ofstream(filename.c_str(), ios::out | ios::binary);
|
||||
bool res = myConsole->cartridge().save(*out);
|
||||
delete out;
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -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.62 2005-07-29 16:37:17 urchlay Exp $
|
||||
// $Id: Debugger.hxx,v 1.63 2005-07-30 16:25:48 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_HXX
|
||||
|
@ -74,7 +74,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
|
|||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Debugger.hxx,v 1.62 2005-07-29 16:37:17 urchlay Exp $
|
||||
@version $Id: Debugger.hxx,v 1.63 2005-07-30 16:25:48 urchlay Exp $
|
||||
*/
|
||||
class Debugger : public DialogContainer
|
||||
{
|
||||
|
@ -255,6 +255,8 @@ class Debugger : public DialogContainer
|
|||
string loadListFile(string f = "");
|
||||
const string getSourceLines(int addr);
|
||||
|
||||
bool saveROM(string filename);
|
||||
|
||||
private:
|
||||
/**
|
||||
Save state of each debugger subsystem
|
||||
|
|
|
@ -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.72 2005-07-29 16:37:17 urchlay Exp $
|
||||
// $Id: DebuggerParser.cxx,v 1.73 2005-07-30 16:25:48 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -357,6 +357,14 @@ Command DebuggerParser::commands[] = {
|
|||
&DebuggerParser::executeSave
|
||||
},
|
||||
|
||||
{
|
||||
"saverom",
|
||||
"Save (possibly patched) ROM to file",
|
||||
true,
|
||||
{ kARG_FILE, kARG_END_ARGS },
|
||||
&DebuggerParser::executeSaverom
|
||||
},
|
||||
|
||||
{
|
||||
"saveses",
|
||||
"Save console session to file",
|
||||
|
@ -1525,13 +1533,20 @@ void DebuggerParser::executeS() {
|
|||
|
||||
// "save"
|
||||
void DebuggerParser::executeSave() {
|
||||
cerr << "got here" << endl;
|
||||
if(saveScriptFile(argStrings[0]))
|
||||
commandResult = "saved script to file " + argStrings[0];
|
||||
else
|
||||
commandResult = red("I/O error");
|
||||
}
|
||||
|
||||
// "saverom"
|
||||
void DebuggerParser::executeSaverom() {
|
||||
if(debugger->saveROM(argStrings[0]))
|
||||
commandResult = "saved ROM";
|
||||
else
|
||||
commandResult = red("failed to save ROM");
|
||||
}
|
||||
|
||||
// "saveses"
|
||||
void DebuggerParser::executeSaveses() {
|
||||
if(debugger->prompt()->saveBuffer(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.38 2005-07-23 19:07:15 urchlay Exp $
|
||||
// $Id: DebuggerParser.hxx,v 1.39 2005-07-30 16:25:48 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_PARSER_HXX
|
||||
|
@ -134,6 +134,7 @@ class DebuggerParser
|
|||
void executeRunTo();
|
||||
void executeS();
|
||||
void executeSave();
|
||||
void executeSaverom();
|
||||
void executeSaveses();
|
||||
void executeSavestate();
|
||||
void executeSavesym();
|
||||
|
|
|
@ -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.cxx,v 1.14 2005-07-09 15:19:24 urchlay Exp $
|
||||
// $Id: Cart.cxx,v 1.15 2005-07-30 16:25:48 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -311,4 +311,25 @@ bool Cartridge::patch(uInt16 address, uInt8 value) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge::save(ofstream& out) {
|
||||
int size = -1;
|
||||
|
||||
uInt8* image = getImage(size);
|
||||
if(image == 0 || size <= 0) {
|
||||
cerr << "save not supported" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
for(int i=0; i<size; i++)
|
||||
out << image[i];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8* Cartridge::getImage(int& size) {
|
||||
size = 0;
|
||||
return 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: Cart.hxx,v 1.7 2005-07-09 15:19:24 urchlay Exp $
|
||||
// $Id: Cart.hxx,v 1.8 2005-07-30 16:25:48 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef CARTRIDGE_HXX
|
||||
|
@ -23,6 +23,7 @@ class Cartridge;
|
|||
class Properties;
|
||||
class System;
|
||||
|
||||
#include <fstream>
|
||||
#include "bspf.hxx"
|
||||
#include "Device.hxx"
|
||||
|
||||
|
@ -31,7 +32,7 @@ class System;
|
|||
game and handles any bankswitching performed by the cartridge.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Cart.hxx,v 1.7 2005-07-09 15:19:24 urchlay Exp $
|
||||
@version $Id: Cart.hxx,v 1.8 2005-07-30 16:25:48 urchlay Exp $
|
||||
*/
|
||||
class Cartridge : public Device
|
||||
{
|
||||
|
@ -62,7 +63,9 @@ class Cartridge : public Device
|
|||
virtual void bank(uInt16 b); // set bank
|
||||
virtual int bank(); // get current bank (-1 if no bankswitching supported)
|
||||
virtual int bankCount(); // count # of banks
|
||||
virtual bool patch(uInt16 address, uInt8 value);
|
||||
virtual bool patch(uInt16 address, uInt8 value); // yes, this writes to ROM
|
||||
bool save(ofstream& out); // need a way to save patched ROMs
|
||||
virtual uInt8* getImage(int& size); // save() uses this
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
|
@ -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: Cart4K.cxx,v 1.6 2005-06-27 15:07:54 urchlay Exp $
|
||||
// $Id: Cart4K.cxx,v 1.7 2005-07-30 16:25:48 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -136,3 +136,9 @@ bool Cartridge4K::load(Deserializer& in)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8* Cartridge4K::getImage(int& size) {
|
||||
size = 4096;
|
||||
return &myImage[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: Cart4K.hxx,v 1.5 2005-06-27 15:07:54 urchlay Exp $
|
||||
// $Id: Cart4K.hxx,v 1.6 2005-07-30 16:25:48 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef CARTRIDGE4K_HXX
|
||||
|
@ -32,7 +32,7 @@ class Deserializer;
|
|||
not bankswitched.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Cart4K.hxx,v 1.5 2005-06-27 15:07:54 urchlay Exp $
|
||||
@version $Id: Cart4K.hxx,v 1.6 2005-07-30 16:25:48 urchlay Exp $
|
||||
*/
|
||||
class Cartridge4K : public Cartridge
|
||||
{
|
||||
|
@ -86,6 +86,8 @@ class Cartridge4K : public Cartridge
|
|||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
|
||||
virtual uInt8* getImage(int& size);
|
||||
|
||||
public:
|
||||
/**
|
||||
Get the byte at the specified address.
|
||||
|
|
Loading…
Reference in New Issue