kbhit Function (ROM Call 0x52)

kbd.h

short kbhit (void);

Checks for unread keystrokes.

kbhit checks to see if a keystroke is currently available. Any available keystrokes can be retrieved with ngetchx. If a keystroke is available, kbhit returns a nonzero integer (in fact, it returns the exactly same value as ngetchx); if not, it returns 0. Note that kbhit does not pick a keystroke from the keyboard queue. So, kbhit will continue to return non-zero value until "keypress" flag is reset by calling ngetchx, GKeyFlush or GKeyIn.

Note: kbhit function is slow, because it also handles receiving eventual bytes from the link port (used mainly internally in TIOS when the calculator is in the Home screen). See kbd_queue for much faster way to check the keyboard state.


Uses: HomeAlone, OSCheckSilentLink, OSLinkCmd, OSqinquire, OSSetSR
Used by: GKeyDown, GKeyFlush, pushkey, cmd_disptbl, cmd_pause, push_getkey, EV_eventLoop, EV_getc, GS_PlotAll, GZ_Stat, Regraph


See also: ngetchx, GKeyIn, kbd_queue, OSFastArrows