From d49a1c16b2f24ad7631952575a6411a8f1ec49dd Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sat, 30 Nov 2013 03:59:26 +0000 Subject: [PATCH] [NTVDM] Fix the PIT square wave generator. svn path=/branches/ntvdm/; revision=61151 --- subsystems/ntvdm/timer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/subsystems/ntvdm/timer.c b/subsystems/ntvdm/timer.c index 1cdceafdf55..3f813fc3cbc 100644 --- a/subsystems/ntvdm/timer.c +++ b/subsystems/ntvdm/timer.c @@ -277,12 +277,12 @@ VOID PitDecrementCount(DWORD Count) } else { - /* Clear the count */ - Count = 0; - /* Decrease the value */ PitChannels[i].CurrentValue -= Count * 2; + /* Clear the count */ + Count = 0; + /* Did it fall to zero? */ if (PitChannels[i].CurrentValue == 0) { @@ -304,7 +304,9 @@ VOID PitDecrementCount(DWORD Count) } /* Was there any rising edge on channel 0 ? */ - if ((PitChannels[i].OutputFlipFlop || ReloadCount) && (i == 0)) + if (((PitChannels[i].OutputFlipFlop && (ReloadCount == 1)) + || (ReloadCount > 1)) + && (i == 0)) { /* Yes, IRQ 0 */ PicInterruptRequest(0);