saverom support for Pitfall II (DPC) cart type. Not the most efficient

implementation possible, but not the worst either.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@703 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-07-30 19:14:35 +00:00
parent 803a9146be
commit 3738fc1ca0
2 changed files with 26 additions and 3 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartDPC.cxx,v 1.11 2005-06-28 01:15:17 urchlay Exp $
// $Id: CartDPC.cxx,v 1.12 2005-07-30 19:14:35 urchlay Exp $
//============================================================================
#include <assert.h>
@ -28,6 +28,11 @@ CartridgeDPC::CartridgeDPC(const uInt8* image, uInt32 size)
{
uInt32 addr;
// Make a copy of the entire image as-is, for use by getImage()
// (this wastes 12K of RAM, should be controlled by a #ifdef)
for(addr = 0; addr < size; ++addr)
myImageCopy[addr] = image[addr];
// Copy the program ROM image into my buffer
for(addr = 0; addr < 8192; ++addr)
{
@ -587,3 +592,16 @@ bool CartridgeDPC::load(Deserializer& in)
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeDPC::getImage(int& size) {
size = 8192 + 2048 + 255;
for(int i=0; i<8192; i++)
myImageCopy[i] = myProgramImage[i];
for(int i=0; i<2048; i++)
myImageCopy[i + 8192] = myDisplayImage[i];
return &myImageCopy[0];
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartDPC.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
// $Id: CartDPC.hxx,v 1.7 2005-07-30 19:14:35 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEDCP_HXX
@ -32,7 +32,7 @@ class Deserializer;
see David P. Crane's United States Patent Number 4,644,495.
@author Bradford W. Mott
@version $Id: CartDPC.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
@version $Id: CartDPC.hxx,v 1.7 2005-07-30 19:14:35 urchlay Exp $
*/
class CartridgeDPC : public Cartridge
{
@ -93,6 +93,8 @@ class CartridgeDPC : public Cartridge
*/
virtual bool load(Deserializer& in);
virtual uInt8* getImage(int& size);
public:
/**
Get the byte at the specified address.
@ -142,6 +144,9 @@ class CartridgeDPC : public Cartridge
// The 2K display ROM image of the cartridge
uInt8 myDisplayImage[2048];
// Copy of the raw image, for use by getImage()
uInt8 myImageCopy[8192 + 2048 + 255];
// The top registers for the data fetchers
uInt8 myTops[8];