diff --git a/src/emucore/Props.cxx b/src/emucore/Props.cxx index 3b168f95a..b97292219 100644 --- a/src/emucore/Props.cxx +++ b/src/emucore/Props.cxx @@ -321,7 +321,7 @@ const char* Properties::ourDefaultProperties[LastPropType] = { "NO", // Controller.SwapPaddles "AUTO", // Controller.MouseAxis "AUTO", // Display.Format - "34", // Display.YStart + "0", // Display.YStart "210", // Display.Height "NO", // Display.Phosphor "77" // Display.PPBlend diff --git a/src/emucore/tia/FrameManager.cxx b/src/emucore/tia/FrameManager.cxx index ef9649aac..5af3a82ab 100644 --- a/src/emucore/tia/FrameManager.cxx +++ b/src/emucore/tia/FrameManager.cxx @@ -44,7 +44,8 @@ static constexpr uInt32 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FrameManager::FrameManager() - : myMode(TvMode::pal) + : myMode(TvMode::pal), + myYstart(0) { setTvMode(TvMode::ntsc); reset(); @@ -73,11 +74,12 @@ void FrameManager::reset() myTotalFrames = 0; myFramesInMode = 0; myModeConfirmed = false; - myVblankMode = VblankMode::floating; myLastVblankLines = 0; myVblankViolations = 0; myStableVblankFrames = 0; myVblankViolated = false; + + if (myVblankMode == VblankMode::locked) myVblankMode = VblankMode::floating; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -153,9 +155,28 @@ void FrameManager::nextLineInVsync() myVblankMode = VblankMode::floating; break; + + case VblankMode::fixed: + if (myLineInState > myYstart) setState(State::frame); + break; } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void FrameManager::setYstart(uInt32 ystart) +{ + if (ystart == myYstart) return; + + myYstart = ystart; + + myVblankMode = ystart ? VblankMode::fixed : VblankMode::floating; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt32 FrameManager::ystart() const { + return myYstart; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FrameManager::setVblank(bool vblank) { diff --git a/src/emucore/tia/FrameManager.hxx b/src/emucore/tia/FrameManager.hxx index c534aca84..f71bfbb7d 100644 --- a/src/emucore/tia/FrameManager.hxx +++ b/src/emucore/tia/FrameManager.hxx @@ -65,6 +65,10 @@ class FrameManager : public Serializable float frameRate() const { return myFrameRate; } + void setYstart(uInt32 ystart); + + uInt32 ystart() const; + /** Serializable methods (see that class for more information). */ @@ -87,7 +91,8 @@ class FrameManager : public Serializable enum VblankMode { locked, - floating + floating, + fixed }; private: @@ -127,6 +132,7 @@ class FrameManager : public Serializable VblankMode myVblankMode; uInt32 myLastVblankLines; + uInt32 myYstart; uInt8 myVblankViolations; uInt8 myStableVblankFrames; bool myVblankViolated; diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 2e0a297fc..534fd72d6 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -619,7 +619,7 @@ uInt32 TIA::height() const // TODO: stub uInt32 TIA::ystart() const { - return 0; + return myFrameManager.ystart(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -632,6 +632,7 @@ void TIA::setHeight(uInt32 height) // TODO: stub void TIA::setYStart(uInt32 ystart) { + myFrameManager.setYstart(ystart); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -