mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-22 09:30:15 +00:00
Fix video tearing by only updating during the Apple II VBL (#711)
This commit is contained in:
parent
d92eca5068
commit
4ad0923399
@ -356,7 +356,7 @@ static void ContinueExecution(void)
|
||||
//
|
||||
|
||||
const UINT dwClksPerFrame = NTSC_GetCyclesPerFrame();
|
||||
if (g_dwCyclesThisFrame >= dwClksPerFrame)
|
||||
if (g_dwCyclesThisFrame >= dwClksPerFrame && !VideoGetVblBar())
|
||||
{
|
||||
g_dwCyclesThisFrame -= dwClksPerFrame;
|
||||
|
||||
|
@ -2003,8 +2003,12 @@ void NTSC_VideoInit( uint8_t* pFramebuffer ) // wsVideoInit
|
||||
//===========================================================================
|
||||
void NTSC_VideoReinitialize( DWORD cyclesThisFrame, bool bInitVideoScannerAddress )
|
||||
{
|
||||
_ASSERT(cyclesThisFrame < g_videoScanner6502Cycles);
|
||||
if (cyclesThisFrame >= g_videoScanner6502Cycles) cyclesThisFrame = 0; // error
|
||||
if (cyclesThisFrame >= g_videoScanner6502Cycles)
|
||||
{
|
||||
// Possible, since ContinueExecution() loop waits until: cycles > g_videoScanner6502Cycles && VBL
|
||||
cyclesThisFrame %= g_videoScanner6502Cycles;
|
||||
}
|
||||
|
||||
g_nVideoClockVert = (uint16_t) (cyclesThisFrame / VIDEO_SCANNER_MAX_HORZ);
|
||||
g_nVideoClockHorz = cyclesThisFrame % VIDEO_SCANNER_MAX_HORZ;
|
||||
|
||||
|
@ -874,6 +874,7 @@ 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)
|
||||
{
|
||||
// get video scanner position
|
||||
@ -888,6 +889,11 @@ bool VideoGetVblBar(const DWORD uExecutedCycles)
|
||||
return nCycles < kVDisplayableScanLines * kHClocks;
|
||||
}
|
||||
|
||||
bool VideoGetVblBar(void)
|
||||
{
|
||||
return g_nVideoClockVert < kVDisplayableScanLines;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
#define MAX_DRAW_DEVICES 10
|
||||
|
@ -189,6 +189,7 @@ void VideoResetState ();
|
||||
enum VideoScanner_e {VS_FullAddr, VS_PartialAddrV, VS_PartialAddrH};
|
||||
WORD VideoGetScannerAddress(DWORD nCycles, VideoScanner_e videoScannerAddr = VS_FullAddr);
|
||||
bool VideoGetVblBar(DWORD uExecutedCycles);
|
||||
bool VideoGetVblBar(void);
|
||||
|
||||
bool VideoGetSW80COL(void);
|
||||
bool VideoGetSWDHIRES(void);
|
||||
|
Loading…
Reference in New Issue
Block a user