diff --git a/Changes.txt b/Changes.txt
index 3dc2b695f..87e470ba5 100644
--- a/Changes.txt
+++ b/Changes.txt
@@ -50,6 +50,8 @@
* Fixed broken 7800 pause key support.
+ * Added developer option for random hotspot peek values.
+
* Added user defined CPU cycle timers to debugger.
* Removed 'launcherroms' option, since it was causing some issues.
diff --git a/docs/graphics/options_developer.png b/docs/graphics/options_developer.png
index 6a8525a65..95460ab06 100644
Binary files a/docs/graphics/options_developer.png and b/docs/graphics/options_developer.png differ
diff --git a/docs/graphics/options_developer_emulation.png b/docs/graphics/options_developer_emulation.png
index 1190c876d..f846843bf 100644
Binary files a/docs/graphics/options_developer_emulation.png and b/docs/graphics/options_developer_emulation.png differ
diff --git a/docs/index.html b/docs/index.html
index acd6c8a5d..f6aed096b 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -3640,6 +3640,9 @@
-<plr.|dev.>cpurandom <S,A,X,Y,P> |
On reset, randomize the content of the specified CPU registers. |
+
+ -dev.hsrandom <1|0> |
+ When this option is enabled, peeks to hotspots return semi-random values. |
-dev.tiadriven <1|0> |
Set unused TIA pins to be randomly driven high or low on a read/peek.
@@ -4567,6 +4570,11 @@
| When loading a ROM, randomize the content of the specified CPU registers |
-plr.cpurandom -dev.cpurandom |
+
+ Random hotspot peek values |
+ Peeks to hotspots return semi-random values |
+ -dev.hsrandom |
+
Drive unused TIA pins ... |
Unused TIA pins are read random instead of the last databus values |
diff --git a/src/common/DevSettingsHandler.cxx b/src/common/DevSettingsHandler.cxx
index e816076aa..bd9702f74 100644
--- a/src/common/DevSettingsHandler.cxx
+++ b/src/common/DevSettingsHandler.cxx
@@ -23,6 +23,7 @@
#include "Settings.hxx"
#include "StateManager.hxx"
#include "TIA.hxx"
+#include "Cart.hxx"
#include "DevSettingsHandler.hxx"
@@ -47,6 +48,8 @@ void DevSettingsHandler::loadSettings(SettingsSet set)
myRandomizeTIA[set] = settings.getBool(prefix + "tiarandom");
myRandomizeRAM[set] = settings.getBool(prefix + "ramrandom");
myRandomizeCPU[set] = settings.getString(prefix + "cpurandom");
+ // Random hotspot peeks
+ myRandomHotspots[set] = devSettings ? settings.getBool("dev.hsrandom") : false;
// Undriven TIA pins
myUndrivenPins[set] = devSettings ? settings.getBool("dev.tiadriven") : false;
#ifdef DEBUGGER_SUPPORT
@@ -110,6 +113,7 @@ void DevSettingsHandler::saveSettings(SettingsSet set)
if(devSettings)
{
+ settings.setValue("dev.hsrandom", myRandomHotspots[set]);
// Undriven TIA pins
settings.setValue("dev.tiadriven", myUndrivenPins[set]);
#ifdef DEBUGGER_SUPPORT
@@ -168,6 +172,7 @@ void DevSettingsHandler::applySettings(SettingsSet set)
if(myOSystem.hasConsole())
{
+ myOSystem.console().cartridge().enableRandomHotspots(myRandomHotspots[set]);
myOSystem.console().tia().driveUnusedPinsRandom(myUndrivenPins[set]);
// Notes:
// - thumb exceptions not updated, because set in cart constructor
diff --git a/src/common/DevSettingsHandler.hxx b/src/common/DevSettingsHandler.hxx
index b3b324bd7..365d8c28d 100644
--- a/src/common/DevSettingsHandler.hxx
+++ b/src/common/DevSettingsHandler.hxx
@@ -58,6 +58,7 @@ class DevSettingsHandler
std::array myTVJitterSense;
std::array myTVJitterRec;
std::array myDebugColors;
+ std::array myRandomHotspots;
std::array myUndrivenPins;
#ifdef DEBUGGER_SUPPORT
std::array myRWPortBreak;
diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx
index cb85ec514..0b171ed36 100644
--- a/src/common/PKeyboardHandler.cxx
+++ b/src/common/PKeyboardHandler.cxx
@@ -70,8 +70,25 @@ PhysicalKeyboardHandler::PhysicalKeyboardHandler(OSystem& system, EventHandler&
#ifdef DEBUGGER_SUPPORT
setDefaultMapping(Event::NoType, EventMode::kPromptMode, updateDefaults);
#endif
+#ifdef DEBUG_BUILD
+ verifyDefaultMapping(DefaultCommonMapping, EventMode::kEmulationMode, "EmulationMode");
+ verifyDefaultMapping(DefaultMenuMapping, EventMode::kMenuMode, "MenuMode");
+#endif
}
+#ifdef DEBUG_BUILD
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void PhysicalKeyboardHandler::verifyDefaultMapping(
+ PhysicalKeyboardHandler::EventMappingArray mapping, EventMode mode, string_view name)
+{
+ for(const auto& item1 : mapping)
+ for(const auto& item2 : mapping)
+ if(item1.event != item2.event && item1.key == item2.key && item1.mod == item2.mod)
+ cerr << "ERROR! Duplicate hotkey mapping found: " << name << ", "
+ << myKeyMap.getDesc(KeyMap::Mapping(mode, item1.key, item1.mod)) << "\n";
+}
+#endif
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalKeyboardHandler::loadSerializedMappings(
string_view serializedMapping, EventMode mode)
@@ -660,6 +677,7 @@ PhysicalKeyboardHandler::DefaultCommonMapping = {
{ Event::PhosphorDecrease, KBDK_4, KBDM_SHIFT | MOD3 },
{ Event::PhosphorIncrease, KBDK_4, MOD3 },
{ Event::TogglePhosphor, KBDK_P, MOD3 },
+ //{ Event::PhosphorModeDecrease, KBDK_P, KBDM_SHIFT | KBDM_CTRL | MOD3 },
{ Event::PhosphorModeIncrease, KBDK_P, KBDM_CTRL | MOD3 },
{ Event::ScanlinesDecrease, KBDK_5, KBDM_SHIFT | MOD3 },
{ Event::ScanlinesIncrease, KBDK_5, MOD3 },
diff --git a/src/common/PKeyboardHandler.hxx b/src/common/PKeyboardHandler.hxx
index 7cdf5b247..2b3969afe 100644
--- a/src/common/PKeyboardHandler.hxx
+++ b/src/common/PKeyboardHandler.hxx
@@ -124,6 +124,11 @@ class PhysicalKeyboardHandler
/** return event mode for given controller type */
static EventMode getMode(const Controller::Type type);
+#ifdef DEBUG_BUILD
+ void verifyDefaultMapping(PhysicalKeyboardHandler::EventMappingArray mapping,
+ EventMode mode, string_view name);
+#endif
+
private:
OSystem& myOSystem;
EventHandler& myHandler;
diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx
index bd91358e3..3c98e1c93 100644
--- a/src/emucore/Cart.cxx
+++ b/src/emucore/Cart.cxx
@@ -37,6 +37,8 @@ Cartridge::Cartridge(const Settings& settings, string_view md5)
for(uInt32 i = 0; i < 256; ++i)
myRWPRandomValues[i] = rand.next();
+ const bool devSettings = mySettings.getBool("dev.settings");
+ myRandomHotspots = devSettings ? mySettings.getBool("dev.randomhs") : false;
myRamReadAccesses.reserve(5);
}
diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx
index 2e031b8be..a859631b5 100644
--- a/src/emucore/Cart.hxx
+++ b/src/emucore/Cart.hxx
@@ -90,6 +90,8 @@ class Cartridge : public Device
void unlockHotspots() { myHotspotsLocked = false; }
bool hotspotsLocked() const { return myHotspotsLocked; }
+ void enableRandomHotspots(bool enable) { myRandomHotspots = enable; }
+
/**
Get the default startup bank for a cart. This is the bank where
the system will look at address 0xFFFC to determine where to
@@ -437,6 +439,9 @@ class Cartridge : public Device
// Semi-random values to use when a read from write port occurs
std::array myRWPRandomValues;
+ // If myRandomHotspots is true, peeks to hotspots return semi-random values.
+ bool myRandomHotspots{false};
+
private:
// The startup bank to use (where to look for the reset vector address)
uInt16 myStartBank{0};
diff --git a/src/emucore/CartEnhanced.cxx b/src/emucore/CartEnhanced.cxx
index 4cdbd9d50..0fd9c476d 100644
--- a/src/emucore/CartEnhanced.cxx
+++ b/src/emucore/CartEnhanced.cxx
@@ -161,7 +161,7 @@ uInt8 CartridgeEnhanced::peek(uInt16 address)
// hotspots in TIA range are reacting to pokes only
if(hotspot() >= 0x80)
- if(checkSwitchBank(address & ADDR_MASK, 0))
+ if(checkSwitchBank(address & ADDR_MASK, 0) && myRandomHotspots)
return myRWPRandomValues[address & 0xFF];
if(isRamBank(address))
diff --git a/src/emucore/CartFA.cxx b/src/emucore/CartFA.cxx
index 6062e6941..f207da0dd 100644
--- a/src/emucore/CartFA.cxx
+++ b/src/emucore/CartFA.cxx
@@ -15,6 +15,7 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
+#include "System.hxx"
#include "CartFA.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -30,8 +31,10 @@ CartridgeFA::CartridgeFA(const ByteBuffer& image, size_t size,
bool CartridgeFA::checkSwitchBank(uInt16 address, uInt8)
{
// Switch banks if necessary
- if((address >= 0x1FF8) && (address <= 0x1FFA))
+ if((address >= 0x1FF8) && (address <= 0x1FFA)/* && (mySystem->getDataBusState() & 1) */)
{
+ //if((mySystem->getDataBusState() & 1) == 0)
+ //cerr << std::hex << address << ": " << (mySystem->getDataBusState() & 1) << ", ";
bank(address - 0x1FF8);
return true;
}
diff --git a/src/emucore/CartFA.hxx b/src/emucore/CartFA.hxx
index 503b3c8f5..67306c725 100644
--- a/src/emucore/CartFA.hxx
+++ b/src/emucore/CartFA.hxx
@@ -26,7 +26,8 @@
/**
Cartridge class used for CBS' RAM Plus cartridges. There are three 4K
- banks, accessible by read/write at $1FF8 - $1FFA, and 256 bytes of RAM.
+ banks, accessible by read/write at $1FF8 - $1FFA (note: D0 has to be 1
+ for switching), and 256 bytes of RAM.
RAM read port is $1100 - $11FF, write port is $1000 - $10FF.
@author Bradford W. Mott, Thomas Jentzsch
diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx
index 00bcbff3a..cdafa49b4 100644
--- a/src/emucore/Settings.cxx
+++ b/src/emucore/Settings.cxx
@@ -278,6 +278,7 @@ Settings::Settings()
setPermanent("dev.ramrandom", "true");
setPermanent("dev.cpurandom", "SAXYP");
setPermanent("dev.tiarandom", "true");
+ setPermanent("dev.hsrandom", "true");
setPermanent("dev.colorloss", "true");
#ifdef GUI_SUPPORT
setPermanent("dev.tv.jitter", "true");
@@ -784,6 +785,7 @@ void Settings::usage()
<< " -dev.tv.jitter <1|0> Enable TV jitter effect\n"
<< " -dev.tv.jitter_sense <1-10> Set TV jitter effect sensitivity\n"
<< " -dev.tv.jitter_recovery <1-20> Set recovery time for TV jitter effect\n"
+ << " -dev.hsrandom <1|0> Randomize the hotspot peek values\n"
<< " -dev.tiadriven <1|0> Drive unqused TIA pins randomly on a\n"
<< " read/peek\n"
#ifdef DEBUGGER_SUPPORT
diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx
index a17b768cc..2df91e469 100644
--- a/src/gui/DeveloperDialog.cxx
+++ b/src/gui/DeveloperDialog.cxx
@@ -56,7 +56,7 @@ DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent,
// Set real dimensions
setSize(53 * fontWidth + HBORDER * 2,
- _th + VGAP * 3 + lineHeight + 13 * (lineHeight + VGAP) + buttonHeight + VBORDER * 3,
+ _th + VGAP * 3 + lineHeight + 14 * (lineHeight + VGAP) + buttonHeight + VBORDER * 3,
max_w, max_h);
// The tab widget
@@ -183,6 +183,12 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
}
ypos += lineHeight + VGAP;
+ // How to handle undriven TIA pins
+ myRandomHotspotsWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
+ "Random hotspot peek values");
+ wid.push_back(myRandomHotspotsWidget);
+ ypos += lineHeight + VGAP;
+
// How to handle undriven TIA pins
myUndrivenPinsWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"Drive unused TIA pins randomly on a read/peek");
@@ -711,6 +717,8 @@ void DeveloperDialog::getWidgetStates(SettingsSet set)
if(myRandomizeCPUWidget[i]->getState())
cpurandom += cpuregs[i];
myRandomizeCPU[set] = cpurandom;
+ // Random hotspot peeks
+ myRandomHotspots[set] = myRandomHotspotsWidget->getState();
// Undriven TIA pins
myUndrivenPins[set] = myUndrivenPinsWidget->getState();
#ifdef DEBUGGER_SUPPORT
@@ -768,6 +776,8 @@ void DeveloperDialog::setWidgetStates(SettingsSet set)
for(int i = 0; i < 5; ++i)
myRandomizeCPUWidget[i]->setState(BSPF::containsIgnoreCase(cpurandom, cpuregs[i]));
+ // Random hotspot peeks
+ myRandomHotspotsWidget->setState(myRandomHotspots[set]);
// Undriven TIA pins
myUndrivenPinsWidget->setState(myUndrivenPins[set]);
#ifdef DEBUGGER_SUPPORT
@@ -915,6 +925,8 @@ void DeveloperDialog::setDefaults()
myRandomizeTIA[set] = devSettings;
myRandomizeRAM[set] = true;
myRandomizeCPU[set] = devSettings ? "SAXYP" : "AXYP";
+ // Random hotspot peeks
+ myRandomHotspots[set] = devSettings;
// Undriven TIA pins
myUndrivenPins[set] = devSettings;
#ifdef DEBUGGER_SUPPORT
@@ -1091,6 +1103,7 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::handleSettings(bool devSettings)
{
+ myRandomHotspotsWidget->setEnabled(devSettings);
myUndrivenPinsWidget->setEnabled(devSettings);
#ifdef DEBUGGER_SUPPORT
myRWPortBreakWidget->setEnabled(devSettings);
diff --git a/src/gui/DeveloperDialog.hxx b/src/gui/DeveloperDialog.hxx
index def7ba4b9..8b57c6873 100644
--- a/src/gui/DeveloperDialog.hxx
+++ b/src/gui/DeveloperDialog.hxx
@@ -93,8 +93,9 @@ class DeveloperDialog : public Dialog, DevSettingsHandler
CheckboxWidget* myRandomizeTIAWidget{nullptr};
CheckboxWidget* myRandomizeRAMWidget{nullptr};
StaticTextWidget* myRandomizeCPULabel{nullptr};
- CheckboxWidget* myUndrivenPinsWidget{nullptr};
std::array myRandomizeCPUWidget{nullptr};
+ CheckboxWidget* myRandomHotspotsWidget{nullptr};
+ CheckboxWidget* myUndrivenPinsWidget{nullptr};
#ifdef DEBUGGER_SUPPORT
CheckboxWidget* myRWPortBreakWidget{nullptr};
CheckboxWidget* myWRPortBreakWidget{nullptr};