diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 7c2acb39e..803ca1e1d 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -45,7 +45,8 @@ enum Delay: uInt8 { hmm = 2, hmbl = 2, hmclr = 2, - refp = 1 + refp = 1, + vblank = 1 }; enum DummyRegisters: uInt8 { @@ -355,16 +356,14 @@ bool TIA::poke(uInt16 address, uInt8 value) break; case VBLANK: - myLinesSinceChange = 0; - myInput0.vblank(value); myInput1.vblank(value); - myFrameManager.setVblank(value & 0x02); - for (PaddleReader& paddleReader : myPaddleReaders) paddleReader.vblank(value, myTimestamp); + myDelayQueue.push(VBLANK, value, Delay::vblank); + break; case AUDV0: @@ -1107,6 +1106,11 @@ void TIA::delayedWrite(uInt8 address, uInt8 value) { switch (address) { + case VBLANK: + myLinesSinceChange = 0; + myFrameManager.setVblank(value & 0x02); + break; + case HMOVE: myLinesSinceChange = 0;