From 4d8ea88a53e12d64ae0eb33b69b959c5604411b1 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Thu, 4 Jan 2007 15:27:38 +0000 Subject: [PATCH] Back to the generic PDC_napms() for DOS -- the uclock() thing doesn't work reliably. --- dos/pdcutil.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/dos/pdcutil.c b/dos/pdcutil.c index 1c7b2899..701bd89b 100644 --- a/dos/pdcutil.c +++ b/dos/pdcutil.c @@ -13,13 +13,7 @@ #include "pdcdos.h" -#ifdef __DJGPP__ -# include -#endif - -#include - -RCSID("$Id: pdcutil.c,v 1.19 2007/01/01 21:04:27 wmcbrine Exp $"); +RCSID("$Id: pdcutil.c,v 1.20 2007/01/04 15:27:38 wmcbrine Exp $"); void PDC_beep(void) { @@ -32,34 +26,22 @@ void PDC_beep(void) PDCINT(0x10, regs); } -#ifdef __DJGPP__ -# define PDCCLOCK_T uclock_t -# define PDCCLOCK() uclock() -#else -# define PDCCLOCK_T long -# define PDCCLOCK() getdosmemdword(0x46c) -#endif - void PDC_napms(int ms) { PDCREGS regs; - PDCCLOCK_T goal, start, current; + long goal, start, current; PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); -#ifdef __DJGPP__ - goal = (PDCCLOCK_T)ms * UCLOCKS_PER_SEC / 1000; -#else - goal = DIVROUND((PDCCLOCK_T)ms, 50); -#endif + goal = DIVROUND((long)ms, 50); if (!goal) goal++; - start = PDCCLOCK(); + start = getdosmemdword(0x46c); goal += start; - while (goal > (current = PDCCLOCK())) + while (goal > (current = getdosmemdword(0x46c))) { if (current < start) /* in case of midnight reset */ return;