Fixed bugs in DPC+ scheme; reset wasn't actually resetting the

Harmony RAM, and state saving wasn't working at all.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2523 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-06-03 18:05:14 +00:00
parent 132dfcddf0
commit 2145c38087
6 changed files with 40 additions and 9 deletions

View File

@ -12,6 +12,14 @@
Release History Release History
=========================================================================== ===========================================================================
3.7 to 3.7.1: (xxxx xx, 2012)
* Fixed several bugs in DPC+ bankswitching scheme, including ability to
load and save state files.
-Have fun!
3.6.1 to 3.7: (June 1, 2012) 3.6.1 to 3.7: (June 1, 2012)
* Added Blargg TV effects, with presets for Composite, S-video, RGB, * Added Blargg TV effects, with presets for Composite, S-video, RGB,
@ -83,8 +91,6 @@
* Updated included PNG library to latest stable version. * Updated included PNG library to latest stable version.
-Have fun!
3.6 to 3.6.1: (March 30, 2012) 3.6 to 3.6.1: (March 30, 2012)

View File

@ -302,7 +302,7 @@ void Cartridge::registerRamArea(uInt16 start, uInt16 size,
void Cartridge::triggerReadFromWritePort(uInt16 address) void Cartridge::triggerReadFromWritePort(uInt16 address)
{ {
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
if(!mySystem->autodectMode()) if(!mySystem->autodetectMode())
Debugger::debugger().cartDebug().triggerReadFromWritePort(address); Debugger::debugger().cartDebug().triggerReadFromWritePort(address);
#endif #endif
} }

View File

@ -49,7 +49,6 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
// Pointer to the display RAM // Pointer to the display RAM
myDisplayImage = myDPCRAM + 0xC00; myDisplayImage = myDPCRAM + 0xC00;
memset(myDPCRAM, 0, 8192);
// Pointer to the Frequency ROM (1K @ 28K offset) // Pointer to the Frequency ROM (1K @ 28K offset)
myFrequencyImage = myProgramImage + 0x7000; myFrequencyImage = myProgramImage + 0x7000;
@ -71,6 +70,9 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
settings.getBool("thumb.trapfatal")); settings.getBool("thumb.trapfatal"));
#endif #endif
// Reset various ROM and RAM locations
memset(myDPCRAM, 0, 8192);
// Copy DPC display data to Harmony RAM // Copy DPC display data to Harmony RAM
memcpy(myDisplayImage, myProgramImage + 0x6000, 0x1000); memcpy(myDisplayImage, myProgramImage + 0x6000, 0x1000);
@ -106,6 +108,23 @@ void CartridgeDPCPlus::reset()
mySystemCycles = mySystem->cycles(); mySystemCycles = mySystem->cycles();
myFractionalClocks = 0.0; myFractionalClocks = 0.0;
// Reset various ROM and RAM locations
memset(myDPCRAM, 0, 8192);
// Copy initial DPC display data and Frequency table state to Harmony RAM
memcpy(myDisplayImage, myProgramImage + 0x6000, 0x1400);
// Initialize the DPC data fetcher registers
for(uInt16 i = 0; i < 8; ++i)
myTops[i] = myBottoms[i] = myCounters[i] = myFractionalIncrements[i] =
myFractionalCounters[i] = 0;
// Set waveforms to first waveform entry
myMusicWaveforms[0] = myMusicWaveforms[1] = myMusicWaveforms[2] = 0;
// Initialize the DPC's random number generator register (must be non-zero)
myRandomNumber = 0x2B435044; // "DPC+"
// Upon reset we switch to the startup bank // Upon reset we switch to the startup bank
bank(myStartBank); bank(myStartBank);
} }
@ -209,7 +228,7 @@ inline void CartridgeDPCPlus::callFunction(uInt8 value)
myThumbEmulator->run(); myThumbEmulator->run();
} }
catch(const string& error) { catch(const string& error) {
if(!mySystem->autodectMode()) if(!mySystem->autodetectMode())
{ {
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
Debugger::debugger().startWithFatalError(error); Debugger::debugger().startWithFatalError(error);
@ -661,6 +680,9 @@ bool CartridgeDPCPlus::save(Serializer& out) const
// Indicates which bank is currently active // Indicates which bank is currently active
out.putShort(myCurrentBank); out.putShort(myCurrentBank);
// Harmony RAM
out.putByteArray(myDPCRAM, 8192);
// The top registers for the data fetchers // The top registers for the data fetchers
out.putByteArray(myTops, 8); out.putByteArray(myTops, 8);
@ -718,6 +740,9 @@ bool CartridgeDPCPlus::load(Serializer& in)
// Indicates which bank is currently active // Indicates which bank is currently active
myCurrentBank = in.getShort(); myCurrentBank = in.getShort();
// Harmony RAM
in.getByteArray(myDPCRAM, 8192);
// The top registers for the data fetchers // The top registers for the data fetchers
in.getByteArray(myTops, 8); in.getByteArray(myTops, 8);

View File

@ -214,7 +214,7 @@ class System : public Serializable
/** /**
Answers whether the system is currently in device autodetect mode. Answers whether the system is currently in device autodetect mode.
*/ */
bool autodectMode() const { return mySystemInAutodetect; } bool autodetectMode() const { return mySystemInAutodetect; }
public: public:
/** /**

View File

@ -31,7 +31,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Thumbulator::Thumbulator(uInt16* rom_ptr, uInt16* ram_ptr, bool traponfatal) Thumbulator::Thumbulator(const uInt16* rom_ptr, uInt16* ram_ptr, bool traponfatal)
: rom(rom_ptr), : rom(rom_ptr),
ram(ram_ptr), ram(ram_ptr),
copydata(0), copydata(0),

View File

@ -62,7 +62,7 @@
class Thumbulator class Thumbulator
{ {
public: public:
Thumbulator(uInt16* rom, uInt16* ram, bool traponfatal); Thumbulator(const uInt16* rom, uInt16* ram, bool traponfatal);
~Thumbulator(); ~Thumbulator();
/** /**
@ -119,7 +119,7 @@ class Thumbulator
int reset ( void ); int reset ( void );
private: private:
uInt16* rom; const uInt16* rom;
uInt16* ram; uInt16* ram;
Int32 copydata; Int32 copydata;