diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx index 560d64a98..2cb87e469 100644 --- a/src/emucore/Cart.cxx +++ b/src/emucore/Cart.cxx @@ -91,13 +91,19 @@ void Cartridge::createCodeAccessBase(uInt32 size) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Cartridge::initializeRAM(uInt8* arr, uInt32 size, uInt8 val) const { - if(mySettings.getBool(mySettings.getBool("dev.settings") ? "dev.ramrandom" : "plr.ramrandom")) + if(randomInitialRAM()) for(uInt32 i = 0; i < size; ++i) arr[i] = mySystem->randGenerator().next(); else memset(arr, val, size); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool Cartridge::randomInitialRAM() const +{ + return mySettings.getBool(mySettings.getBool("dev.settings") ? "dev.ramrandom" : "plr.ramrandom"); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Cartridge::randomizeStartBank() { diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx index 41ba2ba37..0cbce75cc 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -195,6 +195,13 @@ class Cartridge : public Device */ void initializeRAM(uInt8* arr, uInt32 size, uInt8 val = 0) const; + /** + Checks if initial RAM randomization is enabled + + @return Whether the initial RAM should be randomized + */ + bool randomInitialRAM() const; + /** Defines the startup bank. if 'bank' is negative, a random bank will be selected. diff --git a/src/emucore/CartFE.cxx b/src/emucore/CartFE.cxx index ab10e831c..9c2069f81 100644 --- a/src/emucore/CartFE.cxx +++ b/src/emucore/CartFE.cxx @@ -30,7 +30,7 @@ CartridgeFE::CartridgeFE(const BytePtr& image, uInt32 size, memcpy(myImage, image.get(), std::min(8192u, size)); createCodeAccessBase(8192); - myStartBank = 0; // For now, we assume this; more research is needed + myStartBank = 0; // Decathlon requires this, since there is no startup vector in bank 1 } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -