[Patch] Fix DOS get time function.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

The current DOS INT 21 AH=2C get time function returns incorrect results, and is sometimes hours off.
The attached patch fixes the problem.
It should patch against DOSBOX 0.72
the (X * 500 / 91)  is the same as  X * 100 / 18.2


Signed-off-by:  James@xxxxxxxxxxxxxx

James

--- src/dos/dos.cpp.org	2007-11-16 02:46:35.000000000 +0000
+++ src/dos/dos.cpp	2007-11-16 02:54:50.000000000 +0000
@@ -348,8 +348,9 @@
 //TODO Get time through bios calls date is fixed
 		{
 /*	Calculate how many miliseconds have passed */
-			Bitu ticks=5*mem_readd(BIOS_TIMER);
-			ticks = ((ticks / 59659u) << 16) + ((ticks % 59659u) << 16) / 59659u;
+			/* seconds = ticks / 18.2 */
+			Bitu ticks=500 * mem_readd(BIOS_TIMER);
+			ticks = ticks / 91;
 			Bitu seconds=(ticks/100);
 			reg_ch=(Bit8u)(seconds/3600);
 			reg_cl=(Bit8u)((seconds % 3600)/60);

[Index of Archives]     [Linux Console]     [Linux Audio]     [Linux for Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Camping]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Samba]     [Linux Media]     [Fedora Users]

  Powered by Linux