From a6bc2478526ef4768c6372d03b86d7296fe09d9b Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Mon, 19 Dec 2016 15:56:26 -0330 Subject: [PATCH] WSYNC should only work when the last access was a read. --- src/emucore/tia/TIA.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 423fe3063..cf6a4f12b 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -347,9 +347,15 @@ bool TIA::poke(uInt16 address, uInt8 value) switch (address) { case WSYNC: - mySubClock += (228 - myHctr) % 228; - mySystem->incrementCycles(mySubClock / 3); - mySubClock %= 3; + // It appears that the 6507 only halts during a read cycle so + // we test here for follow-on writes which should be ignored as + // far as halting the processor is concerned. + if (mySystem->m6502().lastAccessWasRead()) + { + mySubClock += (228 - myHctr) % 228; + mySystem->incrementCycles(mySubClock / 3); + mySubClock %= 3; + } break; case VSYNC: