mirror of https://github.com/stella-emu/stella.git
Initial support for ROM patching: a "rom" command in the prompt that acts
like the "ram" command. Each Cart type needs its own patch() method to allow changing ROM. So far, only Cart4K has a working patch() method: all other cart types inherit Cartridge::patch(), which does nothing and returns false. TODO: saverom command? git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@570 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
dfdc9de1a9
commit
ec0accd4a2
|
@ -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.36 2005-06-27 04:45:35 urchlay Exp $
|
||||
// $Id: Debugger.cxx,v 1.37 2005-06-27 15:07:40 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -711,3 +711,8 @@ int Debugger::bankCount() {
|
|||
const char *Debugger::getCartType() {
|
||||
return myConsole->cartridge().name();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Debugger::patchROM(int addr, int value) {
|
||||
return myConsole->cartridge().patch(addr, value);
|
||||
}
|
||||
|
|
|
@ -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.33 2005-06-27 04:45:52 urchlay Exp $
|
||||
// $Id: Debugger.hxx,v 1.34 2005-06-27 15:07:42 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.33 2005-06-27 04:45:52 urchlay Exp $
|
||||
@version $Id: Debugger.hxx,v 1.34 2005-06-27 15:07:42 urchlay Exp $
|
||||
*/
|
||||
class Debugger : public DialogContainer
|
||||
{
|
||||
|
@ -234,6 +234,7 @@ class Debugger : public DialogContainer
|
|||
int bankCount();
|
||||
int getBank();
|
||||
const char *getCartType();
|
||||
bool patchROM(int addr, int value);
|
||||
|
||||
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.38 2005-06-27 04:45:52 urchlay Exp $
|
||||
// $Id: DebuggerParser.cxx,v 1.39 2005-06-27 15:07:43 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -227,6 +227,14 @@ Command DebuggerParser::commands[] = {
|
|||
&DebuggerParser::executeReset
|
||||
},
|
||||
|
||||
{
|
||||
"rom",
|
||||
"Change ROM contents",
|
||||
true,
|
||||
{ kARG_WORD, kARG_MULTI_BYTE },
|
||||
&DebuggerParser::executeRom
|
||||
},
|
||||
|
||||
{
|
||||
"run",
|
||||
"Exit debugger, return to emulator",
|
||||
|
@ -1103,6 +1111,21 @@ void DebuggerParser::executeReset() {
|
|||
commandResult = "reset CPU";
|
||||
}
|
||||
|
||||
// "rom"
|
||||
void DebuggerParser::executeRom() {
|
||||
int addr = args[0];
|
||||
for(int i=1; i<argCount; i++) {
|
||||
if( !(debugger->patchROM(addr++, args[i])) ) {
|
||||
commandResult = "patching ROM unsupported for this cart type";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
commandResult = "changed ";
|
||||
commandResult += debugger->valueToString( args.size() - 1 );
|
||||
commandResult += " location(s)";
|
||||
}
|
||||
|
||||
// "run"
|
||||
void DebuggerParser::executeRun() {
|
||||
debugger->quit();
|
||||
|
|
|
@ -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.20 2005-06-27 04:45:52 urchlay Exp $
|
||||
// $Id: DebuggerParser.hxx,v 1.21 2005-06-27 15:07:45 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_PARSER_HXX
|
||||
|
@ -111,6 +111,7 @@ class DebuggerParser
|
|||
void executeRam();
|
||||
void executeReload();
|
||||
void executeReset();
|
||||
void executeRom();
|
||||
void executeRun();
|
||||
void executeS();
|
||||
void executeSaveses();
|
||||
|
|
|
@ -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.10 2005-06-27 04:45:52 urchlay Exp $
|
||||
// $Id: Cart.cxx,v 1.11 2005-06-27 15:07:46 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -286,7 +286,7 @@ int Cartridge::bankCount() {
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge::patch(int address, int value) {
|
||||
bool Cartridge::patch(uInt16 address, uInt8 value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.4 2005-06-27 04:45:52 urchlay Exp $
|
||||
// $Id: Cart.hxx,v 1.5 2005-06-27 15:07:54 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef CARTRIDGE_HXX
|
||||
|
@ -31,7 +31,7 @@ class System;
|
|||
game and handles any bankswitching performed by the cartridge.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Cart.hxx,v 1.4 2005-06-27 04:45:52 urchlay Exp $
|
||||
@version $Id: Cart.hxx,v 1.5 2005-06-27 15:07:54 urchlay Exp $
|
||||
*/
|
||||
class Cartridge : public Device
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ class Cartridge : public Device
|
|||
virtual int bank(); // get current bank (-1 if no bankswitching supported)
|
||||
virtual void bank(uInt16 b); // set bank
|
||||
virtual int bankCount(); // count # of banks
|
||||
virtual bool patch(int address, int value);
|
||||
virtual bool patch(uInt16 address, uInt8 value);
|
||||
|
||||
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.5 2005-06-16 00:55:57 stephena Exp $
|
||||
// $Id: Cart4K.cxx,v 1.6 2005-06-27 15:07:54 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -83,6 +83,13 @@ void Cartridge4K::poke(uInt16, uInt8)
|
|||
// This is ROM so poking has no effect :-)
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge4K::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
myImage[address & 0x0FFF] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge4K::save(Serializer& out)
|
||||
{
|
||||
|
|
|
@ -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.4 2005-06-16 00:55:57 stephena Exp $
|
||||
// $Id: Cart4K.hxx,v 1.5 2005-06-27 15:07:54 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef CARTRIDGE4K_HXX
|
||||
|
@ -32,7 +32,7 @@ class Deserializer;
|
|||
not bankswitched.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Cart4K.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
|
||||
@version $Id: Cart4K.hxx,v 1.5 2005-06-27 15:07:54 urchlay Exp $
|
||||
*/
|
||||
class Cartridge4K : public Cartridge
|
||||
{
|
||||
|
@ -102,6 +102,8 @@ class Cartridge4K : public Cartridge
|
|||
*/
|
||||
virtual void poke(uInt16 address, uInt8 value);
|
||||
|
||||
bool patch(uInt16 address, uInt8 value);
|
||||
|
||||
private:
|
||||
// The 4K ROM image for the cartridge
|
||||
uInt8 myImage[4096];
|
||||
|
|
Loading…
Reference in New Issue