minimal Cart class refactoring

This commit is contained in:
thrust26 2017-12-01 12:03:19 +01:00
parent d333553ec2
commit bd52880a46
3 changed files with 15 additions and 2 deletions

View File

@ -91,13 +91,19 @@ void Cartridge::createCodeAccessBase(uInt32 size)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge::initializeRAM(uInt8* arr, uInt32 size, uInt8 val) const 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) for(uInt32 i = 0; i < size; ++i)
arr[i] = mySystem->randGenerator().next(); arr[i] = mySystem->randGenerator().next();
else else
memset(arr, val, size); memset(arr, val, size);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::randomInitialRAM() const
{
return mySettings.getBool(mySettings.getBool("dev.settings") ? "dev.ramrandom" : "plr.ramrandom");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge::randomizeStartBank() void Cartridge::randomizeStartBank()
{ {

View File

@ -195,6 +195,13 @@ class Cartridge : public Device
*/ */
void initializeRAM(uInt8* arr, uInt32 size, uInt8 val = 0) const; 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 Defines the startup bank. if 'bank' is negative, a random bank will
be selected. be selected.

View File

@ -30,7 +30,7 @@ CartridgeFE::CartridgeFE(const BytePtr& image, uInt32 size,
memcpy(myImage, image.get(), std::min(8192u, size)); memcpy(myImage, image.get(), std::min(8192u, size));
createCodeAccessBase(8192); 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
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -