From 3738fc1ca0244006b57ef612731d79b20522bcc4 Mon Sep 17 00:00:00 2001 From: urchlay Date: Sat, 30 Jul 2005 19:14:35 +0000 Subject: [PATCH] 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 --- stella/src/emucore/CartDPC.cxx | 20 +++++++++++++++++++- stella/src/emucore/CartDPC.hxx | 9 +++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/stella/src/emucore/CartDPC.cxx b/stella/src/emucore/CartDPC.cxx index 712bf7435..c30aaa0f6 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.11 2005-06-28 01:15:17 urchlay Exp $ +// $Id: CartDPC.cxx,v 1.12 2005-07-30 19:14:35 urchlay Exp $ //============================================================================ #include @@ -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]; +} + diff --git a/stella/src/emucore/CartDPC.hxx b/stella/src/emucore/CartDPC.hxx index b9a919e9a..dac6e6973 100644 --- a/stella/src/emucore/CartDPC.hxx +++ b/stella/src/emucore/CartDPC.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: CartDPC.hxx,v 1.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];