diff --git a/stella/src/emucore/Cart.cxx b/stella/src/emucore/Cart.cxx index eaff3707d..e727a0a66 100644 --- a/stella/src/emucore/Cart.cxx +++ b/stella/src/emucore/Cart.cxx @@ -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.11 2005-06-27 15:07:46 urchlay Exp $ +// $Id: Cart.cxx,v 1.12 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -271,13 +271,13 @@ Cartridge& Cartridge::operator = (const Cartridge&) // doesn't support bankswitching at all. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int Cartridge::bank() { - return 0; +void Cartridge::bank(uInt16 b) { + // do nothing. } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Cartridge::bank(uInt16 b) { - // do nothing. +int Cartridge::bank() { + return 0; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/Cart.hxx b/stella/src/emucore/Cart.hxx index af61cbfbf..0d7170a5f 100644 --- a/stella/src/emucore/Cart.hxx +++ b/stella/src/emucore/Cart.hxx @@ -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.5 2005-06-27 15:07:54 urchlay Exp $ +// $Id: Cart.hxx,v 1.6 2005-06-28 01:15:17 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.5 2005-06-27 15:07:54 urchlay Exp $ + @version $Id: Cart.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $ */ class Cartridge : public Device { @@ -59,8 +59,8 @@ class Cartridge : public Device */ virtual ~Cartridge(); - virtual int bank(); // get current bank (-1 if no bankswitching supported) 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); diff --git a/stella/src/emucore/CartDPC.cxx b/stella/src/emucore/CartDPC.cxx index a241ad4a7..712bf7435 100644 --- a/stella/src/emucore/CartDPC.cxx +++ b/stella/src/emucore/CartDPC.cxx @@ -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: CartDPC.cxx,v 1.10 2005-06-16 00:55:57 stephena Exp $ +// $Id: CartDPC.cxx,v 1.11 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -422,6 +422,14 @@ void CartridgeDPC::poke(uInt16 address, uInt8 value) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartridgeDPC::patch(uInt16 address, uInt8 value) +{ + address = address & 0x0FFF; + myProgramImage[myCurrentBank * 4096 + address] = value; + return true; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeDPC::bank(uInt16 bank) { @@ -445,6 +453,17 @@ void CartridgeDPC::bank(uInt16 bank) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeDPC::bank() { + return myCurrentBank; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeDPC::bankCount() { + return 2; // TODO: support the display ROM somehow +} + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeDPC::save(Serializer& out) { diff --git a/stella/src/emucore/CartDPC.hxx b/stella/src/emucore/CartDPC.hxx index 8f04286d6..b9a919e9a 100644 --- a/stella/src/emucore/CartDPC.hxx +++ b/stella/src/emucore/CartDPC.hxx @@ -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: CartDPC.hxx,v 1.5 2005-06-16 00:55:57 stephena Exp $ +// $Id: CartDPC.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #ifndef CARTRIDGEDCP_HXX @@ -32,7 +32,7 @@ class Deserializer; see David P. Crane's United States Patent Number 4,644,495. @author Bradford W. Mott - @version $Id: CartDPC.hxx,v 1.5 2005-06-16 00:55:57 stephena Exp $ + @version $Id: CartDPC.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeDPC : public Cartridge { @@ -109,13 +109,17 @@ class CartridgeDPC : public Cartridge */ virtual void poke(uInt16 address, uInt8 value); - private: /** Install pages for the specified bank in the system @param bank The bank that should be installed in the system */ void bank(uInt16 bank); + int bank(); // get current bank (-1 if no bankswitching supported) + int bankCount(); // count # of banks + bool patch(uInt16 address, uInt8 value); + + private: /** Clocks the random number generator to move it to its next state diff --git a/stella/src/emucore/CartE0.cxx b/stella/src/emucore/CartE0.cxx index 1a60af052..935374c9a 100644 --- a/stella/src/emucore/CartE0.cxx +++ b/stella/src/emucore/CartE0.cxx @@ -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: CartE0.cxx,v 1.5 2005-06-16 00:55:57 stephena Exp $ +// $Id: CartE0.cxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -132,6 +132,13 @@ void CartridgeE0::poke(uInt16 address, uInt8) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartridgeE0::patch(uInt16 address, uInt8 value) +{ + myImage[(myCurrentSlice[address >> 10] << 10) + (address & 0x03FF)] = value; + return true; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeE0::segmentZero(uInt16 slice) { diff --git a/stella/src/emucore/CartE0.hxx b/stella/src/emucore/CartE0.hxx index 6014a9cc9..efa28a96b 100644 --- a/stella/src/emucore/CartE0.hxx +++ b/stella/src/emucore/CartE0.hxx @@ -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: CartE0.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $ +// $Id: CartE0.hxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #ifndef CARTRIDGEE0_HXX @@ -36,7 +36,7 @@ class Deserializer; always points to the last 1K of the ROM image. @author Bradford W. Mott - @version $Id: CartE0.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $ + @version $Id: CartE0.hxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeE0 : public Cartridge { @@ -106,6 +106,8 @@ class CartridgeE0 : public Cartridge */ virtual void poke(uInt16 address, uInt8 value); + bool patch(uInt16 address, uInt8 value); + private: /** Install the specified slice for segment zero diff --git a/stella/src/emucore/CartE7.cxx b/stella/src/emucore/CartE7.cxx index 4afc59c6e..e0be44325 100644 --- a/stella/src/emucore/CartE7.cxx +++ b/stella/src/emucore/CartE7.cxx @@ -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: CartE7.cxx,v 1.7 2005-06-27 12:43:49 urchlay Exp $ +// $Id: CartE7.cxx,v 1.8 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -137,6 +137,13 @@ void CartridgeE7::poke(uInt16 address, uInt8) // way page accessing has been setup } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartridgeE7::patch(uInt16 address, uInt8 value) +{ + myImage[(myCurrentSlice[address >> 11] << 11) + (address & 0x07FF)] = value; + return true; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeE7::bank(uInt16 slice) { diff --git a/stella/src/emucore/CartE7.hxx b/stella/src/emucore/CartE7.hxx index 8f82ad2dc..a31fa5f6a 100644 --- a/stella/src/emucore/CartE7.hxx +++ b/stella/src/emucore/CartE7.hxx @@ -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: CartE7.hxx,v 1.5 2005-06-27 12:43:49 urchlay Exp $ +// $Id: CartE7.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #ifndef CARTRIDGEE7_HXX @@ -53,7 +53,7 @@ class Deserializer; here by accessing 1FF8 to 1FFB. @author Bradford W. Mott - @version $Id: CartE7.hxx,v 1.5 2005-06-27 12:43:49 urchlay Exp $ + @version $Id: CartE7.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeE7 : public Cartridge { @@ -123,6 +123,8 @@ class CartridgeE7 : public Cartridge */ virtual void poke(uInt16 address, uInt8 value); + bool patch(uInt16 address, uInt8 value); + /** Map the specfied bank into the first segment diff --git a/stella/src/emucore/CartF4.cxx b/stella/src/emucore/CartF4.cxx index 4866279cc..320c440f9 100644 --- a/stella/src/emucore/CartF4.cxx +++ b/stella/src/emucore/CartF4.cxx @@ -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: CartF4.cxx,v 1.3 2005-06-16 00:55:57 stephena Exp $ +// $Id: CartF4.cxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -102,6 +102,14 @@ void CartridgeF4::poke(uInt16 address, uInt8) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartridgeF4::patch(uInt16 address, uInt8 value) +{ + address = address & 0x0FFF; + myImage[myCurrentBank * 4096 + address] = value; + return true; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF4::bank(uInt16 bank) { @@ -125,6 +133,16 @@ void CartridgeF4::bank(uInt16 bank) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeF4::bank() { + return myCurrentBank; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeF4::bankCount() { + return 8; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF4::save(Serializer& out) { diff --git a/stella/src/emucore/CartF4.hxx b/stella/src/emucore/CartF4.hxx index f03a6ff68..19012962d 100644 --- a/stella/src/emucore/CartF4.hxx +++ b/stella/src/emucore/CartF4.hxx @@ -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: CartF4.hxx,v 1.3 2005-06-16 00:55:57 stephena Exp $ +// $Id: CartF4.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #ifndef CARTRIDGEF4_HXX @@ -31,7 +31,7 @@ class Deserializer; are eight 4K banks. @author Bradford W. Mott - @version $Id: CartF4.hxx,v 1.3 2005-06-16 00:55:57 stephena Exp $ + @version $Id: CartF4.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeF4 : public Cartridge { @@ -101,7 +101,8 @@ class CartridgeF4 : public Cartridge */ virtual void poke(uInt16 address, uInt8 value); - private: + bool patch(uInt16 address, uInt8 value); + /** Install pages for the specified bank in the system @@ -109,6 +110,10 @@ class CartridgeF4 : public Cartridge */ void bank(uInt16 bank); + int bank(); + + int bankCount(); + private: // Indicates which bank is currently active uInt16 myCurrentBank; diff --git a/stella/src/emucore/CartF4SC.cxx b/stella/src/emucore/CartF4SC.cxx index 1cb3d552e..0be7a92bf 100644 --- a/stella/src/emucore/CartF4SC.cxx +++ b/stella/src/emucore/CartF4SC.cxx @@ -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: CartF4SC.cxx,v 1.5 2005-06-16 00:55:57 stephena Exp $ +// $Id: CartF4SC.cxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -132,6 +132,14 @@ void CartridgeF4SC::poke(uInt16 address, uInt8) // has been setup } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartridgeF4SC::patch(uInt16 address, uInt8 value) +{ + address = address & 0x0FFF; + myImage[myCurrentBank * 4096 + address] = value; + return true; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF4SC::bank(uInt16 bank) { @@ -155,6 +163,16 @@ void CartridgeF4SC::bank(uInt16 bank) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeF4SC::bank() { + return myCurrentBank; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeF4SC::bankCount() { + return 8; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF4SC::save(Serializer& out) { diff --git a/stella/src/emucore/CartF4SC.hxx b/stella/src/emucore/CartF4SC.hxx index c8db6008d..ad4aaa984 100644 --- a/stella/src/emucore/CartF4SC.hxx +++ b/stella/src/emucore/CartF4SC.hxx @@ -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: CartF4SC.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $ +// $Id: CartF4SC.hxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #ifndef CARTRIDGEF4SC_HXX @@ -31,7 +31,7 @@ class Deserializer; 128 bytes of RAM. There are eight 4K banks. @author Bradford W. Mott - @version $Id: CartF4SC.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $ + @version $Id: CartF4SC.hxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeF4SC : public Cartridge { @@ -101,7 +101,8 @@ class CartridgeF4SC : public Cartridge */ virtual void poke(uInt16 address, uInt8 value); - private: + bool patch(uInt16 address, uInt8 value); + /** Install pages for the specified bank in the system @@ -109,6 +110,9 @@ class CartridgeF4SC : public Cartridge */ void bank(uInt16 bank); + int bank(); + int bankCount(); + private: // Indicates which bank is currently active uInt16 myCurrentBank; diff --git a/stella/src/emucore/CartF6.cxx b/stella/src/emucore/CartF6.cxx index 6b544847f..302dac4cb 100644 --- a/stella/src/emucore/CartF6.cxx +++ b/stella/src/emucore/CartF6.cxx @@ -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.6 2005-06-27 23:40:36 urchlay Exp $ +// $Id: CartF6.cxx,v 1.7 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -174,6 +174,16 @@ void CartridgeF6::bank(uInt16 bank) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeF6::bank() { + return myCurrentBank; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeF6::bankCount() { + return 4; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF6::save(Serializer& out) { diff --git a/stella/src/emucore/CartF6.hxx b/stella/src/emucore/CartF6.hxx index dd99ad85a..0fa5e8c52 100644 --- a/stella/src/emucore/CartF6.hxx +++ b/stella/src/emucore/CartF6.hxx @@ -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.5 2005-06-27 23:40:36 urchlay Exp $ +// $Id: CartF6.hxx,v 1.6 2005-06-28 01:15:17 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.5 2005-06-27 23:40:36 urchlay Exp $ + @version $Id: CartF6.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeF6 : public Cartridge { @@ -103,7 +103,6 @@ class CartridgeF6 : public Cartridge bool patch(uInt16 address, uInt8 value); - private: /** Install pages for the specified bank in the system @@ -111,6 +110,9 @@ class CartridgeF6 : public Cartridge */ void bank(uInt16 bank); + int bank(); + int bankCount(); + private: // Indicates which bank is currently active uInt16 myCurrentBank; diff --git a/stella/src/emucore/CartF6SC.cxx b/stella/src/emucore/CartF6SC.cxx index a46a3b11e..1cd765980 100644 --- a/stella/src/emucore/CartF6SC.cxx +++ b/stella/src/emucore/CartF6SC.cxx @@ -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: CartF6SC.cxx,v 1.5 2005-06-16 00:55:57 stephena Exp $ +// $Id: CartF6SC.cxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -176,6 +176,14 @@ void CartridgeF6SC::poke(uInt16 address, uInt8) // has been setup } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartridgeF6SC::patch(uInt16 address, uInt8 value) +{ + address = address & 0x0FFF; + myImage[myCurrentBank * 4096 + address] = value; + return true; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF6SC::bank(uInt16 bank) { @@ -199,6 +207,16 @@ void CartridgeF6SC::bank(uInt16 bank) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeF6SC::bank() { + return myCurrentBank; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeF6SC::bankCount() { + return 4; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF6SC::save(Serializer& out) { diff --git a/stella/src/emucore/CartF6SC.hxx b/stella/src/emucore/CartF6SC.hxx index e2c3dc275..5e5f5e2eb 100644 --- a/stella/src/emucore/CartF6SC.hxx +++ b/stella/src/emucore/CartF6SC.hxx @@ -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: CartF6SC.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $ +// $Id: CartF6SC.hxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #ifndef CARTRIDGEF6SC_HXX @@ -31,7 +31,7 @@ class Deserializer; 128 bytes of RAM. There are four 4K banks. @author Bradford W. Mott - @version $Id: CartF6SC.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $ + @version $Id: CartF6SC.hxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeF6SC : public Cartridge { @@ -101,7 +101,8 @@ class CartridgeF6SC : public Cartridge */ virtual void poke(uInt16 address, uInt8 value); - private: + bool patch(uInt16 address, uInt8 value); + /** Install pages for the specified bank in the system @@ -109,6 +110,9 @@ class CartridgeF6SC : public Cartridge */ void bank(uInt16 bank); + int bank(); + int bankCount(); + private: // Indicates which bank is currently active uInt16 myCurrentBank; diff --git a/stella/src/emucore/CartF8SC.cxx b/stella/src/emucore/CartF8SC.cxx index a5ce9e246..c9d374daa 100644 --- a/stella/src/emucore/CartF8SC.cxx +++ b/stella/src/emucore/CartF8SC.cxx @@ -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: CartF8SC.cxx,v 1.4 2005-06-16 01:11:26 stephena Exp $ +// $Id: CartF8SC.cxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -156,6 +156,24 @@ void CartridgeF8SC::poke(uInt16 address, uInt8) // has been setup } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeF8SC::bank() { + return myCurrentBank; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeF8SC::bankCount() { + return 2; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartridgeF8SC::patch(uInt16 address, uInt8 value) +{ + address = address & 0x0FFF; + myImage[myCurrentBank * 4096 + address] = value; + return true; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF8SC::bank(uInt16 bank) { diff --git a/stella/src/emucore/CartF8SC.hxx b/stella/src/emucore/CartF8SC.hxx index c791320f0..b2318215d 100644 --- a/stella/src/emucore/CartF8SC.hxx +++ b/stella/src/emucore/CartF8SC.hxx @@ -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: CartF8SC.hxx,v 1.3 2005-06-16 01:11:26 stephena Exp $ +// $Id: CartF8SC.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #ifndef CARTRIDGEF8SC_HXX @@ -31,7 +31,7 @@ class Deserializer; 128 bytes of RAM. There are two 4K banks. @author Bradford W. Mott - @version $Id: CartF8SC.hxx,v 1.3 2005-06-16 01:11:26 stephena Exp $ + @version $Id: CartF8SC.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeF8SC : public Cartridge { @@ -101,7 +101,8 @@ class CartridgeF8SC : public Cartridge */ virtual void poke(uInt16 address, uInt8 value); - private: + bool patch(uInt16 address, uInt8 value); + /** Install pages for the specified bank in the system @@ -109,6 +110,10 @@ class CartridgeF8SC : public Cartridge */ void bank(uInt16 bank); + int bank(); + + int bankCount(); + private: // Indicates which bank is currently active uInt16 myCurrentBank; diff --git a/stella/src/emucore/CartFASC.cxx b/stella/src/emucore/CartFASC.cxx index 3936a79aa..ab8336fb5 100644 --- a/stella/src/emucore/CartFASC.cxx +++ b/stella/src/emucore/CartFASC.cxx @@ -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: CartFASC.cxx,v 1.4 2005-06-16 01:11:27 stephena Exp $ +// $Id: CartFASC.cxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -166,6 +166,14 @@ void CartridgeFASC::poke(uInt16 address, uInt8) // has been setup } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartridgeFASC::patch(uInt16 address, uInt8 value) +{ + address = address & 0x0FFF; + myImage[myCurrentBank * 4096 + address] = value; + return true; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeFASC::bank(uInt16 bank) { @@ -189,6 +197,16 @@ void CartridgeFASC::bank(uInt16 bank) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeFASC::bank() { + return myCurrentBank; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeFASC::bankCount() { + return 3; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeFASC::save(Serializer& out) { diff --git a/stella/src/emucore/CartFASC.hxx b/stella/src/emucore/CartFASC.hxx index b512bfa3b..2fcaeb626 100644 --- a/stella/src/emucore/CartFASC.hxx +++ b/stella/src/emucore/CartFASC.hxx @@ -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: CartFASC.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $ +// $Id: CartFASC.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #ifndef CARTRIDGEFASC_HXX @@ -31,7 +31,7 @@ class Deserializer; three 4K banks and 256 bytes of RAM. @author Bradford W. Mott - @version $Id: CartFASC.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $ + @version $Id: CartFASC.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeFASC : public Cartridge { @@ -101,7 +101,8 @@ class CartridgeFASC : public Cartridge */ virtual void poke(uInt16 address, uInt8 value); - private: + bool patch(uInt16 address, uInt8 value); + /** Install pages for the specified bank in the system @@ -109,6 +110,9 @@ class CartridgeFASC : public Cartridge */ void bank(uInt16 bank); + int bank(); + int bankCount(); + private: // Indicates which bank is currently active uInt16 myCurrentBank; diff --git a/stella/src/emucore/CartFE.cxx b/stella/src/emucore/CartFE.cxx index 25f64b5a1..6f08c520c 100644 --- a/stella/src/emucore/CartFE.cxx +++ b/stella/src/emucore/CartFE.cxx @@ -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: CartFE.cxx,v 1.3 2005-06-16 01:11:27 stephena Exp $ +// $Id: CartFE.cxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -82,6 +82,13 @@ void CartridgeFE::poke(uInt16, uInt8) { } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartridgeFE::patch(uInt16 address, uInt8 value) +{ + myImage[(address & 0x0FFF) + (((address & 0x2000) == 0) ? 4096 : 0)] = value; + return true; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeFE::save(Serializer& out) { diff --git a/stella/src/emucore/CartFE.hxx b/stella/src/emucore/CartFE.hxx index 2a157c335..16ed9b5bf 100644 --- a/stella/src/emucore/CartFE.hxx +++ b/stella/src/emucore/CartFE.hxx @@ -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: CartFE.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $ +// $Id: CartFE.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #ifndef CARTRIDGEFE_HXX @@ -43,7 +43,7 @@ class Deserializer; monitoring the bus. @author Bradford W. Mott - @version $Id: CartFE.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $ + @version $Id: CartFE.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeFE : public Cartridge { @@ -113,6 +113,8 @@ class CartridgeFE : public Cartridge */ virtual void poke(uInt16 address, uInt8 value); + bool patch(uInt16 address, uInt8 value); + private: // The 8K ROM image of the cartridge uInt8 myImage[8192]; diff --git a/stella/src/emucore/CartMB.cxx b/stella/src/emucore/CartMB.cxx index 1107c4f4f..4d29892cc 100644 --- a/stella/src/emucore/CartMB.cxx +++ b/stella/src/emucore/CartMB.cxx @@ -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: CartMB.cxx,v 1.4 2005-06-16 01:11:27 stephena Exp $ +// $Id: CartMB.cxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -97,6 +97,14 @@ void CartridgeMB::poke(uInt16 address, uInt8) if(address == 0x0FF0) incbank(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartridgeMB::patch(uInt16 address, uInt8 value) +{ + address = address & 0x0FFF; + myImage[myCurrentBank * 4096 + address] = value; + return true; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeMB::incbank() { @@ -121,6 +129,22 @@ void CartridgeMB::incbank() } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeMB::bank(uInt16 b) { + myCurrentBank = (b - 1); + incbank(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeMB::bank() { + return myCurrentBank; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeMB::bankCount() { + return 16; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeMB::save(Serializer& out) { diff --git a/stella/src/emucore/CartMB.hxx b/stella/src/emucore/CartMB.hxx index a3a359634..3b29aa867 100644 --- a/stella/src/emucore/CartMB.hxx +++ b/stella/src/emucore/CartMB.hxx @@ -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: CartMB.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $ +// $Id: CartMB.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #ifndef CARTRIDGEMB_HXX @@ -32,7 +32,7 @@ class Deserializer; Accessing $1FF0 switches to next bank. @author Eckhard Stolberg - @version $Id: CartMB.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $ + @version $Id: CartMB.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeMB : public Cartridge { @@ -102,6 +102,14 @@ class CartridgeMB : public Cartridge */ virtual void poke(uInt16 address, uInt8 value); + bool patch(uInt16 address, uInt8 value); + + void bank(uInt16 b); + + int bank(); + + int bankCount(); + private: /** Install pages for the next bank in the system diff --git a/stella/src/emucore/CartMC.cxx b/stella/src/emucore/CartMC.cxx index ad840bda0..ee829486b 100644 --- a/stella/src/emucore/CartMC.cxx +++ b/stella/src/emucore/CartMC.cxx @@ -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: CartMC.cxx,v 1.5 2005-06-16 01:11:27 stephena Exp $ +// $Id: CartMC.cxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -219,6 +219,13 @@ void CartridgeMC::poke(uInt16 address, uInt8 value) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartridgeMC::patch(uInt16 address, uInt8 value) +{ + // TODO: implement + return false; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeMC::save(Serializer& out) { diff --git a/stella/src/emucore/CartMC.hxx b/stella/src/emucore/CartMC.hxx index b8a6db004..7eeda12d7 100644 --- a/stella/src/emucore/CartMC.hxx +++ b/stella/src/emucore/CartMC.hxx @@ -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: CartMC.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $ +// $Id: CartMC.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #ifndef CARTRIDGEMC_HXX @@ -135,7 +135,7 @@ class Deserializer; @author Bradford W. Mott - @version $Id: CartMC.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $ + @version $Id: CartMC.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeMC : public Cartridge { @@ -208,6 +208,8 @@ class CartridgeMC : public Cartridge */ virtual void poke(uInt16 address, uInt8 value); + bool patch(uInt16 address, uInt8 value); + private: // Indicates which block is currently active for the four segments uInt8 myCurrentBlock[4]; diff --git a/stella/src/emucore/CartUA.cxx b/stella/src/emucore/CartUA.cxx index a026ae51e..762c92ffe 100644 --- a/stella/src/emucore/CartUA.cxx +++ b/stella/src/emucore/CartUA.cxx @@ -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: CartUA.cxx,v 1.3 2005-06-16 00:55:57 stephena Exp $ +// $Id: CartUA.cxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #include @@ -137,6 +137,15 @@ void CartridgeUA::poke(uInt16 address, uInt8 value) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartridgeUA::patch(uInt16 address, uInt8 value) +{ + address &= 0x0fff; + myImage[myCurrentBank * 4096] = value; + bank(myCurrentBank); // TODO: see if this is really necessary + return true; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeUA::bank(uInt16 bank) { @@ -159,6 +168,16 @@ void CartridgeUA::bank(uInt16 bank) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeUA::bank() { + return myCurrentBank; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int CartridgeUA::bankCount() { + return 2; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeUA::save(Serializer& out) { diff --git a/stella/src/emucore/CartUA.hxx b/stella/src/emucore/CartUA.hxx index 1ebf6ee9e..5cfe258cd 100644 --- a/stella/src/emucore/CartUA.hxx +++ b/stella/src/emucore/CartUA.hxx @@ -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: CartUA.hxx,v 1.2 2005-06-16 00:55:57 stephena Exp $ +// $Id: CartUA.hxx,v 1.3 2005-06-28 01:15:17 urchlay Exp $ //============================================================================ #ifndef CARTRIDGEUA_HXX @@ -32,7 +32,7 @@ class Deserializer; are two 4K banks. @author Bradford W. Mott - @version $Id: CartUA.hxx,v 1.2 2005-06-16 00:55:57 stephena Exp $ + @version $Id: CartUA.hxx,v 1.3 2005-06-28 01:15:17 urchlay Exp $ */ class CartridgeUA : public Cartridge { @@ -102,7 +102,8 @@ class CartridgeUA : public Cartridge */ virtual void poke(uInt16 address, uInt8 value); - private: + bool patch(uInt16 address, uInt8 value); + /** Install pages for the specified bank in the system @@ -110,6 +111,10 @@ class CartridgeUA : public Cartridge */ void bank(uInt16 bank); + int bank(); + + int bankCount(); + private: // Indicates which bank is currently active uInt16 myCurrentBank;