diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index 864c7c00..eb8419f5 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -8080,7 +8080,7 @@ void OutputTraceLine () if (g_bTraceFileWithVideoScanner) { - uint16_t addr = NTSC_VideoGetScannerAddress(0); + uint16_t addr = NTSC_VideoGetScannerAddress(); BYTE data = mem[addr]; fprintf( g_hTraceFile, diff --git a/source/Memory.cpp b/source/Memory.cpp index 1ddba2f1..b1378c61 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -1507,34 +1507,24 @@ BYTE MemReadFloatingBus(const ULONG uExecutedCycles) { #if 0 // NTSC: It is tempting to replace with - // return NTSC_VideoGetScannerAddress( uExecutedCycles ); + // return NTSC_VideoGetScannerAddress( ); // But that breaks "Rainbow" Bug #254 if NTSC_VideoGetScannerAddress() is not correct. // This is out of sync with VideoGetScannerAddress() due to two reasons: // a) returning a cached copy of g_aHorzClockMemAddress // Fixed by calling: updateVideoScannerAddressTXT or updateVideoScannerAddressHGR() // b) A bug? in APPLE_IIE_HORZ_CLOCK_OFFSET[0][8] containing the incorrect value of 0x006F - uint16_t addr1 = NTSC_VideoGetScannerAddress( uExecutedCycles ); + uint16_t addr1 = NTSC_VideoGetScannerAddress(); uint16_t addr2 = VideoGetScannerAddress(NULL, uExecutedCycles); - uint8_t byte1 = mem[ addr1 ]; - uint8_t byte2 = mem[ addr2 ]; - - if( byte1 != byte2 ) - mem[ 0x2000 ] ^= 0xFF; + _ASSERT(addr1 == addr2); #endif - // return mem[ VideoGetScannerAddress(NULL, uExecutedCycles) ]; - uint16_t addr = NTSC_VideoGetScannerAddress( uExecutedCycles ); - return mem[ addr ] ; // cycles is ignored + return mem[ VideoGetScannerAddress(NULL, uExecutedCycles) ]; } //=========================================================================== BYTE MemReadFloatingBus(const BYTE highbit, const ULONG uExecutedCycles) { - // NTSC: It is tempting to replace with - // return NTSC_VideoGetScannerAddress( uExecutedCycles ); - // But that breaks "Rainbow" Bug #254 - // BYTE r= NTSC_VideoGetByte( uExecutedCycles ); - BYTE r = *(LPBYTE)(mem + VideoGetScannerAddress(NULL, uExecutedCycles)); + BYTE r = MemReadFloatingBus(uExecutedCycles); return (r & ~0x80) | ((highbit) ? 0x80 : 0); } diff --git a/source/NTSC.cpp b/source/NTSC.cpp index ed4e33f5..3bd43517 100644 --- a/source/NTSC.cpp +++ b/source/NTSC.cpp @@ -287,7 +287,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA static unsigned APPLE_IIE_HORZ_CLOCK_OFFSET[5][VIDEO_SCANNER_MAX_HORZ] = { - {0x0068,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, // bug? 0x106F + {0x0068,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, // bug? 0x106F - see comment in Memory.cpp, MemReadFloatingBus(const ULONG) 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -1475,12 +1475,12 @@ uint32_t*NTSC_VideoGetChromaTable( bool bHueTypeMonochrome, bool bMonitorTypeCol } //=========================================================================== -uint16_t NTSC_VideoGetScannerAddress ( unsigned long cycles6502 ) -{ - (void)cycles6502; - int nHires = (g_uVideoMode & VF_HIRES) && !(g_uVideoMode & VF_TEXT); // (SW_HIRES && !SW_TEXT) ? 1 : 0; - if( nHires ) +// NB. NTSC video-scanner doesn't get updated during full-speed, so video-dependent Apple II code can hang +uint16_t NTSC_VideoGetScannerAddress ( void ) +{ + bool bHires = (g_uVideoMode & VF_HIRES) && !(g_uVideoMode & VF_TEXT); // SW_HIRES && !SW_TEXT + if( bHires ) updateVideoScannerAddressHGR(); else updateVideoScannerAddressTXT(); @@ -1752,7 +1752,7 @@ void NTSC_VideoInitChroma() //=========================================================================== -// NB. NTSC video-scanner doesn't get updated during full-speed, so video-dependent code can hang +// NB. NTSC video-scanner doesn't get updated during full-speed, so video-dependent Apple II code can hang //bool NTSC_VideoIsVbl () //{ // return (g_nVideoClockVert >= VIDEO_SCANNER_Y_DISPLAY) && (g_nVideoClockVert < VIDEO_SCANNER_MAX_VERT); diff --git a/source/NTSC.h b/source/NTSC.h index d652b67b..58f851d6 100644 --- a/source/NTSC.h +++ b/source/NTSC.h @@ -11,7 +11,7 @@ extern void NTSC_SetVideoStyle(); extern void NTSC_SetVideoTextMode( int cols ); extern uint32_t*NTSC_VideoGetChromaTable( bool bHueTypeMonochrome, bool bMonitorTypeColorTV ); - extern uint16_t NTSC_VideoGetScannerAddress( unsigned long cycles6502 ); + extern uint16_t NTSC_VideoGetScannerAddress( void ); extern void NTSC_VideoInit( uint8_t *pFramebuffer ); extern void NTSC_VideoReinitialize( DWORD cyclesThisFrame ); extern void NTSC_VideoInitAppleType(); diff --git a/source/Video.cpp b/source/Video.cpp index 2d66095f..055c6846 100644 --- a/source/Video.cpp +++ b/source/Video.cpp @@ -886,7 +886,7 @@ BYTE VideoCheckVbl ( ULONG uExecutedCycles ) bool bVblBar = VideoGetVblBar(uExecutedCycles); // NTSC: It is tempting to replace with // bool bVblBar = !NTSC_VideoIsVbl(); - // But during full-speed, the NTSC video-scanner is not updated, so video-dependent code can hang + // But during full-speed, the NTSC video-scanner is not updated, so video-dependent Apple II code can hang BYTE r = KeybGetKeycode(); return (r & ~0x80) | (bVblBar ? 0x80 : 0);