diff --git a/src/emucore/tia/frame-manager/FrameManager.cxx b/src/emucore/tia/frame-manager/FrameManager.cxx index 3514b93f7..55d94115c 100644 --- a/src/emucore/tia/frame-manager/FrameManager.cxx +++ b/src/emucore/tia/frame-manager/FrameManager.cxx @@ -243,8 +243,8 @@ void FrameManager::recalculateMetrics() { throw runtime_error("frame manager: invalid TV mode"); } - myHeight = baseHeight + myAdjustScanlines * 2; - myYStart = std::max(0, ystartBase + (baseHeight - static_cast(myHeight)) / 2 + myVcenter); + myHeight = BSPF::clamp(baseHeight + myAdjustScanlines * 2, 0, myFrameLines); + myYStart = BSPF::clamp(ystartBase + (baseHeight - static_cast(myHeight)) / 2 + myVcenter, 0, myFrameLines); myJitterEmulation.setYStart(myYStart); }