patch() methods for various Cart classes. Still a work in progress,

but we can now change ROM from the debugger on a good chunk of the games
out there.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@571 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-06-27 23:40:36 +00:00
parent ec0accd4a2
commit 8aeb65d4b7
12 changed files with 81 additions and 18 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: Cart2K.cxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
// $Id: Cart2K.cxx,v 1.5 2005-06-27 23:40:35 urchlay Exp $
//============================================================================
#include <assert.h>
@ -83,6 +83,13 @@ void Cartridge2K::poke(uInt16, uInt8)
// This is ROM so poking has no effect :-)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge2K::patch(uInt16 address, uInt8 value)
{
myImage[address & 0x07FF] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge2K::save(Serializer& out)
{

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: Cart2K.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
// $Id: Cart2K.hxx,v 1.5 2005-06-27 23:40:35 urchlay Exp $
//============================================================================
#ifndef CARTRIDGE2K_HXX
@ -33,7 +33,7 @@ class Deserializer;
2600's 4K cartridge addressing space.
@author Bradford W. Mott
@version $Id: Cart2K.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
@version $Id: Cart2K.hxx,v 1.5 2005-06-27 23:40:35 urchlay Exp $
*/
class Cartridge2K : public Cartridge
{
@ -103,6 +103,8 @@ class Cartridge2K : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
private:
// The 2k ROM image for the cartridge
uInt8 myImage[2048];

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: Cart3F.cxx,v 1.6 2005-06-27 12:43:48 urchlay Exp $
// $Id: Cart3F.cxx,v 1.7 2005-06-27 23:40:35 urchlay Exp $
//============================================================================
#include <assert.h>
@ -118,6 +118,21 @@ void Cartridge3F::poke(uInt16 address, uInt8 value)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3F::patch(uInt16 address, uInt8 value)
{
address = address & 0x0FFF;
if(address < 0x0800)
{
myImage[(address & 0x07FF) + myCurrentBank * 2048] = value;
}
else
{
myImage[(address & 0x07FF) + mySize - 2048] = value;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3F::bank(uInt16 bank)
{

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: Cart3F.hxx,v 1.5 2005-06-27 12:43:48 urchlay Exp $
// $Id: Cart3F.hxx,v 1.6 2005-06-27 23:40:35 urchlay Exp $
//============================================================================
#ifndef CARTRIDGE3F_HXX
@ -37,7 +37,7 @@ class Deserializer;
only used 8K this bankswitching scheme supports up to 512K.
@author Bradford W. Mott
@version $Id: Cart3F.hxx,v 1.5 2005-06-27 12:43:48 urchlay Exp $
@version $Id: Cart3F.hxx,v 1.6 2005-06-27 23:40:35 urchlay Exp $
*/
class Cartridge3F : public Cartridge
{
@ -108,6 +108,8 @@ class Cartridge3F : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Map the specified bank into the first segment

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: CartAR.cxx,v 1.8 2005-06-27 12:43:48 urchlay Exp $
// $Id: CartAR.cxx,v 1.9 2005-06-27 23:40:35 urchlay Exp $
//============================================================================
#include <assert.h>
@ -197,6 +197,13 @@ void CartridgeAR::poke(uInt16 addr, uInt8)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeAR::patch(uInt16 address, uInt8 value)
{
// myImage[address & 0x0FFF] = value;
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeAR::bankConfiguration(uInt8 configuration)
{

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: CartAR.hxx,v 1.6 2005-06-27 12:43:49 urchlay Exp $
// $Id: CartAR.hxx,v 1.7 2005-06-27 23:40:35 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEAR_HXX
@ -37,7 +37,7 @@ class Deserializer;
and one bank of ROM. All 6K of the RAM can be read and written.
@author Bradford W. Mott
@version $Id: CartAR.hxx,v 1.6 2005-06-27 12:43:49 urchlay Exp $
@version $Id: CartAR.hxx,v 1.7 2005-06-27 23:40:35 urchlay Exp $
*/
class CartridgeAR : public Cartridge
{
@ -115,6 +115,8 @@ class CartridgeAR : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Install pages for the specified bank in the system

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: CartCV.cxx,v 1.6 2005-06-16 00:55:57 stephena Exp $
// $Id: CartCV.cxx,v 1.7 2005-06-27 23:40:35 urchlay Exp $
//============================================================================
#include <assert.h>
@ -131,6 +131,13 @@ void CartridgeCV::poke(uInt16, uInt8)
// This is ROM so poking has no effect :-)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCV::patch(uInt16 address, uInt8 value)
{
myImage[address & 0x07FF] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCV::save(Serializer& out)
{

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: CartCV.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
// $Id: CartCV.hxx,v 1.5 2005-06-27 23:40:36 urchlay Exp $
//============================================================================
#ifndef CARTRIDGECV_HXX
@ -35,7 +35,7 @@ class Deserializer;
$F800-$FFFF ROM
@author Eckhard Stolberg
@version $Id: CartCV.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
@version $Id: CartCV.hxx,v 1.5 2005-06-27 23:40:36 urchlay Exp $
*/
class CartridgeCV : public Cartridge
{
@ -105,6 +105,8 @@ class CartridgeCV : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
private:
// The 2k ROM image for the cartridge
uInt8 myImage[2048];

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: CartF6.cxx,v 1.5 2005-06-16 00:55:57 stephena Exp $
// $Id: CartF6.cxx,v 1.6 2005-06-27 23:40:36 urchlay Exp $
//============================================================================
#include <assert.h>
@ -143,6 +143,14 @@ void CartridgeF6::poke(uInt16 address, uInt8)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6::patch(uInt16 address, uInt8 value)
{
address = address & 0x0FFF;
myImage[myCurrentBank * 4096 + address] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6::bank(uInt16 bank)
{

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: CartF6.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
// $Id: CartF6.hxx,v 1.5 2005-06-27 23:40:36 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEF6_HXX
@ -31,7 +31,7 @@ class Deserializer;
are four 4K banks.
@author Bradford W. Mott
@version $Id: CartF6.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
@version $Id: CartF6.hxx,v 1.5 2005-06-27 23:40:36 urchlay Exp $
*/
class CartridgeF6 : public Cartridge
{
@ -101,6 +101,8 @@ class CartridgeF6 : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
private:
/**
Install pages for the specified bank in the system

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: CartF8.cxx,v 1.5 2005-06-27 04:45:52 urchlay Exp $
// $Id: CartF8.cxx,v 1.6 2005-06-27 23:40:36 urchlay Exp $
//============================================================================
#include <assert.h>
@ -123,6 +123,13 @@ void CartridgeF8::poke(uInt16 address, uInt8)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF8::patch(uInt16 address, uInt8 value)
{
myImage[myCurrentBank * 4096 + address] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF8::bank(uInt16 bank)
{

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: CartF8.hxx,v 1.4 2005-06-27 04:45:52 urchlay Exp $
// $Id: CartF8.hxx,v 1.5 2005-06-27 23:40:36 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEF8_HXX
@ -31,7 +31,7 @@ class Deserializer;
are two 4K banks.
@author Bradford W. Mott
@version $Id: CartF8.hxx,v 1.4 2005-06-27 04:45:52 urchlay Exp $
@version $Id: CartF8.hxx,v 1.5 2005-06-27 23:40:36 urchlay Exp $
*/
class CartridgeF8 : public Cartridge
{
@ -101,6 +101,8 @@ class CartridgeF8 : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Install pages for the specified bank in the system