From 077cd38c7631fe0e530259d64254046e9d4d1fe6 Mon Sep 17 00:00:00 2001 From: Christian Speckner Date: Sun, 4 Apr 2021 00:36:20 +0200 Subject: [PATCH] Use a more realistic resistance in dump mode. --- src/emucore/tia/PaddleReader.cxx | 8 ++++---- src/emucore/tia/PaddleReader.hxx | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/emucore/tia/PaddleReader.cxx b/src/emucore/tia/PaddleReader.cxx index 2e37413a0..e8839b7a8 100644 --- a/src/emucore/tia/PaddleReader.cxx +++ b/src/emucore/tia/PaddleReader.cxx @@ -83,17 +83,17 @@ void PaddleReader::setConsoleTiming(ConsoleTiming consoleTiming) myConsoleTiming = consoleTiming; myClockFreq = myConsoleTiming == ConsoleTiming::ntsc ? 60 * 228 * 262 : 50 * 228 * 312; - myUThresh = USUPP * (1. - exp(-TRIPPOINT_LINES * 228 / myClockFreq / (RPOT + R0) / C)); + myUThresh = U_SUPP * (1. - exp(-TRIPPOINT_LINES * 228 / myClockFreq / (R_POT + R0) / C)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PaddleReader::updateCharge(uInt64 timestamp) { if (myValue >= 0 && !myIsDumped) - myU = USUPP * (1 - (1 - myU / USUPP) * - exp(-static_cast(timestamp - myTimestamp) / (myValue * RPOT + R0) / C / myClockFreq)); + myU = U_SUPP * (1 - (1 - myU / U_SUPP) * + exp(-static_cast(timestamp - myTimestamp) / (myValue * R_POT + R0) / C / myClockFreq)); else - myU *= exp(-static_cast(timestamp - myTimestamp) / R0 / C / myClockFreq); + myU *= exp(-static_cast(timestamp - myTimestamp) / (myIsDumped ? R_DUMP : R0) / C / myClockFreq); myTimestamp = timestamp; } diff --git a/src/emucore/tia/PaddleReader.hxx b/src/emucore/tia/PaddleReader.hxx index 18b2468db..bd3ab0728 100644 --- a/src/emucore/tia/PaddleReader.hxx +++ b/src/emucore/tia/PaddleReader.hxx @@ -67,8 +67,9 @@ class PaddleReader : public Serializable static constexpr double R0 = 1.8e3, C = 68e-9, - RPOT = 1e6, - USUPP = 5; + R_POT = 1e6, + R_DUMP = 50, + U_SUPP = 5; static constexpr double TRIPPOINT_LINES = 379;