mirror of https://github.com/stella-emu/stella.git
CPU registers can be selectively randomized with cpurandom option.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3014 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
4de4fc5152
commit
6d753fd335
14
Changes.txt
14
Changes.txt
|
@ -27,18 +27,20 @@
|
|||
and they will be added and removed automatically. Also fixed is
|
||||
a bug whereby sometimes custom joystick mappings weren't being saved.
|
||||
|
||||
* The 'cpurandom' option now also randomizes the SP register, and the
|
||||
randomization is now disabled by default. If you are experiencing
|
||||
weird graphics corruption, display problems, etc, consider disabling
|
||||
this option.
|
||||
* The 'cpurandom' option is now broken down by register type, so you
|
||||
can selectively enable/disable randomization for each one. The
|
||||
default is to disable randomization for all registers.
|
||||
|
||||
* Fixed 'MDM' scheme to trigger bankswitching on writes to hotspots
|
||||
(previously it only triggered on reads). Also, the scheme has been
|
||||
modified as originally designed by E. Blink; hotspots are now in the
|
||||
range $800-$BFF instead of $800-$FFF.
|
||||
|
||||
* The OSX app icon now includes 32x32 and 16x16 versions, so 'small'
|
||||
icons will be viewable in Finder, Get Info, etc.
|
||||
* The OSX app-icon now includes 32x32 and 16x16 versions, so 'small'
|
||||
icons will be viewable in 'Finder', 'Get Info', etc.
|
||||
|
||||
* The Linux port now uses an app-icon; this seems to be needed for
|
||||
some window managers.
|
||||
|
||||
-Have fun!
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
@ -2246,8 +2246,8 @@
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-cpurandom <1|0></pre></td>
|
||||
<td>On reset, randomize the content CPU registers.</td>
|
||||
<td><pre>-cpurandom <S,A,X,Y,P></pre></td>
|
||||
<td>On reset, randomize the content of the specified CPU registers.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
|
|
@ -218,21 +218,30 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
|
|||
lfont.getStringWidth("When loading a ROM:"), fontHeight,
|
||||
"When loading a ROM:", kTextAlignLeft);
|
||||
|
||||
// Randomize CPU
|
||||
xpos += 30; ypos += lineHeight + 4;
|
||||
myRandomizeCPU = new CheckboxWidget(boss, lfont, xpos, ypos+1,
|
||||
"Randomize CPU registers (SP/A/X/Y/PS)", kCheckActionCmd);
|
||||
myRandomizeCPU->setID(kRandCPUID);
|
||||
myRandomizeCPU->setTarget(this);
|
||||
addFocusWidget(myRandomizeCPU);
|
||||
|
||||
// Randomize RAM
|
||||
ypos += lineHeight + 4;
|
||||
xpos += 30; ypos += lineHeight + 4;
|
||||
myRandomizeRAM = new CheckboxWidget(boss, lfont, xpos, ypos+1,
|
||||
"Randomize zero-page and extended RAM", kCheckActionCmd);
|
||||
myRandomizeRAM->setID(kRandRAMID);
|
||||
myRandomizeRAM->setTarget(this);
|
||||
addFocusWidget(myRandomizeRAM);
|
||||
|
||||
// Randomize CPU
|
||||
ypos += lineHeight + 8;
|
||||
lwidth = lfont.getStringWidth("Randomize CPU ");
|
||||
new StaticTextWidget(boss, lfont, xpos, ypos+1,
|
||||
lwidth, fontHeight, "Randomize CPU ", kTextAlignLeft);
|
||||
xpos += lwidth + 10;
|
||||
const char* cpuregs[] = { "SP", "A", "X", "Y", "PS" };
|
||||
for(int i = 0; i < 5; ++i)
|
||||
{
|
||||
myRandomizeCPU[i] = new CheckboxWidget(boss, lfont, xpos, ypos+1,
|
||||
cpuregs[i], kCheckActionCmd);
|
||||
myRandomizeCPU[i]->setID(kRandCPUID);
|
||||
myRandomizeCPU[i]->setTarget(this);
|
||||
addFocusWidget(myRandomizeCPU[i]);
|
||||
xpos += CheckboxWidget::boxSize() + lfont.getStringWidth("XX") + 20;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -335,8 +344,12 @@ void RiotWidget::loadConfig()
|
|||
myLeftControl->loadConfig();
|
||||
myRightControl->loadConfig();
|
||||
|
||||
myRandomizeCPU->setState(instance().settings().getBool("cpurandom"));
|
||||
myRandomizeRAM->setState(instance().settings().getBool("ramrandom"));
|
||||
|
||||
const string& cpurandom = instance().settings().getString("cpurandom");
|
||||
const char* cpuregs[] = { "S", "A", "X", "Y", "P" };
|
||||
for(int i = 0; i < 5; ++i)
|
||||
myRandomizeCPU[i]->setState(BSPF_containsIgnoreCase(cpurandom, cpuregs[i]));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -401,12 +414,12 @@ void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
case kResetID:
|
||||
riot.reset(!myReset->getState());
|
||||
break;
|
||||
case kRandCPUID:
|
||||
instance().settings().setValue("cpurandom", myRandomizeCPU->getState());
|
||||
break;
|
||||
case kRandRAMID:
|
||||
instance().settings().setValue("ramrandom", myRandomizeRAM->getState());
|
||||
break;
|
||||
case kRandCPUID:
|
||||
handleRandomCPU();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -450,3 +463,15 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font&
|
|||
return new NullControlWidget(boss, font, x, y, controller);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RiotWidget::handleRandomCPU()
|
||||
{
|
||||
string cpurandom;
|
||||
const char* cpuregs[] = { "S", "A", "X", "Y", "P" };
|
||||
for(int i = 0; i < 5; ++i)
|
||||
if(myRandomizeCPU[i]->getState())
|
||||
cpurandom += cpuregs[i];
|
||||
|
||||
instance().settings().setValue("cpurandom", cpurandom);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ class RiotWidget : public Widget, public CommandSender
|
|||
ControllerWidget* addControlWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, Controller& controller);
|
||||
|
||||
void handleRandomCPU();
|
||||
|
||||
private:
|
||||
ToggleBitWidget* mySWCHAReadBits;
|
||||
ToggleBitWidget* mySWCHAWriteBits;
|
||||
|
@ -67,7 +69,7 @@ class RiotWidget : public Widget, public CommandSender
|
|||
CheckboxWidget* mySelect;
|
||||
CheckboxWidget* myReset;
|
||||
|
||||
CheckboxWidget* myRandomizeCPU;
|
||||
CheckboxWidget* myRandomizeCPU[5];
|
||||
CheckboxWidget* myRandomizeRAM;
|
||||
|
||||
// ID's for the various widgets
|
||||
|
|
|
@ -109,22 +109,18 @@ void M6502::reset()
|
|||
// Clear the execution status flags
|
||||
myExecutionStatus = 0;
|
||||
|
||||
// Set registers to default values
|
||||
SP = 0xff;
|
||||
if(mySettings.getBool("cpurandom"))
|
||||
{
|
||||
SP = mySystem->randGenerator().next();
|
||||
A = mySystem->randGenerator().next();
|
||||
X = mySystem->randGenerator().next();
|
||||
Y = mySystem->randGenerator().next();
|
||||
PS(mySystem->randGenerator().next());
|
||||
}
|
||||
else
|
||||
{
|
||||
SP = 0xff;
|
||||
A = X = Y = 0;
|
||||
PS(0x20);
|
||||
}
|
||||
// Set registers to random or default values
|
||||
const string& cpurandom = mySettings.getString("cpurandom");
|
||||
SP = BSPF_containsIgnoreCase(cpurandom, "S") ?
|
||||
mySystem->randGenerator().next() : 0xff;
|
||||
A = BSPF_containsIgnoreCase(cpurandom, "A") ?
|
||||
mySystem->randGenerator().next() : 0x00;
|
||||
X = BSPF_containsIgnoreCase(cpurandom, "X") ?
|
||||
mySystem->randGenerator().next() : 0x00;
|
||||
Y = BSPF_containsIgnoreCase(cpurandom, "Y") ?
|
||||
mySystem->randGenerator().next() : 0x00;
|
||||
PS(BSPF_containsIgnoreCase(cpurandom, "P") ?
|
||||
mySystem->randGenerator().next() : 0x20);
|
||||
|
||||
// Reset access flag
|
||||
myLastAccessWasRead = true;
|
||||
|
|
|
@ -130,7 +130,7 @@ Settings::Settings(OSystem& osystem)
|
|||
setInternal("loglevel", "1");
|
||||
setInternal("logtoconsole", "0");
|
||||
setInternal("tiadriven", "false");
|
||||
setInternal("cpurandom", "false");
|
||||
setInternal("cpurandom", "");
|
||||
setInternal("ramrandom", "true");
|
||||
setInternal("avoxport", "");
|
||||
setInternal("stats", "false");
|
||||
|
|
Loading…
Reference in New Issue