mirror of https://github.com/FDOS/kernel.git
Reorganized GetBiosKey a bit -- inlining GetBiosTime saves a slight amount
of code, converted timeout < 0 to a blocking read instead of polling. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@958 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
c0f1c45d1f
commit
b3a2d6bfde
|
@ -741,10 +741,7 @@ STATIC struct table * LookUp(struct table *p, BYTE * token)
|
||||||
0x..LL : asciicode in lower half
|
0x..LL : asciicode in lower half
|
||||||
*/
|
*/
|
||||||
|
|
||||||
STATIC ULONG GetBiosTime(VOID)
|
#define GetBiosTime() peekl(0, 0x46c)
|
||||||
{
|
|
||||||
return *(ULONG FAR *) (MK_FP(0x40, 0x6c));
|
|
||||||
}
|
|
||||||
|
|
||||||
UWORD GetBiosKey(int timeout)
|
UWORD GetBiosKey(int timeout)
|
||||||
{
|
{
|
||||||
|
@ -752,26 +749,19 @@ UWORD GetBiosKey(int timeout)
|
||||||
|
|
||||||
ULONG startTime = GetBiosTime();
|
ULONG startTime = GetBiosTime();
|
||||||
|
|
||||||
for (;;)
|
if (timeout >= 0) do
|
||||||
{
|
{
|
||||||
r.a.x = 0x0100; /* are there keys available ? */
|
r.a.x = 0x0100; /* are there keys available ? */
|
||||||
init_call_intr(0x16, &r);
|
init_call_intr(0x16, &r);
|
||||||
|
if ((unsigned)(GetBiosTime() - startTime) >= timeout * 18u)
|
||||||
if ((r.flags & 0x40) == 0) /* yes - fetch and return */
|
return 0xffff;
|
||||||
{
|
|
||||||
r.a.x = 0x0000;
|
|
||||||
init_call_intr(0x16, &r);
|
|
||||||
|
|
||||||
return r.a.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (timeout < 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (GetBiosTime() - startTime >= (unsigned)timeout * 18)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return 0xffff;
|
while (r.flags & FLG_ZERO);
|
||||||
|
|
||||||
|
/* key available or blocking wait (timeout < 0): fetch it */
|
||||||
|
r.a.x = 0x0000;
|
||||||
|
init_call_intr(0x16, &r);
|
||||||
|
return r.a.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC BOOL SkipLine(char *pLine)
|
STATIC BOOL SkipLine(char *pLine)
|
||||||
|
|
Loading…
Reference in New Issue