[comp.os.msdos.programmer] Polling keyboard

Aamir.Zakaria@samba.acs.unc.edu (BBS Account) (08/29/90)

Can anyone tell me how, in either C or assembly language (8088), I can poll
the keyboard for character input without actually waiting for input, i.e.
just check if the user has hit a key.


Thanks!

david@gisatl.FIDONET.ORG (David Deitch) (09/01/90)

In a message of <Aug 29 04:58> BBS Account (Aamir.Zakaria@samba.acs.unc.edu ) writes:

 > Can anyone tell me how, in either C or assembly language (8088), I can 
 > poll
 > the keyboard for character input without actually waiting for input, 
 > i.e.
 > just check if the user has hit a key.

     One of the INT 16 interrupts does this, but off the top of my 
head I can not remember which one.  It will return the scan/key code 
of the key pressed or empty registers if none has been pressed.  If 
it has been pressed, it is not taken out of the keyboard buffer.  Use 
another one of those INT 16 functionoos for that.

     David Deitch (GIS)
          deitch@gisatl.fidonet.org
               1:133/411@fidonet
 


--  
-----------------------------------------------------------------------------
David Deitch - via FidoNet node 1:133/411
UUCP: galbp!gisatl!david
INTERNET: david@gisatl.FIDONET.ORG

gened@gssc.UUCP (Gene Daniel) (09/02/90)

In article <944@beguine.UUCP> Aamir.Zakaria@samba.acs.unc.edu (BBS Account) writes:
>Can anyone tell me how, in either C or assembly language (8088), I can poll
>the keyboard for character input without actually waiting for input, i.e.
>just check if the user has hit a key.
>
>
>Thanks!

Most "C" compilers on PC's have a function called kbhit() it returns
non-zero if a key stroke is available to be input. This function is
available in Microsoft, Borland and Zortech runtime libraries. I seem
to remember it has been available ever since the BDS compiler on 8080
CP/M machines.


-- 
Gene Daniel			   | gened@gss.com
Graphic Software Systems, Inc.     |       or
P.O. Box 4900                      | ..!tektronix!sequent!gssc!gened
Beaverton, Oregon 97005-7161       |

makjr@levels.sait.edu.au (09/07/90)

In article <432.26DFC08D@gisatl.FIDONET.ORG>, david@gisatl.FIDONET.ORG (David Deitch) writes:
> In a message of <Aug 29 04:58> BBS Account (Aamir.Zakaria@samba.acs.unc.edu ) writes:
>
>  > Can anyone tell me how, in either C or assembly language (8088), I can
>  > poll
>  > the keyboard for character input without actually waiting for input,
>  > i.e.
>  > just check if the user has hit a key.
>
>      One of the INT 16 interrupts does this, but off the top of my
>
>      David Deitch (GIS)
>           deitch@gisatl.fidonet.org
>                1:133/411@fidonet
>


       INT 16H , input AH = 01
                 outputs  ZF  ready or not signal
                          AH  scan code
                          AL  character code


Kevin Radus