Extra playfield delay added as Developer option.

This commit is contained in:
thrust26 2019-01-04 14:18:35 +01:00
parent 3f9e82ab79
commit f4de083a2b
6 changed files with 61 additions and 9 deletions

View File

@ -18,6 +18,9 @@
(thanks go to RomHunter for his tireless research in this area).
Related to this, updated the snapshot collection.
* Added developer option for an extra playfield delay clock which is
exhibitted by a (very) few consoles.
* Removed superfluous controller option 'PADDLES_IDIR'
* Fixed not working 7800 pause key

View File

@ -164,6 +164,7 @@ Settings::Settings(OSystem& osystem)
setInternal("plr.debugcolors", "false");
setInternal("plr.tiadriven", "false");
setInternal("plr.console", "2600"); // 7800
setInternal("plr.extrapfdelay", "false");
setInternal("plr.timemachine", true);
setInternal("plr.tm.size", 200);
setInternal("plr.tm.uncompressed", 60);
@ -185,6 +186,7 @@ Settings::Settings(OSystem& osystem)
setInternal("dev.debugcolors", "false");
setInternal("dev.tiadriven", "true");
setInternal("dev.console", "2600"); // 7800
setInternal("dev.extrapfdelay", "false");
setInternal("dev.timemachine", true);
setInternal("dev.tm.size", 1000);
setInternal("dev.tm.uncompressed", 600);
@ -612,6 +614,7 @@ void Settings::usage() const
<< " -plr.stats <1|0> Overlay console info during emulation\n"
<< " -plr.console <2600|7800> Select console for B/W and Pause key\n"
<< " handling and RAM initialization\n"
<< " -plr.extrapfdelay <1|0> Enable extra delay cycle for PF access\n"
<< " -plr.bankrandom <1|0> Randomize the startup bank on reset\n"
<< " -plr.ramrandom <1|0> Randomize the contents of RAM on reset\n"
<< " -plr.cpurandom <1|0> Randomize the contents of CPU registers on\n"
@ -634,6 +637,7 @@ void Settings::usage() const
<< " -dev.stats <1|0> Overlay console info during emulation\n"
<< " -dev.console <2600|7800> Select console for B/W and Pause key\n"
<< " handling and RAM initialization\n"
<< " -dev.extrapfdelay <1|0> Enable extra delay cycle for PF access\n"
<< " -dev.bankrandom <1|0> Randomize the startup bank on reset\n"
<< " -dev.ramrandom <1|0> Randomize the contents of RAM on reset\n"
<< " -dev.cpurandom <1|0> Randomize the contents of CPU registers on\n"

View File

@ -171,6 +171,8 @@ void TIA::reset()
for (PaddleReader& paddleReader : myPaddleReaders)
paddleReader.reset(myTimestamp);
bool devSettings = mySettings.getBool("dev.settings");
setPFDelay(mySettings.getBool(devSettings ? "dev.extrapfdelay" : "plr.extrapfdelay"));
myDelayQueue.reset();
myCyclesAtFrameStart = 0;
@ -178,7 +180,7 @@ void TIA::reset()
if (myFrameManager)
{
myFrameManager->reset();
enableColorLoss(mySettings.getBool(mySettings.getBool("dev.settings") ? "dev.colorloss" : "plr.colorloss"));
enableColorLoss(mySettings.getBool(devSettings ? "dev.colorloss" : "plr.colorloss"));
}
myFrontBufferScanlines = myFrameBufferScanlines = 0;
@ -186,7 +188,7 @@ void TIA::reset()
myFramesSinceLastRender = 0;
// Must be done last, after all other items have reset
enableFixedColors(mySettings.getBool(mySettings.getBool("dev.settings") ? "dev.debugcolors" : "plr.debugcolors"));
enableFixedColors(mySettings.getBool(devSettings ? "dev.debugcolors" : "plr.debugcolors"));
setFixedColorPalette(mySettings.getString("tia.dbgcolors"));
// Blank the various framebuffers; they may contain graphical garbage
@ -593,14 +595,19 @@ bool TIA::poke(uInt16 address, uInt8 value)
case COLUPF:
flushLineCache();
value &= 0xFE;
myPlayfield.setColor(value);
myBall.setColor(value);
myShadowRegisters[address] = value;
if (myPFColorDelay)
myDelayQueue.push(COLUPF, value, 1);
else
{
myPlayfield.setColor(value);
myBall.setColor(value);
myShadowRegisters[address] = value;
}
break;
case PF0:
{
myDelayQueue.push(PF0, value, Delay::pf);
myDelayQueue.push(PF0, value, myPFDelay);
#ifdef DEBUGGER_SUPPORT
uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke();
if(dataAddr)
@ -611,7 +618,7 @@ bool TIA::poke(uInt16 address, uInt8 value)
case PF1:
{
myDelayQueue.push(PF1, value, Delay::pf);
myDelayQueue.push(PF1, value, myPFDelay);
#ifdef DEBUGGER_SUPPORT
uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke();
if(dataAddr)
@ -622,7 +629,7 @@ bool TIA::poke(uInt16 address, uInt8 value)
case PF2:
{
myDelayQueue.push(PF2, value, Delay::pf);
myDelayQueue.push(PF2, value, myPFDelay);
#ifdef DEBUGGER_SUPPORT
uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke();
if(dataAddr)
@ -1457,6 +1464,13 @@ void TIA::clearHmoveComb()
memset(myBackBuffer + myFrameManager->getY() * 160, myColorHBlank, 8);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::setPFDelay(bool slow)
{
myPFDelay = slow ? Delay::pf + 1 : Delay::pf;
myPFColorDelay = slow ? 1 : 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::delayedWrite(uInt8 address, uInt8 value)
{
@ -1500,6 +1514,11 @@ void TIA::delayedWrite(uInt8 address, uInt8 value)
myPlayfield.pf2(value);
break;
case COLUPF:
myPlayfield.setColor(value);
myBall.setColor(value);
break;
case HMM0:
myMissile0.hmm(value);
break;

View File

@ -412,6 +412,13 @@ class TIA : public Device
bool toggleJitter(uInt8 mode = 2);
void setJitterRecoveryFactor(Int32 factor);
/**
Enables/disables slower playfield values.
@param slow Wether to enable slow playfield delays
*/
void setPFDelay(bool slow);
/**
This method should be called to update the TIA with a new scanline.
*/
@ -656,6 +663,12 @@ class TIA : public Device
*/
DelayQueue<delayQueueLength, delayQueueSize> myDelayQueue;
/**
Variable delay values for PF writes.
*/
uInt8 myPFDelay;
uInt8 myPFColorDelay;
/**
* The frame manager is responsible for detecting frame boundaries and the visible
* region of each frame.

View File

@ -114,6 +114,11 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
myConsoleWidget = new PopUpWidget(myTab, font, HBORDER + INDENT * 1, ypos, pwidth, lineHeight, items,
"Console ", lwidth, kConsole);
wid.push_back(myConsoleWidget);
myPFDelaykWidget = new CheckboxWidget(myTab, font, myConsoleWidget->getRight() + 20, ypos + 1,
"Extra playfield delay");
wid.push_back(myPFDelaykWidget);
ypos += lineHeight + VGAP;
// Randomize items
@ -490,6 +495,7 @@ void DeveloperDialog::loadSettings(SettingsSet set)
myFrameStats[set] = instance().settings().getBool(prefix + "stats");
myConsole[set] = instance().settings().getString(prefix + "console") == "7800" ? 1 : 0;
myPFDelay[set] = instance().settings().getBool(prefix + "extrapfdelay");
// Randomization
myRandomBank[set] = instance().settings().getBool(prefix + "bankrandom");
myRandomizeRAM[set] = instance().settings().getBool(prefix + "ramrandom");
@ -530,6 +536,7 @@ void DeveloperDialog::saveSettings(SettingsSet set)
instance().settings().setValue(prefix + "console", myConsole[set] == 1 ? "7800" : "2600");
if(instance().hasConsole())
instance().eventHandler().set7800Mode();
instance().settings().setValue(prefix + "extrapfdelay", myPFDelay[set]);
// Randomization
instance().settings().setValue(prefix + "bankrandom", myRandomBank[set]);
@ -567,6 +574,7 @@ void DeveloperDialog::getWidgetStates(SettingsSet set)
{
myFrameStats[set] = myFrameStatsWidget->getState();
myConsole[set] = myConsoleWidget->getSelected() == 1;
myPFDelay[set] = myPFDelaykWidget->getState();
// Randomization
myRandomBank[set] = myRandomBankWidget->getState();
myRandomizeRAM[set] = myRandomizeRAMWidget->getState();
@ -609,6 +617,7 @@ void DeveloperDialog::setWidgetStates(SettingsSet set)
{
myFrameStatsWidget->setState(myFrameStats[set]);
myConsoleWidget->setSelectedIndex(myConsole[set]);
myPFDelaykWidget->setState(myPFDelay[set]);
// Randomization
myRandomBankWidget->setState(myRandomBank[set]);
myRandomizeRAMWidget->setState(myRandomizeRAM[set]);
@ -712,9 +721,10 @@ void DeveloperDialog::saveConfig()
// activate the current settings
instance().frameBuffer().showFrameStats(myFrameStatsWidget->getState());
// jitter
// playfield delay & jitter
if(instance().hasConsole())
{
instance().console().tia().setPFDelay(myPFDelaykWidget->getState());
instance().console().tia().toggleJitter(myTVJitterWidget->getState() ? 1 : 0);
instance().console().tia().setJitterRecoveryFactor(myTVJitterRecWidget->getValue());
}
@ -769,6 +779,7 @@ void DeveloperDialog::setDefaults()
case 0: // Emulation
myFrameStats[set] = devSettings ? true : false;
myConsole[set] = 0;
myPFDelay[set] = false;
// Randomization
myRandomBank[set] = devSettings ? true : false;
myRandomizeRAM[set] = true;

View File

@ -94,6 +94,7 @@ class DeveloperDialog : public Dialog
RadioButtonGroup* mySettingsGroup0;
CheckboxWidget* myFrameStatsWidget;
PopUpWidget* myConsoleWidget;
CheckboxWidget* myPFDelaykWidget;
StaticTextWidget* myLoadingROMLabel;
CheckboxWidget* myRandomBankWidget;
CheckboxWidget* myRandomizeRAMWidget;
@ -137,6 +138,7 @@ class DeveloperDialog : public Dialog
// Emulator sets
bool myFrameStats[2];
int myConsole[2];
bool myPFDelay[2];
bool myRandomBank[2];
bool myRandomizeRAM[2];
string myRandomizeCPU[2];