1
0
Fork 0

timer mode 0 counter after passing terminal count update by h-a-l-9000.(Fixes Archon Ultra and The Horde)

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2624
This commit is contained in:
Peter Veenstra 2006-05-18 11:25:46 +00:00
parent c473b81217
commit 8ece9230da

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: timer.cpp,v 1.36 2006-04-11 12:02:09 qbix79 Exp $ */
/* $Id: timer.cpp,v 1.37 2006-05-18 11:25:46 qbix79 Exp $ */
#include <math.h>
#include "dosbox.h"
@ -126,8 +126,13 @@ static void counter_latch(Bitu counter) {
/* Counter keeps on counting after passing terminal count */
if (index>p->delay) {
index-=p->delay;
index=fmod(index,(1000.0/PIT_TICK_RATE)*0x1000);
p->read_latch=(Bit16u)(0xffff-index*0xffff);
if(p->bcd) {
index = fmod(index,(1000.0/PIT_TICK_RATE)*10000.0);
p->read_latch = (Bit16u)(9999-index*(PIT_TICK_RATE/1000.0));
} else {
index = fmod(index,(1000.0/PIT_TICK_RATE)*(double)0x10000);
p->read_latch = (Bit16u)(0xffff-index*(PIT_TICK_RATE/1000.0));
}
} else {
p->read_latch=(Bit16u)(p->cntr-index*(PIT_TICK_RATE/1000.0));
}