Full-speed: Only redraw video screen during VBl (support VBl in full-speed)

This commit is contained in:
tomcw 2019-11-10 23:52:29 +00:00
parent dd3ecf738f
commit 20b8515b7b
3 changed files with 8 additions and 18 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()) if (g_dwCyclesThisFrame >= dwClksPerFrame && !VideoGetVblBar(g_dwCyclesThisFrame))
{ {
g_dwCyclesThisFrame -= dwClksPerFrame; g_dwCyclesThisFrame -= dwClksPerFrame;

View File

@ -873,24 +873,15 @@ WORD VideoGetScannerAddress(DWORD nCycles, VideoScanner_e videoScannerAddr /*= V
//=========================================================================== //===========================================================================
// TODO: Consider replacing simply with: return g_nVideoClockVert < kVDisplayableScanLines
// - will this work in full-speed mode?
bool VideoGetVblBar(const DWORD uExecutedCycles) bool VideoGetVblBar(const DWORD uExecutedCycles)
{ {
// get video scanner position if (g_bFullSpeed)
int nCycles = CpuGetCyclesThisVideoFrame(uExecutedCycles); {
// 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
NTSC_VideoClockResync(CpuGetCyclesThisVideoFrame(uExecutedCycles));
}
// calculate video parameters according to display standard
const int kScanLines = g_bVideoScannerNTSC ? kNTSCScanLines : kPALScanLines;
const int kScanCycles = kScanLines * kHClocks;
nCycles %= kScanCycles;
// VBL'
return nCycles < kVDisplayableScanLines * kHClocks;
}
bool VideoGetVblBar(void)
{
return g_nVideoClockVert < kVDisplayableScanLines; return g_nVideoClockVert < kVDisplayableScanLines;
} }

View File

@ -188,8 +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 VideoGetVblBar(DWORD uExecutedCycles); bool VideoGetVblBar(const DWORD uExecutedCycles);
bool VideoGetVblBar(void);
bool VideoGetSW80COL(void); bool VideoGetSW80COL(void);
bool VideoGetSWDHIRES(void); bool VideoGetSWDHIRES(void);