From 5fa8f24fb7dfe833bdd328465d29c5200749060e Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Mon, 28 May 2007 18:01:59 +0000 Subject: [PATCH] Fix zero timeouts for GetBiosKey (F5/F8 handling). git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1332 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/config.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/kernel/config.c b/kernel/config.c index 1a86e54..d99289e 100644 --- a/kernel/config.c +++ b/kernel/config.c @@ -749,16 +749,20 @@ UWORD GetBiosKey(int timeout) ULONG startTime = GetBiosTime(); - if (timeout >= 0) do + if (timeout >= 0) { - r.a.x = 0x0100; /* are there keys available ? */ - init_call_intr(0x16, &r); - if ((unsigned)(GetBiosTime() - startTime) >= timeout * 18u) - return 0xffff; + do + { + r.a.x = 0x0100; /* are there keys available ? */ + init_call_intr(0x16, &r); + if (!(r.flags & FLG_ZERO)) + return r.a.x; + } + while ((unsigned)(GetBiosTime() - startTime) < timeout * 18u); + return 0xffff; } - while (r.flags & FLG_ZERO); - /* key available or blocking wait (timeout < 0): fetch it */ + /* blocking wait (timeout < 0): fetch it */ r.a.x = 0x0000; init_call_intr(0x16, &r); return r.a.x;