From c1441679a5947cfbbadf4ca912c23311d1386ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 27 Sep 2014 15:31:12 +0000 Subject: [PATCH] [NTVDM]: Timer - Add a hack for the signal out so that, when the PIT gate is off, no callback is called. This should be improved so that also no Out state is set, and other things too. - Really set the out signal when the flipflop changes, in square-wave mode. Contributes to fix the speaker (see next commit). svn path=/trunk/; revision=64344 --- reactos/subsystems/ntvdm/hardware/timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/subsystems/ntvdm/hardware/timer.c b/reactos/subsystems/ntvdm/hardware/timer.c index 87f68634479..dcf1f34030b 100644 --- a/reactos/subsystems/ntvdm/hardware/timer.c +++ b/reactos/subsystems/ntvdm/hardware/timer.c @@ -79,6 +79,7 @@ static VOID PitSetOut(PPIT_CHANNEL Channel, BOOLEAN State) Channel->Out = State; /* Call the callback */ + if (!Channel->Gate) return; // HACK: This is a HACK until gates are properly used (needed for the speaker to work properly). if (Channel->OutFunction) Channel->OutFunction(Channel->OutParam, State); } @@ -423,7 +424,7 @@ static VOID PitDecrementCount(PPIT_CHANNEL Channel, DWORD Count) if (ReloadCount & 1) { Channel->FlipFlop = !Channel->FlipFlop; - // PitSetOut(Channel, !Channel->Out); + PitSetOut(Channel, !Channel->Out); } /* Was there any rising edge? */