diff --git a/source/Applewin.cpp b/source/Applewin.cpp index 9670fe70..4d76f89a 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -357,7 +357,7 @@ static void ContinueExecution(void) // const UINT dwClksPerFrame = NTSC_GetCyclesPerFrame(); - if (g_dwCyclesThisFrame >= dwClksPerFrame && !VideoGetVblBar(g_dwCyclesThisFrame)) + if (g_dwCyclesThisFrame >= dwClksPerFrame && !VideoGetVblBarEx(g_dwCyclesThisFrame)) { g_dwCyclesThisFrame -= dwClksPerFrame; diff --git a/source/Video.cpp b/source/Video.cpp index 7f9b83ac..431b7351 100644 --- a/source/Video.cpp +++ b/source/Video.cpp @@ -873,12 +873,24 @@ WORD VideoGetScannerAddress(DWORD nCycles, VideoScanner_e videoScannerAddr /*= V //=========================================================================== +// Called when *outside* of CpuExecute() +bool VideoGetVblBarEx(const DWORD dwCyclesThisFrame) +{ + if (g_bFullSpeed) + { + // Ensure that NTSC video-scanner gets updated during full-speed, so video screen can be redrawn during Apple II VBL + NTSC_VideoClockResync(dwCyclesThisFrame); + } + + return g_nVideoClockVert < kVDisplayableScanLines; +} + +// Called when *inside* CpuExecute() bool VideoGetVblBar(const DWORD uExecutedCycles) { if (g_bFullSpeed) { - // Ensure that NTSC video-scanner gets updated during full-speed: - // so that video-dependent Apple II code doesn't hang & video screen can be redraw during VBL + // Ensure that NTSC video-scanner gets updated during full-speed, so video-dependent Apple II code doesn't hang NTSC_VideoClockResync(CpuGetCyclesThisVideoFrame(uExecutedCycles)); } diff --git a/source/Video.h b/source/Video.h index 3a06ec56..f5112109 100644 --- a/source/Video.h +++ b/source/Video.h @@ -188,6 +188,7 @@ void VideoReinitialize (bool bInitVideoScannerAddress = true); void VideoResetState (); enum VideoScanner_e {VS_FullAddr, VS_PartialAddrV, VS_PartialAddrH}; WORD VideoGetScannerAddress(DWORD nCycles, VideoScanner_e videoScannerAddr = VS_FullAddr); +bool VideoGetVblBarEx(const DWORD dwCyclesThisFrame); bool VideoGetVblBar(const DWORD uExecutedCycles); bool VideoGetSW80COL(void);