From b231dda2a9decfb0c2c7bc4d1981566b4450ca33 Mon Sep 17 00:00:00 2001 From: stephena Date: Mon, 4 Jun 2012 19:20:27 +0000 Subject: [PATCH] Some more DPC+ updates. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2526 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/emucore/CartDPCPlus.cxx | 32 +++++++++++--------------------- src/emucore/CartDPCPlus.hxx | 5 +++++ 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index 45a019582..5e82dfe4f 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -60,7 +60,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size, int offset = size - 29 * 1024; myProgramImage += offset; // myDisplayImage += offset; - myFrequencyImage += offset; +// myFrequencyImage += offset; } #ifdef THUMB_SUPPORT @@ -69,23 +69,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size, (uInt16*)myDPCRAM, settings.getBool("thumb.trapfatal")); #endif - - // Reset various ROM and RAM locations - memset(myDPCRAM, 0, 8192); - - // Copy DPC display data to Harmony RAM - memcpy(myDisplayImage, myProgramImage + 0x6000, 0x1000); - - // 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+" + setInitialState(); // DPC+ always starts in bank 5 myStartBank = 5; @@ -108,6 +92,15 @@ void CartridgeDPCPlus::reset() mySystemCycles = mySystem->cycles(); myFractionalClocks = 0.0; + setInitialState(); + + // Upon reset we switch to the startup bank + bank(myStartBank); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeDPCPlus::setInitialState() +{ // Reset various ROM and RAM locations memset(myDPCRAM, 0, 8192); @@ -124,9 +117,6 @@ void CartridgeDPCPlus::reset() // Initialize the DPC's random number generator register (must be non-zero) myRandomNumber = 0x2B435044; // "DPC+" - - // Upon reset we switch to the startup bank - bank(myStartBank); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartDPCPlus.hxx b/src/emucore/CartDPCPlus.hxx index 2c540f7cc..9cab0842c 100644 --- a/src/emucore/CartDPCPlus.hxx +++ b/src/emucore/CartDPCPlus.hxx @@ -149,6 +149,11 @@ class CartridgeDPCPlus : public Cartridge bool poke(uInt16 address, uInt8 value); private: + /** + Sets the initial state of the DPC pointers and RAM + */ + void setInitialState(); + /** Clocks the random number generator to move it to its next state */