From d521a230bdf7b7fb02ce6d384be52b886059d67b Mon Sep 17 00:00:00 2001 From: Christian Speckner Date: Fri, 20 Jan 2017 01:02:52 +0100 Subject: [PATCH] Introduce a one clock delay on ENAM. Fixes Midnight Magic. --- src/emucore/tia/TIA.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 0fa74b703..56401470d 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -44,6 +44,7 @@ enum Delay: uInt8 { hmclr = 2, refp = 1, enabl = 1, + enam = 1, vblank = 1 }; @@ -449,13 +450,11 @@ bool TIA::poke(uInt16 address, uInt8 value) } case ENAM0: - myLinesSinceChange = 0; - myMissile0.enam(value); + myDelayQueue.push(ENAM0, value, Delay::enam); break; case ENAM1: - myLinesSinceChange = 0; - myMissile1.enam(value); + myDelayQueue.push(ENAM1, value, Delay::enam); break; case RESM0: @@ -1237,6 +1236,16 @@ void TIA::delayedWrite(uInt8 address, uInt8 value) myLinesSinceChange = 0; myBall.enabl(value); break; + + case ENAM0: + myLinesSinceChange = 0; + myMissile0.enam(value); + break; + + case ENAM1: + myLinesSinceChange = 0; + myMissile1.enam(value); + break; } }