Full-speed: new VideoGetVblBarEx() required when called from main loop

This commit is contained in:
tomcw 2019-11-11 19:55:46 +00:00
parent 8aff6addff
commit 97e73c632d
3 changed files with 16 additions and 3 deletions

View File

@ -357,7 +357,7 @@ static void ContinueExecution(void)
// //
const UINT dwClksPerFrame = NTSC_GetCyclesPerFrame(); const UINT dwClksPerFrame = NTSC_GetCyclesPerFrame();
if (g_dwCyclesThisFrame >= dwClksPerFrame && !VideoGetVblBar(g_dwCyclesThisFrame)) if (g_dwCyclesThisFrame >= dwClksPerFrame && !VideoGetVblBarEx(g_dwCyclesThisFrame))
{ {
g_dwCyclesThisFrame -= dwClksPerFrame; g_dwCyclesThisFrame -= dwClksPerFrame;

View File

@ -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) bool VideoGetVblBar(const DWORD uExecutedCycles)
{ {
if (g_bFullSpeed) if (g_bFullSpeed)
{ {
// Ensure that NTSC video-scanner gets updated during full-speed: // Ensure that NTSC video-scanner gets updated during full-speed, so video-dependent Apple II code doesn't hang
// so that video-dependent Apple II code doesn't hang & video screen can be redraw during VBL
NTSC_VideoClockResync(CpuGetCyclesThisVideoFrame(uExecutedCycles)); NTSC_VideoClockResync(CpuGetCyclesThisVideoFrame(uExecutedCycles));
} }

View File

@ -188,6 +188,7 @@ void VideoReinitialize (bool bInitVideoScannerAddress = true);
void VideoResetState (); void VideoResetState ();
enum VideoScanner_e {VS_FullAddr, VS_PartialAddrV, VS_PartialAddrH}; enum VideoScanner_e {VS_FullAddr, VS_PartialAddrV, VS_PartialAddrH};
WORD VideoGetScannerAddress(DWORD nCycles, VideoScanner_e videoScannerAddr = VS_FullAddr); WORD VideoGetScannerAddress(DWORD nCycles, VideoScanner_e videoScannerAddr = VS_FullAddr);
bool VideoGetVblBarEx(const DWORD dwCyclesThisFrame);
bool VideoGetVblBar(const DWORD uExecutedCycles); bool VideoGetVblBar(const DWORD uExecutedCycles);
bool VideoGetSW80COL(void); bool VideoGetSW80COL(void);