🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #1295

Slow kbhit() fix

#1295
From: Geoffrey Broadwell
Date: Mon, 19 Feb 1990 04:43
19 lines
1283 bytes
I just caught an article referring to the fact that kbhit() is annoyingly
slow.  I have noticed this myself, and came up with the following function
that responds quite a bit faster (I'm sure someone will one-up its speed,
but what the hell -- it's simple! :-) ).

char keypress(void)
{
 _AH=0x01;
 geninterrupt(0x16);
 return(~_FLAGS&0x40);
}

I wrote it using TurboC 2.0, so if your compiler is different, the syntax
is probably somewhat different, though it should be easily translatable.
Good luck.
BTW, I would be interested in being one-upped, if anyone is willing. :-)

					-'f
					(Geoffrey Broadwell)
Technical Details
Message-ID: <22242@pasteur.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!brutus.cs.uiuc.edu!samsung!cs.utexas.edu!hellgate.utah.edu!helios.ee.lbl.gov!pasteur!buddy.Berkeley.EDU!c60b-hk
References: <I3S1182xds13@ficc.uu.net> <29@demott.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!brutus.cs.uiuc.edu!samsung!cs.utexas.edu!hellgate.utah.edu!helios.ee.lbl.gov!pasteur!buddy.Berkeley.EDU!c60b-hk
From: c60b-hk@buddy.Berkeley.EDU (Geoffrey Broadwell)
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Slow kbhit() fix
Summary: Use Interrupt 0x16
Keywords: kbhit()
Message-ID: <22242@pasteur.Berkeley.EDU>
Date: 19 Feb 90 04:43:57 GMT
References: <I3S1182xds13@ficc.uu.net> <29@demott.COM>
Sender: news@pasteur.Berkeley.EDU
Reply-To: c60b-hk@buddy.Berkeley.EDU.UUCP (Geoffrey Broadwell)
Distribution: usa
Organization: University of California, Berkeley
Lines: 19