🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #899

Re: Summary: How to flush keyboard buffer

#899
From: Jon K. Salmon
Date: Fri, 14 Aug 1992 01:43
25 lines
1391 bytes
brown@NCoast.ORG (Stan Brown) writes:

>> while (kbhit()) getch();
>> while (bioskey(1)) bioskey(0);

> These two are very likely the same thing.  If they are implemented in
> the obvious way, however, they will miss keystrokes like F12.

The kbhit/getch version uses DOS calls (Int 21h, func. 0Bh and 07h,
respectively).  Note that the getch routine also contains support for
the ungetch function.

The bioskey routine calls BIOS (Int 16h, func. 01h and 00h).

True, an F12 keypress will not be detected by these calls; the BIOS
functions (0 and 1) will "automatically" ignore such keypresses.  Note
that Int 16h, functions 10h and 11h, on the other hand WILL grab such
keys.  However, since the goal is to flush the buffer, the bioskey
functions work just fine.  Note, furthermore, that Borland has NOT
implemented the 10h and 11h calls; i.e. you cannot simply call
bioskey(10h) to read an F12 keypress.

-- Jon
-- 
Technical Details
Message-ID: <1992Aug14.014304.27238@news.ysu.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!usenet.ins.cwru.edu!news.ysu.edu!do-not-reply-to-path

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!usenet.ins.cwru.edu!news.ysu.edu!do-not-reply-to-path
From: af458@yfn.ysu.edu (Jon K. Salmon)
Subject: Re: Summary: How to flush keyboard buffer
Message-ID: <1992Aug14.014304.27238@news.ysu.edu>
Sender: news@news.ysu.edu (Usenet News Admin)
Nntp-Posting-Host: yfn
Organization: Youngstown State University/Youngstown Free-Net
Date: Fri, 14 Aug 1992 01:43:04 GMT
Lines: 25