On 5/15/07, tom ehlert <[EMAIL PROTECTED]> wrote:

> > 1. config.c. Why use > instead of >=? Is there a corner case with equality?
>
> IMO >= is correct (timeout 0 should exit immediately)

Hmm, after reading
http://osdir.com/ml/emulators.freedos.kernel/2004-06/msg00101.html
I think you really wanted > :-)

But a more obvious fix (and also more correct in case int8 fires up
exactly between the calculation of StartTime and the first test in the
loop is:

--- config.c.~1.95.~    2007-05-20 21:14:20.000000000 -0400
+++ config.c    2007-05-22 22:29:17.000000000 -0400
@@ -753,10 +753,13 @@
   {
     r.a.x = 0x0100;             /* are there keys available ? */
     init_call_intr(0x16, &r);
+    /* test for "key pressed?" *before* the timeout in case timeout == 0 */
+    if (!(r.flags & FLG_ZERO))
+      break;
     if ((unsigned)(GetBiosTime() - startTime) >= timeout * 18u)
       return 0xffff;
   }
-  while (r.flags & FLG_ZERO);
+  while (1);

   /* key available or blocking wait (timeout < 0): fetch it */
   r.a.x = 0x0000;


Bart

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freedos-kernel mailing list
Freedos-kernel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to