Support floating-bus in full-speed mode (#508, #519, #532)

This commit is contained in:
tomcw 2018-02-02 20:19:48 +00:00
parent 62b8b5ac14
commit 2c8f5ce864
5 changed files with 28 additions and 10 deletions

View File

@ -8066,7 +8066,7 @@ void OutputTraceLine ()
if (g_bTraceFileWithVideoScanner)
{
uint16_t addr = NTSC_VideoGetScannerAddress();
uint16_t addr = NTSC_VideoGetScannerAddress(0);
BYTE data = mem[addr];
fprintf( g_hTraceFile,

View File

@ -1625,7 +1625,7 @@ void MemReset()
BYTE MemReadFloatingBus(const ULONG uExecutedCycles)
{
// return mem[ VideoGetScannerAddress(NULL, uExecutedCycles) ]; // NG: ANSI STORY (End Credits) - repro by running from "Turn the disk over"
return mem[ NTSC_VideoGetScannerAddress() ]; // OK: This does the 2-cycle adjust for ANSI STORY (End Credits)
return mem[ NTSC_VideoGetScannerAddress(uExecutedCycles) ]; // OK: This does the 2-cycle adjust for ANSI STORY (End Credits)
}
//===========================================================================

View File

@ -1430,10 +1430,21 @@ uint32_t*NTSC_VideoGetChromaTable( bool bHueTypeMonochrome, bool bMonitorTypeCol
}
//===========================================================================
// NB. NTSC video-scanner doesn't get updated during full-speed, so video-dependent Apple II code can hang
uint16_t NTSC_VideoGetScannerAddress ( void )
void NTSC_VideoClockResync(const DWORD dwCyclesThisFrame)
{
g_nVideoClockVert = (uint16_t) (dwCyclesThisFrame / VIDEO_SCANNER_MAX_HORZ) % VIDEO_SCANNER_MAX_VERT;
g_nVideoClockHorz = (uint16_t) (dwCyclesThisFrame % VIDEO_SCANNER_MAX_HORZ);
}
//===========================================================================
uint16_t NTSC_VideoGetScannerAddress ( const ULONG uExecutedCycles )
{
if (g_bFullSpeed)
{
// Ensure that NTSC video-scanner gets updated during full-speed, so video-dependent Apple II code doesn't hang
NTSC_VideoClockResync( CpuGetCyclesThisVideoFrame(uExecutedCycles) );
}
const uint16_t currVideoClockVert = g_nVideoClockVert;
const uint16_t currVideoClockHorz = g_nVideoClockHorz;

View File

@ -11,7 +11,8 @@
extern void NTSC_SetVideoStyle();
extern void NTSC_SetVideoTextMode( int cols );
extern uint32_t*NTSC_VideoGetChromaTable( bool bHueTypeMonochrome, bool bMonitorTypeColorTV );
extern uint16_t NTSC_VideoGetScannerAddress( void );
extern void NTSC_VideoClockResync( const DWORD dwCyclesThisFrame );
extern uint16_t NTSC_VideoGetScannerAddress( const ULONG uExecutedCycles );
extern void NTSC_VideoInit( uint8_t *pFramebuffer );
extern void NTSC_VideoReinitialize( DWORD cyclesThisFrame );
extern void NTSC_VideoInitAppleType();

View File

@ -567,10 +567,16 @@ void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit /*=fal
void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame)
{
const int nScanLines = bVideoScannerNTSC ? kNTSCScanLines : kPALScanLines;
g_nVideoClockVert = (uint16_t) (dwCyclesThisFrame / kHClocks) % nScanLines;
g_nVideoClockHorz = (uint16_t) (dwCyclesThisFrame % kHClocks);
if (bVideoScannerNTSC)
{
NTSC_VideoClockResync(dwCyclesThisFrame);
}
else // PAL
{
_ASSERT(0);
g_nVideoClockVert = (uint16_t) (dwCyclesThisFrame / kHClocks) % kPALScanLines;
g_nVideoClockHorz = (uint16_t) (dwCyclesThisFrame % kHClocks);
}
VideoRedrawScreen(); // Better (no flicker) than using: NTSC_VideoReinitialize() or VideoReinitialize()
}