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