* [Patch] Fix DOS get time function.
@ 2007-11-16 2:56 James Courtier-Dutton
2007-11-19 22:44 ` Bart Oldeman
0 siblings, 1 reply; 2+ messages in thread
From: James Courtier-Dutton @ 2007-11-16 2:56 UTC (permalink / raw)
To: linux-msdos
[-- Attachment #1: Type: text/plain, Size: 281 bytes --]
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@superbug.co.uk
James
[-- Attachment #2: time-fix.diff --]
[-- Type: text/x-patch, Size: 561 bytes --]
--- 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch] Fix DOS get time function.
2007-11-16 2:56 [Patch] Fix DOS get time function James Courtier-Dutton
@ 2007-11-19 22:44 ` Bart Oldeman
0 siblings, 0 replies; 2+ messages in thread
From: Bart Oldeman @ 2007-11-19 22:44 UTC (permalink / raw)
To: James Courtier-Dutton; +Cc: linux-msdos
On Nov 16, 2007 3:56 PM, James Courtier-Dutton <James@superbug.co.uk> wrote:
> 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
Hi James,
I'm afraid you were emailing the wrong list (dosemu): dosbox has its
own forum and sourceforge trackers.
Bart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-19 22:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-16 2:56 [Patch] Fix DOS get time function James Courtier-Dutton
2007-11-19 22:44 ` Bart Oldeman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox