Added state save and load methods to each class derived from Device.

Not all cartridges have been implemented.  Some are working perfectly,
such as those without RAM.  Others are hopefully working, but require
further testing (like bank switching).  A few are not working at all,
most notably CartAR and CartMC.

Please test extensively.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@95 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2002-05-13 19:17:32 +00:00
parent 158b91f98c
commit 8a51196556
38 changed files with 1662 additions and 62 deletions

View File

@ -13,12 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Cart2K.cxx,v 1.1.1.1 2001-12-27 19:54:18 bwmott Exp $ // $Id: Cart2K.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "Cart2K.hxx" #include "Cart2K.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge2K::Cartridge2K(const uInt8* image) Cartridge2K::Cartridge2K(const uInt8* image)
@ -80,3 +83,49 @@ void Cartridge2K::poke(uInt16, uInt8)
// This is ROM so poking has no effect :-) // This is ROM so poking has no effect :-)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge2K::save(Serializer& out)
{
string cart = name();
try
{
out.putString(cart);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge2K::load(Deserializer& in)
{
string cart = name();
try
{
if(in.getString() != cart)
return false;
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
return true;
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Cart2K.hxx,v 1.1.1.1 2001-12-27 19:54:18 bwmott Exp $ // $Id: Cart2K.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGE2K_HXX #ifndef CARTRIDGE2K_HXX
@ -21,6 +21,8 @@
class Cartridge2K; class Cartridge2K;
class System; class System;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -31,7 +33,7 @@ class System;
2600's 4K cartridge addressing space. 2600's 4K cartridge addressing space.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: Cart2K.hxx,v 1.1.1.1 2001-12-27 19:54:18 bwmott Exp $ @version $Id: Cart2K.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class Cartridge2K : public Cartridge class Cartridge2K : public Cartridge
{ {
@ -69,6 +71,22 @@ class Cartridge2K : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address Get the byte at the specified address

View File

@ -13,12 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Cart3F.cxx,v 1.1.1.1 2001-12-27 19:54:18 bwmott Exp $ // $Id: Cart3F.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "Cart3F.hxx" #include "Cart3F.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge3F::Cartridge3F(const uInt8* image, uInt32 size) Cartridge3F::Cartridge3F(const uInt8* image, uInt32 size)
@ -146,3 +149,57 @@ void Cartridge3F::bank(uInt16 bank)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3F::save(Serializer& out)
{
cerr << "save from Cart3F !!\n";
string cart = name();
try
{
out.putString(cart);
out.putLong(myCurrentBank);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3F::load(Deserializer& in)
{
cerr << "load from Cart3F !!\n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
myCurrentBank = (uInt16) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
// Now, go to the current bank
bank(myCurrentBank);
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Cart3F.hxx,v 1.1.1.1 2001-12-27 19:54:18 bwmott Exp $ // $Id: Cart3F.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGE3F_HXX #ifndef CARTRIDGE3F_HXX
#define CARTRIDGE3F_HXX #define CARTRIDGE3F_HXX
class Cartridge3F; class Cartridge3F;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -35,7 +37,7 @@ class Cartridge3F;
only used 8K this bankswitching scheme supports up to 512K. only used 8K this bankswitching scheme supports up to 512K.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: Cart3F.hxx,v 1.1.1.1 2001-12-27 19:54:18 bwmott Exp $ @version $Id: Cart3F.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class Cartridge3F : public Cartridge class Cartridge3F : public Cartridge
{ {
@ -74,6 +76,22 @@ class Cartridge3F : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address Get the byte at the specified address

View File

@ -13,12 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Cart4K.cxx,v 1.1.1.1 2001-12-27 19:54:18 bwmott Exp $ // $Id: Cart4K.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "Cart4K.hxx" #include "Cart4K.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge4K::Cartridge4K(const uInt8* image) Cartridge4K::Cartridge4K(const uInt8* image)
@ -80,3 +83,52 @@ void Cartridge4K::poke(uInt16, uInt8)
// This is ROM so poking has no effect :-) // This is ROM so poking has no effect :-)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge4K::save(Serializer& out)
{
cerr << "save from Cart4K !!\n";
string cart = name();
try
{
out.putString(cart);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge4K::load(Deserializer& in)
{
cerr << "load from Cart4K !!\n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
return true;
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Cart4K.hxx,v 1.1.1.1 2001-12-27 19:54:18 bwmott Exp $ // $Id: Cart4K.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGE4K_HXX #ifndef CARTRIDGE4K_HXX
@ -21,6 +21,8 @@
class Cartridge4K; class Cartridge4K;
class System; class System;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -30,7 +32,7 @@ class System;
not bankswitched. not bankswitched.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: Cart4K.hxx,v 1.1.1.1 2001-12-27 19:54:18 bwmott Exp $ @version $Id: Cart4K.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class Cartridge4K : public Cartridge class Cartridge4K : public Cartridge
{ {
@ -68,6 +70,22 @@ class Cartridge4K : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartAR.cxx,v 1.2 2002-04-05 02:18:23 bwmott Exp $ // $Id: CartAR.cxx,v 1.3 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
@ -22,6 +22,9 @@
#include "M6502Hi.hxx" #include "M6502Hi.hxx"
#include "Random.hxx" #include "Random.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size) CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size)
@ -419,3 +422,16 @@ void CartridgeAR::loadIntoRAM(uInt8 load)
cerr << "ERROR: Supercharger load is missing from ROM image...\n"; cerr << "ERROR: Supercharger load is missing from ROM image...\n";
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeAR::save(Serializer& out)
{
cerr << "save from CartAR \n";
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeAR::load(Deserializer& in)
{
cerr << "load from CartAR \n";
return true;
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartAR.hxx,v 1.2 2002-04-05 02:18:23 bwmott Exp $ // $Id: CartAR.hxx,v 1.3 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEAR_HXX #ifndef CARTRIDGEAR_HXX
@ -21,6 +21,8 @@
class CartridgeAR; class CartridgeAR;
class M6502High; class M6502High;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -35,7 +37,7 @@ class M6502High;
and one bank of ROM. All 6K of the RAM can be read and written. and one bank of ROM. All 6K of the RAM can be read and written.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: CartAR.hxx,v 1.2 2002-04-05 02:18:23 bwmott Exp $ @version $Id: CartAR.hxx,v 1.3 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeAR : public Cartridge class CartridgeAR : public Cartridge
{ {
@ -81,6 +83,22 @@ class CartridgeAR : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address Get the byte at the specified address

View File

@ -13,20 +13,22 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartCV.cxx,v 1.2 2002-03-18 14:40:07 gunfight Exp $ // $Id: CartCV.cxx,v 1.3 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartCV.hxx" #include "CartCV.hxx"
#include "Random.hxx" #include "Random.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCV::CartridgeCV(const uInt8* image, uInt32 size) CartridgeCV::CartridgeCV(const uInt8* image, uInt32 size)
{ {
uInt32 addr; uInt32 addr;
if(size == 2048)
if(size == 2048)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
for(uInt32 addr = 0; addr < 2048; ++addr) for(uInt32 addr = 0; addr < 2048; ++addr)
@ -129,3 +131,61 @@ void CartridgeCV::poke(uInt16, uInt8)
// This is ROM so poking has no effect :-) // This is ROM so poking has no effect :-)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCV::save(Serializer& out)
{
cerr << "save from CartCV !!\n";
string cart = name();
try
{
out.putString(cart);
// Output RAM
out.putLong(1024);
for(uInt32 addr = 0; addr < 1024; ++addr)
out.putLong(myRAM[addr]);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCV::load(Deserializer& in)
{
cerr << "load from CartCV !!\n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
// Input RAM
uInt32 limit = (uInt32) in.getLong();
for(uInt32 addr = 0; addr < limit; ++addr)
myRAM[addr] = (uInt8) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
return true;
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartCV.hxx,v 1.1 2002-01-18 15:59:40 estolberg Exp $ // $Id: CartCV.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGECV_HXX #ifndef CARTRIDGECV_HXX
@ -21,6 +21,8 @@
class CartridgeCV; class CartridgeCV;
class System; class System;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -33,7 +35,7 @@ class System;
$F800-$FFFF ROM $F800-$FFFF ROM
@author Eckhard Stolberg @author Eckhard Stolberg
@version $Id: CartCV.hxx,v 1.1 2002-01-18 15:59:40 estolberg Exp $ @version $Id: CartCV.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeCV : public Cartridge class CartridgeCV : public Cartridge
{ {
@ -71,6 +73,22 @@ class CartridgeCV : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address Get the byte at the specified address

View File

@ -13,12 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartDPC.cxx,v 1.3 2002-03-28 01:48:28 bwmott Exp $ // $Id: CartDPC.cxx,v 1.4 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartDPC.hxx" #include "CartDPC.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// This class does not emulate the music mode data fetchers of the DPC. A // This class does not emulate the music mode data fetchers of the DPC. A
@ -325,3 +328,108 @@ void CartridgeDPC::bank(uInt16 bank)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeDPC::save(Serializer& out)
{
cerr << "save from CartDPC !!\n";
string cart = name();
try
{
out.putString(cart);
// Indicates which bank is currently active
out.putLong(myCurrentBank);
// The bottom registers for the data fetchers
out.putLong(8);
for(uInt32 i = 0; i < 8; ++i)
out.putLong(myBottoms[i]);
// The counter registers for the data fetchers
out.putLong(8);
for(uInt32 i = 0; i < 8; ++i)
out.putLong(myCounters[i]);
// The flag registers for the data fetchers
out.putLong(8);
for(uInt32 i = 0; i < 8; ++i)
out.putLong(myFlags[i]);
// The random number generator register
out.putLong(myRandomNumber);
// The top registers for the data fetchers
out.putLong(8);
for(uInt32 i = 0; i < 8; ++i)
out.putLong(myTops[i]);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeDPC::load(Deserializer& in)
{
cerr << "load from CartDPC !!\n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
uInt32 limit;
// Indicates which bank is currently active
myCurrentBank = (uInt16) in.getLong();
// The bottom registers for the data fetchers
limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i)
myBottoms[i] = (uInt8) in.getLong();
// The counter registers for the data fetchers
limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i)
myCounters[i] = (uInt16) in.getLong();
// The flag registers for the data fetchers
limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i)
myFlags[i] = (uInt8) in.getLong();
// The random number generator register
myRandomNumber = (uInt8) in.getLong();
// The top registers for the data fetchers
limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i)
myTops[i] = (uInt8) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
// Now, go to the current bank
bank(myCurrentBank);
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartDPC.hxx,v 1.1 2001-12-30 18:43:30 bwmott Exp $ // $Id: CartDPC.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEDCP_HXX #ifndef CARTRIDGEDCP_HXX
#define CARTRIDGEDCP_HXX #define CARTRIDGEDCP_HXX
class CartridgeDPC; class CartridgeDPC;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -30,7 +32,7 @@ class CartridgeDPC;
see David P. Crane's United States Patent Number 4,644,495. see David P. Crane's United States Patent Number 4,644,495.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: CartDPC.hxx,v 1.1 2001-12-30 18:43:30 bwmott Exp $ @version $Id: CartDPC.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeDPC : public Cartridge class CartridgeDPC : public Cartridge
{ {
@ -68,6 +70,22 @@ class CartridgeDPC : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.
@ -123,4 +141,3 @@ class CartridgeDPC : public Cartridge
uInt8 myTops[8]; uInt8 myTops[8];
}; };
#endif #endif

View File

@ -13,12 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartE0.cxx,v 1.1.1.1 2001-12-27 19:54:19 bwmott Exp $ // $Id: CartE0.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartE0.hxx" #include "CartE0.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE0::CartridgeE0(const uInt8* image) CartridgeE0::CartridgeE0(const uInt8* image)
@ -189,3 +192,59 @@ void CartridgeE0::segmentTwo(uInt16 slice)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeE0::save(Serializer& out)
{
cerr << "save from CartE0 !!\n";
string cart = name();
try
{
out.putString(cart);
out.putLong(4);
for(uInt32 i = 0; i < 4; ++i)
out.putLong(myCurrentSlice[i]);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeE0::load(Deserializer& in)
{
cerr << "load from CartE0 !!\n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
uInt32 limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i)
myCurrentSlice[i] = (uInt16) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartE0.hxx,v 1.1.1.1 2001-12-27 19:54:19 bwmott Exp $ // $Id: CartE0.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEE0_HXX #ifndef CARTRIDGEE0_HXX
#define CARTRIDGEE0_HXX #define CARTRIDGEE0_HXX
class CartridgeF8; class CartridgeF8;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -34,7 +36,7 @@ class CartridgeF8;
always points to the last 1K of the ROM image. always points to the last 1K of the ROM image.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: CartE0.hxx,v 1.1.1.1 2001-12-27 19:54:19 bwmott Exp $ @version $Id: CartE0.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeE0 : public Cartridge class CartridgeE0 : public Cartridge
{ {
@ -72,6 +74,22 @@ class CartridgeE0 : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -13,13 +13,16 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartE7.cxx,v 1.1.1.1 2001-12-27 19:54:19 bwmott Exp $ // $Id: CartE7.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartE7.hxx" #include "CartE7.hxx"
#include "Random.hxx" #include "Random.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE7::CartridgeE7(const uInt8* image) CartridgeE7::CartridgeE7(const uInt8* image)
@ -212,3 +215,79 @@ void CartridgeE7::bankRAM(uInt16 bank)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeE7::save(Serializer& out)
{
cerr << "save from CartE7 !!\n";
string cart = name();
try
{
out.putString(cart);
out.putLong(2);
for(uInt32 i = 0; i < 2; ++i)
out.putLong(myCurrentSlice[i]);
out.putLong(myCurrentRAM);
// The 2048 bytes of RAM
out.putLong(2048);
for(uInt32 i = 0; i < 2048; ++i)
out.putLong(myRAM[i]);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeE7::load(Deserializer& in)
{
cerr << "load from CartE7 !!\n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
uInt32 limit;
limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i)
myCurrentSlice[i] = (uInt16) in.getLong();
myCurrentRAM = (uInt16) in.getLong();
// The 2048 bytes of RAM
limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i)
myRAM[i] = (uInt8) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
// Set up the previously used banks for the RAM and segment
bankRAM(myCurrentRAM);
bank(myCurrentSlice[0]);
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartE7.hxx,v 1.1.1.1 2001-12-27 19:54:19 bwmott Exp $ // $Id: CartE7.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEE7_HXX #ifndef CARTRIDGEE7_HXX
#define CARTRIDGEE7_HXX #define CARTRIDGEE7_HXX
class CartridgeE7; class CartridgeE7;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -51,7 +53,7 @@ class CartridgeE7;
here by accessing 1FF8 to 1FFB. here by accessing 1FF8 to 1FFB.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: CartE7.hxx,v 1.1.1.1 2001-12-27 19:54:19 bwmott Exp $ @version $Id: CartE7.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeE7 : public Cartridge class CartridgeE7 : public Cartridge
{ {
@ -89,6 +91,22 @@ class CartridgeE7 : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -13,13 +13,16 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartF4SC.cxx,v 1.1.1.1 2001-12-27 19:54:19 bwmott Exp $ // $Id: CartF4SC.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartF4SC.hxx" #include "CartF4SC.hxx"
#include "Random.hxx" #include "Random.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF4SC::CartridgeF4SC(const uInt8* image) CartridgeF4SC::CartridgeF4SC(const uInt8* image)
@ -152,3 +155,67 @@ void CartridgeF4SC::bank(uInt16 bank)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF4SC::save(Serializer& out)
{
cerr << "save from CartF4SC !!\n";
string cart = name();
try
{
out.putString(cart);
out.putLong(myCurrentBank);
// The 128 bytes of RAM
out.putLong(128);
for(uInt32 i = 0; i < 128; ++i)
out.putLong(myRAM[i]);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF4SC::load(Deserializer& in)
{
cerr << "load from CartF4SC !!\n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
myCurrentBank = (uInt16) in.getLong();
uInt32 limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i)
myRAM[i] = (uInt8) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
// Remember what bank we were in
bank(myCurrentBank);
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartF4SC.hxx,v 1.1.1.1 2001-12-27 19:54:19 bwmott Exp $ // $Id: CartF4SC.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEF4SC_HXX #ifndef CARTRIDGEF4SC_HXX
#define CARTRIDGEF4SC_HXX #define CARTRIDGEF4SC_HXX
class CartridgeF4SC; class CartridgeF4SC;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -29,7 +31,7 @@ class CartridgeF4SC;
128 bytes of RAM. There are eight 4K banks. 128 bytes of RAM. There are eight 4K banks.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: CartF4SC.hxx,v 1.1.1.1 2001-12-27 19:54:19 bwmott Exp $ @version $Id: CartF4SC.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeF4SC : public Cartridge class CartridgeF4SC : public Cartridge
{ {
@ -67,6 +69,22 @@ class CartridgeF4SC : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -13,12 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartF6.cxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ // $Id: CartF6.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartF6.hxx" #include "CartF6.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF6::CartridgeF6(const uInt8* image) CartridgeF6::CartridgeF6(const uInt8* image)
@ -163,3 +166,58 @@ void CartridgeF6::bank(uInt16 bank)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6::save(Serializer& out)
{
cerr << "save from CartF6 !!\n";
string cart = name();
try
{
out.putString(cart);
out.putLong(myCurrentBank);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6::load(Deserializer& in)
{
cerr << "load from CartF6 !!\n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
myCurrentBank = (uInt16) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
// Remember what bank we were in
bank(myCurrentBank);
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartF6.hxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ // $Id: CartF6.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEF6_HXX #ifndef CARTRIDGEF6_HXX
#define CARTRIDGEF6_HXX #define CARTRIDGEF6_HXX
class CartridgeF6; class CartridgeF6;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -29,7 +31,7 @@ class CartridgeF6;
are four 4K banks. are four 4K banks.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: CartF6.hxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ @version $Id: CartF6.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeF6 : public Cartridge class CartridgeF6 : public Cartridge
{ {
@ -67,6 +69,22 @@ class CartridgeF6 : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -13,13 +13,16 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartF6SC.cxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ // $Id: CartF6SC.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartF6SC.hxx" #include "CartF6SC.hxx"
#include "Random.hxx" #include "Random.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF6SC::CartridgeF6SC(const uInt8* image) CartridgeF6SC::CartridgeF6SC(const uInt8* image)
@ -196,3 +199,69 @@ void CartridgeF6SC::bank(uInt16 bank)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6SC::save(Serializer& out)
{
cerr << "save from CartF6SC !!\n";
string cart = name();
try
{
out.putString(cart);
out.putLong(myCurrentBank);
// The 128 bytes of RAM
out.putLong(128);
for(uInt32 i = 0; i < 128; ++i)
out.putLong(myRAM[i]);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6SC::load(Deserializer& in)
{
cerr << "load from CartF6SC !!\n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
myCurrentBank = (uInt16) in.getLong();
// The 128 bytes of RAM
uInt32 limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i)
myRAM[i] = (uInt8) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
// Remember what bank we were in
bank(myCurrentBank);
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartF6SC.hxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ // $Id: CartF6SC.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEF6SC_HXX #ifndef CARTRIDGEF6SC_HXX
#define CARTRIDGEF6SC_HXX #define CARTRIDGEF6SC_HXX
class CartridgeF6SC; class CartridgeF6SC;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -29,7 +31,7 @@ class CartridgeF6SC;
128 bytes of RAM. There are four 4K banks. 128 bytes of RAM. There are four 4K banks.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: CartF6SC.hxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ @version $Id: CartF6SC.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeF6SC : public Cartridge class CartridgeF6SC : public Cartridge
{ {
@ -67,6 +69,22 @@ class CartridgeF6SC : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -13,12 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartF8.cxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ // $Id: CartF8.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartF8.hxx" #include "CartF8.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF8::CartridgeF8(const uInt8* image) CartridgeF8::CartridgeF8(const uInt8* image)
@ -143,3 +146,58 @@ void CartridgeF8::bank(uInt16 bank)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF8::save(Serializer& out)
{
cerr << "save from CartF8 !!\n";
string cart = name();
try
{
out.putString(cart);
out.putLong(myCurrentBank);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF8::load(Deserializer& in)
{
cerr << "load from CartF8 !!\n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
myCurrentBank = (uInt16) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
// Remember what bank we were in
bank(myCurrentBank);
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartF8.hxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ // $Id: CartF8.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEF8_HXX #ifndef CARTRIDGEF8_HXX
#define CARTRIDGEF8_HXX #define CARTRIDGEF8_HXX
class CartridgeF8; class CartridgeF8;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -29,7 +31,7 @@ class CartridgeF8;
are two 4K banks. are two 4K banks.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: CartF8.hxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ @version $Id: CartF8.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeF8 : public Cartridge class CartridgeF8 : public Cartridge
{ {
@ -67,6 +69,22 @@ class CartridgeF8 : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -13,13 +13,16 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartF8SC.cxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ // $Id: CartF8SC.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartF8SC.hxx" #include "CartF8SC.hxx"
#include "Random.hxx" #include "Random.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF8SC::CartridgeF8SC(const uInt8* image) CartridgeF8SC::CartridgeF8SC(const uInt8* image)
@ -176,3 +179,67 @@ void CartridgeF8SC::bank(uInt16 bank)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF8SC::save(Serializer& out)
{
cerr << "save from CartF8SC !!\n";
string cart = name();
try
{
out.putString(cart);
out.putLong(myCurrentBank);
// The 128 bytes of RAM
out.putLong(128);
for(uInt32 i = 0; i < 128; ++i)
out.putLong(myRAM[i]);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF8SC::load(Deserializer& in)
{
cerr << "load from CartF8SC !!\n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
myCurrentBank = (uInt16) in.getLong();
uInt32 limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i)
myRAM[i] = (uInt8) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
// Remember what bank we were in
bank(myCurrentBank);
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartF8SC.hxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ // $Id: CartF8SC.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEF8SC_HXX #ifndef CARTRIDGEF8SC_HXX
#define CARTRIDGEF8SC_HXX #define CARTRIDGEF8SC_HXX
class CartridgeF8SC; class CartridgeF8SC;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -29,7 +31,7 @@ class CartridgeF8SC;
128 bytes of RAM. There are two 4K banks. 128 bytes of RAM. There are two 4K banks.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: CartF8SC.hxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ @version $Id: CartF8SC.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeF8SC : public Cartridge class CartridgeF8SC : public Cartridge
{ {
@ -67,6 +69,22 @@ class CartridgeF8SC : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -13,13 +13,16 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartFASC.cxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ // $Id: CartFASC.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartFASC.hxx" #include "CartFASC.hxx"
#include "Random.hxx" #include "Random.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFASC::CartridgeFASC(const uInt8* image) CartridgeFASC::CartridgeFASC(const uInt8* image)
@ -186,3 +189,67 @@ void CartridgeFASC::bank(uInt16 bank)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFASC::save(Serializer& out)
{
cerr << "save from CartFASC !!\n";
string cart = name();
try
{
out.putString(cart);
out.putLong(myCurrentBank);
// The 256 bytes of RAM
out.putLong(256);
for(uInt32 i = 0; i < 256; ++i)
out.putLong(myRAM[i]);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFASC::load(Deserializer& in)
{
cerr << "load from CartFASC \n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
myCurrentBank = (uInt16) in.getLong();
uInt32 limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i)
myRAM[i] = (uInt8) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
// Remember what bank we were in
bank(myCurrentBank);
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartFASC.hxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ // $Id: CartFASC.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEFASC_HXX #ifndef CARTRIDGEFASC_HXX
#define CARTRIDGEFASC_HXX #define CARTRIDGEFASC_HXX
class CartridgeFASC; class CartridgeFASC;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -29,7 +31,7 @@ class CartridgeFASC;
three 4K banks and 256 bytes of RAM. three 4K banks and 256 bytes of RAM.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: CartFASC.hxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ @version $Id: CartFASC.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeFASC : public Cartridge class CartridgeFASC : public Cartridge
{ {
@ -67,6 +69,22 @@ class CartridgeFASC : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -13,12 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartFE.cxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ // $Id: CartFE.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartFE.hxx" #include "CartFE.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFE::CartridgeFE(const uInt8* image) CartridgeFE::CartridgeFE(const uInt8* image)
@ -79,3 +82,49 @@ void CartridgeFE::poke(uInt16, uInt8)
{ {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFE::save(Serializer& out)
{
string cart = name();
try
{
out.putString(cart);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFE::load(Deserializer& in)
{
string cart = name();
try
{
if(in.getString() != cart)
return false;
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartFE.hxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ // $Id: CartFE.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEFE_HXX #ifndef CARTRIDGEFE_HXX
#define CARTRIDGEFE_HXX #define CARTRIDGEFE_HXX
class CartridgeFE; class CartridgeFE;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -41,7 +43,7 @@ class CartridgeFE;
monitoring the bus. monitoring the bus.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: CartFE.hxx,v 1.1.1.1 2001-12-27 19:54:20 bwmott Exp $ @version $Id: CartFE.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeFE : public Cartridge class CartridgeFE : public Cartridge
{ {
@ -79,6 +81,22 @@ class CartridgeFE : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -13,12 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartMB.cxx,v 1.1 2002-01-18 16:01:43 estolberg Exp $ // $Id: CartMB.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartMB.hxx" #include "CartMB.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeMB::CartridgeMB(const uInt8* image) CartridgeMB::CartridgeMB(const uInt8* image)
@ -118,3 +121,59 @@ void CartridgeMB::incbank()
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMB::save(Serializer& out)
{
cerr << "save from CartMB !!\n";
string cart = name();
try
{
out.putString(cart);
out.putLong(myCurrentBank);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMB::load(Deserializer& in)
{
cerr << "load from CartMB !!\n";
string cart = name();
try
{
if(in.getString() != cart)
return false;
myCurrentBank = (uInt16) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
return false;
}
// Remember what bank we were in
--myCurrentBank;
incbank();
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartMB.hxx,v 1.1 2002-01-18 16:02:30 estolberg Exp $ // $Id: CartMB.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEMB_HXX #ifndef CARTRIDGEMB_HXX
#define CARTRIDGEMB_HXX #define CARTRIDGEMB_HXX
class CartridgeMB; class CartridgeMB;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -30,7 +32,7 @@ class CartridgeMB;
Accessing $1FF0 switches to next bank. Accessing $1FF0 switches to next bank.
@author Eckhard Stolberg @author Eckhard Stolberg
@version $Id: CartMB.hxx,v 1.1 2002-01-18 16:02:30 estolberg Exp $ @version $Id: CartMB.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeMB : public Cartridge class CartridgeMB : public Cartridge
{ {
@ -68,6 +70,22 @@ class CartridgeMB : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address. Get the byte at the specified address.

View File

@ -13,13 +13,16 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartMC.cxx,v 1.1.1.1 2001-12-27 19:54:21 bwmott Exp $ // $Id: CartMC.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
#include "CartMC.hxx" #include "CartMC.hxx"
#include "Random.hxx" #include "Random.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeMC::CartridgeMC(const uInt8* image, uInt32 size) CartridgeMC::CartridgeMC(const uInt8* image, uInt32 size)
@ -216,3 +219,16 @@ void CartridgeMC::poke(uInt16 address, uInt8 value)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMC::save(Serializer& out)
{
cerr << "save from CartMC \n";
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMC::load(Deserializer& in)
{
cerr << "load from CartMC \n";
return true;
}

View File

@ -13,13 +13,15 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartMC.hxx,v 1.1.1.1 2001-12-27 19:54:21 bwmott Exp $ // $Id: CartMC.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef CARTRIDGEMC_HXX #ifndef CARTRIDGEMC_HXX
#define CARTRIDGEMC_HXX #define CARTRIDGEMC_HXX
class CartridgeMC; class CartridgeMC;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -133,7 +135,7 @@ class CartridgeMC;
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: CartMC.hxx,v 1.1.1.1 2001-12-27 19:54:21 bwmott Exp $ @version $Id: CartMC.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class CartridgeMC : public Cartridge class CartridgeMC : public Cartridge
{ {
@ -174,6 +176,22 @@ class CartridgeMC : public Cartridge
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address Get the byte at the specified address
@ -204,4 +222,3 @@ class CartridgeMC : public Cartridge
uInt8* myImage; uInt8* myImage;
}; };
#endif #endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: M6532.cxx,v 1.1.1.1 2001-12-27 19:54:22 bwmott Exp $ // $Id: M6532.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
@ -22,6 +22,9 @@
#include "Random.hxx" #include "Random.hxx"
#include "Switches.hxx" #include "Switches.hxx"
#include "System.hxx" #include "System.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M6532::M6532(const Console& console) M6532::M6532(const Console& console)
@ -289,6 +292,81 @@ void M6532::poke(uInt16 addr, uInt8 value)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool M6532::save(Serializer& out)
{
string device = name();
try
{
out.putString(device);
// Output the RAM
out.putLong(128);
for(uInt32 t = 0; t < 128; ++t)
out.putLong(myRAM[t]);
out.putLong(myTimer);
out.putLong(myIntervalShift);
out.putLong(myCyclesWhenTimerSet);
out.putLong(myCyclesWhenInterruptReset);
out.putBool(myTimerReadAfterInterrupt);
out.putLong(myDDRA);
out.putLong(myDDRB);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << device << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool M6532::load(Deserializer& in)
{
string device = name();
try
{
if(in.getString() != device)
return false;
// Input the RAM
uInt32 limit = (uInt32) in.getLong();
for(uInt32 t = 0; t < limit; ++t)
myRAM[t] = (uInt8) in.getLong();
myTimer = (uInt32) in.getLong();
myIntervalShift = (uInt32) in.getLong();
myCyclesWhenTimerSet = (uInt32) in.getLong();
myCyclesWhenInterruptReset = (uInt32) in.getLong();
myTimerReadAfterInterrupt = in.getBool();
myDDRA = (uInt8) in.getLong();
myDDRB = (uInt8) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << device << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M6532::M6532(const M6532& c) M6532::M6532(const M6532& c)
: myConsole(c.myConsole) : myConsole(c.myConsole)

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: M6532.hxx,v 1.1.1.1 2001-12-27 19:54:22 bwmott Exp $ // $Id: M6532.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef M6532_HXX #ifndef M6532_HXX
@ -21,6 +21,8 @@
class Console; class Console;
class System; class System;
class Serializer;
class Deserializer;
#include "bspf.hxx" #include "bspf.hxx"
#include "Device.hxx" #include "Device.hxx"
@ -29,7 +31,7 @@ class System;
RIOT RIOT
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: M6532.hxx,v 1.1.1.1 2001-12-27 19:54:22 bwmott Exp $ @version $Id: M6532.hxx,v 1.2 2002-05-13 19:17:32 stephena Exp $
*/ */
class M6532 : public Device class M6532 : public Device
{ {
@ -74,6 +76,22 @@ class M6532 : public Device
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address Get the byte at the specified address

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: TIA.cxx,v 1.12 2002-04-18 17:18:48 stephena Exp $ // $Id: TIA.cxx,v 1.13 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
@ -26,6 +26,9 @@
#include "Sound.hxx" #include "Sound.hxx"
#include "System.hxx" #include "System.hxx"
#include "TIA.hxx" #include "TIA.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include <iostream>
#define HBLANK 68 #define HBLANK 68
@ -279,6 +282,195 @@ void TIA::install(System& system)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool TIA::save(Serializer& out)
{
cerr << "save from TIA !!\n";
string device = name();
try
{
out.putString(device);
out.putLong(myLastSoundUpdateCycle);
out.putLong(myClockWhenFrameStarted);
out.putLong(myClockStartDisplay);
out.putLong(myClockStopDisplay);
out.putLong(myClockAtLastUpdate);
out.putLong(myClocksToEndOfScanLine);
out.putLong(myScanlineCountForLastFrame);
out.putLong(myVSYNCFinishClock);
out.putLong(myEnabledObjects);
out.putLong(myVSYNC);
out.putLong(myVBLANK);
out.putLong(myNUSIZ0);
out.putLong(myNUSIZ1);
out.putLong(myCOLUP0);
out.putLong(myCOLUP1);
out.putLong(myCOLUPF);
out.putLong(myCOLUBK);
out.putLong(myCTRLPF);
out.putLong(myPlayfieldPriorityAndScore);
out.putBool(myREFP0);
out.putBool(myREFP1);
out.putLong(myPF);
out.putLong(myGRP0);
out.putLong(myGRP1);
out.putLong(myDGRP0);
out.putLong(myDGRP1);
out.putBool(myENAM0);
out.putBool(myENAM1);
out.putBool(myENABL);
out.putBool(myDENABL);
out.putLong(myHMP0);
out.putLong(myHMP1);
out.putLong(myHMM0);
out.putLong(myHMM1);
out.putLong(myHMBL);
out.putBool(myVDELP0);
out.putBool(myVDELP1);
out.putBool(myVDELBL);
out.putBool(myRESMP0);
out.putBool(myRESMP1);
out.putLong(myCollision);
out.putLong(myPOSP0);
out.putLong(myPOSP1);
out.putLong(myPOSM0);
out.putLong(myPOSM1);
out.putLong(myPOSBL);
out.putLong(myCurrentGRP0);
out.putLong(myCurrentGRP1);
// pointers
// myCurrentBLMask = ourBallMaskTable[0][0];
// myCurrentM0Mask = ourMissleMaskTable[0][0][0];
// myCurrentM1Mask = ourMissleMaskTable[0][0][0];
// myCurrentP0Mask = ourPlayerMaskTable[0][0][0];
// myCurrentP1Mask = ourPlayerMaskTable[0][0][0];
// myCurrentPFMask = ourPlayfieldTable[0];
out.putLong(myLastHMOVEClock);
out.putBool(myHMOVEBlankEnabled);
out.putBool(myM0CosmicArkMotionEnabled);
out.putLong(myM0CosmicArkCounter);
out.putBool(myDumpEnabled);
out.putLong(myDumpDisabledCycle);
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in TIA save state\n";
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool TIA::load(Deserializer& in)
{
cerr << "load from TIA !!\n";
string device = name();
try
{
if(in.getString() != device)
return false;
myLastSoundUpdateCycle = (Int32) in.getLong();
myClockWhenFrameStarted = (Int32) in.getLong();
myClockStartDisplay = (Int32) in.getLong();
myClockStopDisplay = (Int32) in.getLong();
myClockAtLastUpdate = (Int32) in.getLong();
myClocksToEndOfScanLine = (Int32) in.getLong();
myScanlineCountForLastFrame = (Int32) in.getLong();
myVSYNCFinishClock = (Int32) in.getLong();
myEnabledObjects = (uInt8) in.getLong();
myVSYNC = (uInt8) in.getLong();
myVBLANK = (uInt8) in.getLong();
myNUSIZ0 = (uInt8) in.getLong();
myNUSIZ1 = (uInt8) in.getLong();
myCOLUP0 = (uInt32) in.getLong();
myCOLUP1 = (uInt32) in.getLong();
myCOLUPF = (uInt32) in.getLong();
myCOLUBK = (uInt32) in.getLong();
myCTRLPF = (uInt8) in.getLong();
myPlayfieldPriorityAndScore = (uInt8) in.getLong();
myREFP0 = in.getBool();
myREFP1 = in.getBool();
myPF = (uInt32) in.getLong();
myGRP0 = (uInt8) in.getLong();
myGRP1 = (uInt8) in.getLong();
myDGRP0 = (uInt8) in.getLong();
myDGRP1 = (uInt8) in.getLong();
myENAM0 = in.getBool();
myENAM1 = in.getBool();
myENABL = in.getBool();
myDENABL = in.getBool();
myHMP0 = (Int8) in.getLong();
myHMP1 = (Int8) in.getLong();
myHMM0 = (Int8) in.getLong();
myHMM1 = (Int8) in.getLong();
myHMBL = (Int8) in.getLong();
myVDELP0 = in.getBool();
myVDELP1 = in.getBool();
myVDELBL = in.getBool();
myRESMP0 = in.getBool();
myRESMP1 = in.getBool();
myCollision = (uInt16) in.getLong();
myPOSP0 = (Int16) in.getLong();
myPOSP1 = (Int16) in.getLong();
myPOSM0 = (Int16) in.getLong();
myPOSM1 = (Int16) in.getLong();
myPOSBL = (Int16) in.getLong();
myCurrentGRP0 = (uInt8) in.getLong();
myCurrentGRP1 = (uInt8) in.getLong();
// pointers
// myCurrentBLMask = ourBallMaskTable[0][0];
// myCurrentM0Mask = ourMissleMaskTable[0][0][0];
// myCurrentM1Mask = ourMissleMaskTable[0][0][0];
// myCurrentP0Mask = ourPlayerMaskTable[0][0][0];
// myCurrentP1Mask = ourPlayerMaskTable[0][0][0];
// myCurrentPFMask = ourPlayfieldTable[0];
myLastHMOVEClock = (Int32) in.getLong();
myHMOVEBlankEnabled = in.getBool();
myM0CosmicArkMotionEnabled = in.getBool();
myM0CosmicArkCounter = (uInt32) in.getLong();
myDumpEnabled = in.getBool();
myDumpDisabledCycle = (Int32) in.getLong();
}
catch(char *msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in TIA load state\n";
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::update() void TIA::update()
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: TIA.hxx,v 1.5 2002-04-18 17:18:48 stephena Exp $ // $Id: TIA.hxx,v 1.6 2002-05-13 19:17:32 stephena Exp $
//============================================================================ //============================================================================
#ifndef TIA_HXX #ifndef TIA_HXX
@ -21,6 +21,8 @@
class Console; class Console;
class System; class System;
class Serializer;
class Deserializer;
#include <string> #include <string>
@ -40,7 +42,7 @@ class System;
be displayed on screen. be displayed on screen.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: TIA.hxx,v 1.5 2002-04-18 17:18:48 stephena Exp $ @version $Id: TIA.hxx,v 1.6 2002-05-13 19:17:32 stephena Exp $
*/ */
class TIA : public Device , public MediaSource class TIA : public Device , public MediaSource
{ {
@ -85,6 +87,22 @@ class TIA : public Device , public MediaSource
*/ */
virtual void install(System& system); virtual void install(System& system);
/**
Saves the current state of this device to the given Serializer.
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
/**
Loads the current state of this device from the given Deserializer.
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
public: public:
/** /**
Get the byte at the specified address Get the byte at the specified address