diff --git a/stella/src/emucore/Cart3F.cxx b/stella/src/emucore/Cart3F.cxx index 15a1c3235..0cadadcc5 100644 --- a/stella/src/emucore/Cart3F.cxx +++ b/stella/src/emucore/Cart3F.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: Cart3F.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $ +// $Id: Cart3F.cxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -152,7 +152,6 @@ void Cartridge3F::bank(uInt16 bank) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Cartridge3F::save(Serializer& out) { - cerr << "save from Cart3F !!\n"; string cart = name(); try @@ -177,7 +176,6 @@ bool Cartridge3F::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Cartridge3F::load(Deserializer& in) { - cerr << "load from Cart3F !!\n"; string cart = name(); try diff --git a/stella/src/emucore/Cart4K.cxx b/stella/src/emucore/Cart4K.cxx index 25fb8607e..e49472f40 100644 --- a/stella/src/emucore/Cart4K.cxx +++ b/stella/src/emucore/Cart4K.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: Cart4K.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $ +// $Id: Cart4K.cxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -86,7 +86,6 @@ void Cartridge4K::poke(uInt16, uInt8) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Cartridge4K::save(Serializer& out) { - cerr << "save from Cart4K !!\n"; string cart = name(); try @@ -110,8 +109,6 @@ bool Cartridge4K::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Cartridge4K::load(Deserializer& in) { - cerr << "load from Cart4K !!\n"; - string cart = name(); try diff --git a/stella/src/emucore/CartAR.cxx b/stella/src/emucore/CartAR.cxx index 3f509e963..c81c4080d 100644 --- a/stella/src/emucore/CartAR.cxx +++ b/stella/src/emucore/CartAR.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: CartAR.cxx,v 1.3 2002-05-13 19:17:32 stephena Exp $ +// $Id: CartAR.cxx,v 1.4 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -425,13 +425,134 @@ void CartridgeAR::loadIntoRAM(uInt8 load) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeAR::save(Serializer& out) { - cerr << "save from CartAR \n"; + string cart = name(); + + try + { + uInt32 i; + + out.putString(cart); + + // Indicates the offest within the image for the corresponding bank + out.putLong(2); + for(i = 0; i < 2; ++i) + out.putLong(myImageOffset[i]); + + // The 6K of RAM and 2K of ROM contained in the Supercharger + out.putLong(8192); + for(i = 0; i < 8192; ++i) + out.putLong(myImage[i]); + + // The 256 byte header for the current 8448 byte load + out.putLong(256); + for(i = 0; i < 256; ++i) + out.putLong(myHeader[i]); + + // All of the 8448 byte loads associated with the game + // Note that the size of this array is myNumberOfLoadImages * 8448 + out.putLong(myNumberOfLoadImages * 8448); + for(i = 0; i < myNumberOfLoadImages * 8448; ++i) + out.putLong(myLoadImages[i]); + + // Indicates how many 8448 loads there are + out.putLong(myNumberOfLoadImages); + + // Indicates if the RAM is write enabled + out.putBool(myWriteEnabled); + + // Indicates if the ROM's power is on or off + out.putBool(myPower); + + // Indicates when the power was last turned on + out.putLong(myPowerRomCycle); + + // Data hold register used for writing + out.putLong(myDataHoldRegister); + + // Indicates number of distinct accesses when data hold register was set + out.putLong(myNumberOfDistinctAccesses); + + // Indicates if a write is pending or not + out.putBool(myWritePending); + } + catch(char *msg) + { + cerr << msg << endl; + return false; + } + catch(...) + { + cerr << "Unknown error in save state for " << cart << endl; + return false; + } + return true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeAR::load(Deserializer& in) { - cerr << "load from CartAR \n"; + string cart = name(); + + try + { + if(in.getString() != cart) + return false; + + uInt32 i, limit; + + // Indicates the offest within the image for the corresponding bank + limit = (uInt32) in.getLong(); + for(i = 0; i < limit; ++i) + myImageOffset[i] = (uInt32) in.getLong(); + + // The 6K of RAM and 2K of ROM contained in the Supercharger + limit = (uInt32) in.getLong(); + for(i = 0; i < limit; ++i) + myImage[i] = (uInt8) in.getLong(); + + // The 256 byte header for the current 8448 byte load + limit = (uInt32) in.getLong(); + for(i = 0; i < limit; ++i) + myHeader[i] = (uInt8) in.getLong(); + + // All of the 8448 byte loads associated with the game + // Note that the size of this array is myNumberOfLoadImages * 8448 + limit = (uInt32) in.getLong(); + for(i = 0; i < limit; ++i) + myLoadImages[i] = (uInt8) in.getLong(); + + // Indicates how many 8448 loads there are + myNumberOfLoadImages = (uInt8) in.getLong(); + + // Indicates if the RAM is write enabled + myWriteEnabled = in.getBool(); + + // Indicates if the ROM's power is on or off + myPower = in.getBool(); + + // Indicates when the power was last turned on + myPowerRomCycle = (Int32) in.getLong(); + + // Data hold register used for writing + myDataHoldRegister = (uInt8) in.getLong(); + + // Indicates number of distinct accesses when data hold register was set + myNumberOfDistinctAccesses = (uInt32) in.getLong(); + + // Indicates if a write is pending or not + myWritePending = in.getBool(); + } + catch(char *msg) + { + cerr << msg << endl; + return false; + } + catch(...) + { + cerr << "Unknown error in load state for " << cart << endl; + return false; + } + return true; } diff --git a/stella/src/emucore/CartCV.cxx b/stella/src/emucore/CartCV.cxx index d717b2363..8ee373889 100644 --- a/stella/src/emucore/CartCV.cxx +++ b/stella/src/emucore/CartCV.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: CartCV.cxx,v 1.3 2002-05-13 19:17:32 stephena Exp $ +// $Id: CartCV.cxx,v 1.4 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -134,7 +134,6 @@ void CartridgeCV::poke(uInt16, uInt8) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeCV::save(Serializer& out) { - cerr << "save from CartCV !!\n"; string cart = name(); try @@ -163,7 +162,6 @@ bool CartridgeCV::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeCV::load(Deserializer& in) { - cerr << "load from CartCV !!\n"; string cart = name(); try diff --git a/stella/src/emucore/CartDPC.cxx b/stella/src/emucore/CartDPC.cxx index d9c54b67f..9bc6b0830 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.5 2002-05-14 10:56:03 gunfight Exp $ +// $Id: CartDPC.cxx,v 1.6 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -331,14 +331,12 @@ void CartridgeDPC::bank(uInt16 bank) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeDPC::save(Serializer& out) { - uInt32 i; - - cerr << "save from CartDPC !!\n"; - - string cart = name(); + string cart = name(); try { + uInt32 i; + out.putString(cart); // Indicates which bank is currently active @@ -384,18 +382,14 @@ bool CartridgeDPC::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeDPC::load(Deserializer& in) { - uInt32 i; - - cerr << "load from CartDPC !!\n"; - - string cart = name(); + string cart = name(); try { if(in.getString() != cart) return false; - uInt32 limit; + uInt32 i, limit; // Indicates which bank is currently active myCurrentBank = (uInt16) in.getLong(); diff --git a/stella/src/emucore/CartE7.cxx b/stella/src/emucore/CartE7.cxx index 6e5720836..cc3538e58 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.3 2002-05-14 10:56:03 gunfight Exp $ +// $Id: CartE7.cxx,v 1.4 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -218,14 +218,12 @@ void CartridgeE7::bankRAM(uInt16 bank) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeE7::save(Serializer& out) { - uInt32 i; - - cerr << "save from CartE7 !!\n"; - - string cart = name(); + string cart = name(); try { + uInt32 i; + out.putString(cart); out.putLong(2); @@ -256,18 +254,14 @@ bool CartridgeE7::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeE7::load(Deserializer& in) { - uInt32 i; - - cerr << "load from CartE7 !!\n"; - - string cart = name(); + string cart = name(); try { if(in.getString() != cart) return false; - uInt32 limit; + uInt32 i, limit; limit = (uInt32) in.getLong(); for(i = 0; i < limit; ++i) diff --git a/stella/src/emucore/CartF4SC.cxx b/stella/src/emucore/CartF4SC.cxx index 7bea8dfee..474fa220f 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.2 2002-05-13 19:17:32 stephena Exp $ +// $Id: CartF4SC.cxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -158,7 +158,6 @@ void CartridgeF4SC::bank(uInt16 bank) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF4SC::save(Serializer& out) { - cerr << "save from CartF4SC !!\n"; string cart = name(); try @@ -189,7 +188,6 @@ bool CartridgeF4SC::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF4SC::load(Deserializer& in) { - cerr << "load from CartF4SC !!\n"; string cart = name(); try diff --git a/stella/src/emucore/CartF6.cxx b/stella/src/emucore/CartF6.cxx index 6100e0447..ee741328f 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.2 2002-05-13 19:17:32 stephena Exp $ +// $Id: CartF6.cxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -169,7 +169,6 @@ void CartridgeF6::bank(uInt16 bank) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF6::save(Serializer& out) { - cerr << "save from CartF6 !!\n"; string cart = name(); try @@ -195,7 +194,6 @@ bool CartridgeF6::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF6::load(Deserializer& in) { - cerr << "load from CartF6 !!\n"; string cart = name(); try diff --git a/stella/src/emucore/CartF6SC.cxx b/stella/src/emucore/CartF6SC.cxx index d724d7f35..d53ac0f01 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.2 2002-05-13 19:17:32 stephena Exp $ +// $Id: CartF6SC.cxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -202,7 +202,6 @@ void CartridgeF6SC::bank(uInt16 bank) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF6SC::save(Serializer& out) { - cerr << "save from CartF6SC !!\n"; string cart = name(); try @@ -234,7 +233,6 @@ bool CartridgeF6SC::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF6SC::load(Deserializer& in) { - cerr << "load from CartF6SC !!\n"; string cart = name(); try diff --git a/stella/src/emucore/CartF8.cxx b/stella/src/emucore/CartF8.cxx index f7e61e0cd..5593148b7 100644 --- a/stella/src/emucore/CartF8.cxx +++ b/stella/src/emucore/CartF8.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: CartF8.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $ +// $Id: CartF8.cxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -149,7 +149,6 @@ void CartridgeF8::bank(uInt16 bank) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF8::save(Serializer& out) { - cerr << "save from CartF8 !!\n"; string cart = name(); try @@ -175,7 +174,6 @@ bool CartridgeF8::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF8::load(Deserializer& in) { - cerr << "load from CartF8 !!\n"; string cart = name(); try diff --git a/stella/src/emucore/CartF8SC.cxx b/stella/src/emucore/CartF8SC.cxx index 9bf4ebef7..d5cf465b6 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.2 2002-05-13 19:17:32 stephena Exp $ +// $Id: CartF8SC.cxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -182,7 +182,6 @@ void CartridgeF8SC::bank(uInt16 bank) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF8SC::save(Serializer& out) { - cerr << "save from CartF8SC !!\n"; string cart = name(); try @@ -213,7 +212,6 @@ bool CartridgeF8SC::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeF8SC::load(Deserializer& in) { - cerr << "load from CartF8SC !!\n"; string cart = name(); try diff --git a/stella/src/emucore/CartFASC.cxx b/stella/src/emucore/CartFASC.cxx index 8d7a453d0..8e176d6eb 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.2 2002-05-13 19:17:32 stephena Exp $ +// $Id: CartFASC.cxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -192,7 +192,6 @@ void CartridgeFASC::bank(uInt16 bank) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeFASC::save(Serializer& out) { - cerr << "save from CartFASC !!\n"; string cart = name(); try @@ -223,7 +222,6 @@ bool CartridgeFASC::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeFASC::load(Deserializer& in) { - cerr << "load from CartFASC \n"; string cart = name(); try diff --git a/stella/src/emucore/CartMB.cxx b/stella/src/emucore/CartMB.cxx index 85c921240..7dd753c99 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.2 2002-05-13 19:17:32 stephena Exp $ +// $Id: CartMB.cxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -124,7 +124,6 @@ void CartridgeMB::incbank() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeMB::save(Serializer& out) { - cerr << "save from CartMB !!\n"; string cart = name(); try @@ -150,7 +149,6 @@ bool CartridgeMB::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeMB::load(Deserializer& in) { - cerr << "load from CartMB !!\n"; string cart = name(); try diff --git a/stella/src/emucore/Deserializer.hxx b/stella/src/emucore/Deserializer.hxx index eecd98a8d..0490bb1d0 100644 --- a/stella/src/emucore/Deserializer.hxx +++ b/stella/src/emucore/Deserializer.hxx @@ -13,13 +13,13 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Deserializer.hxx,v 1.2 2002-05-14 10:56:03 gunfight Exp $ +// $Id: Deserializer.hxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #ifndef DESERIALIZER_HXX #define DESERIALIZER_HXX -#include "bspf.hxx" +#include "bspf.hxx" #include #include @@ -32,7 +32,7 @@ return. @author Stephen Anthony - @version $Id: Deserializer.hxx,v 1.2 2002-05-14 10:56:03 gunfight Exp $ + @version $Id: Deserializer.hxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ */ class Deserializer { diff --git a/stella/src/emucore/Serializer.hxx b/stella/src/emucore/Serializer.hxx index cdecec0b2..b63408e71 100644 --- a/stella/src/emucore/Serializer.hxx +++ b/stella/src/emucore/Serializer.hxx @@ -13,13 +13,13 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Serializer.hxx,v 1.2 2002-05-14 10:56:03 gunfight Exp $ +// $Id: Serializer.hxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #ifndef SERIALIZER_HXX #define SERIALIZER_HXX -#include "bspf.hxx" +#include "bspf.hxx" #include #include @@ -33,7 +33,7 @@ Boolean values are written using a special pattern. @author Stephen Anthony - @version $Id: Serializer.hxx,v 1.2 2002-05-14 10:56:03 gunfight Exp $ + @version $Id: Serializer.hxx,v 1.3 2002-05-14 15:22:28 stephena Exp $ */ class Serializer { diff --git a/stella/src/emucore/TIA.cxx b/stella/src/emucore/TIA.cxx index 57ea62b24..b0b50b410 100644 --- a/stella/src/emucore/TIA.cxx +++ b/stella/src/emucore/TIA.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: TIA.cxx,v 1.13 2002-05-13 19:17:32 stephena Exp $ +// $Id: TIA.cxx,v 1.14 2002-05-14 15:22:28 stephena Exp $ //============================================================================ #include @@ -285,7 +285,6 @@ void TIA::install(System& system) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool TIA::save(Serializer& out) { - cerr << "save from TIA !!\n"; string device = name(); try @@ -369,7 +368,7 @@ bool TIA::save(Serializer& out) } catch(...) { - cerr << "Unknown error in TIA save state\n"; + cerr << "Unknown error in save state for " << device << endl; return false; } @@ -379,7 +378,6 @@ bool TIA::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool TIA::load(Deserializer& in) { - cerr << "load from TIA !!\n"; string device = name(); try @@ -464,7 +462,7 @@ bool TIA::load(Deserializer& in) } catch(...) { - cerr << "Unknown error in TIA load state\n"; + cerr << "Unknown error in load state for " << device << endl; return false; }