Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  Service 01H (decimal 1) reports whether a keyboard input character is
  ready. This is a sneak-preview or look-ahead operation: Even though the
  character is reported, it remains in the keyboard input buffer of the ROM
  BIOS until it is removed by service 00H. The zero flag (ZF) is used as the
  signal: 1 indicates no input is ready; 0 indicates a character is ready.
  Take care not to be confused by the apparent reversal of the flag values--
  1 means no and 0 means yes, in this instance. When a character is ready
  (ZF = 0), it is reported in AL and AH, just as it is with service 00H.

  This service is particularly useful for two commonly performed program
  operations. One is test-and-go, where a program checks for keyboard action
  but needs to continue running if there is none. Usually, this is done to
  allow an ongoing process to be interrupted by a keystroke. The other
  common operation is clearing the keyboard buffer. Programs can generally
  allow users to type ahead, entering commands in advance; however, in some
  operations (for example, at safety-check points, such as "OK to end?")
  this practice can be unwise. In these circumstances, programs need to be
  able to flush the keyboard buffer, clearing it of any input. The keyboard
  buffer is flushed by using services 00H and 01H, as this program outline
  demonstrates:

  call service 01H to test whether a character is available in the
  keyboard buffer
  WHILE (ZF = 0)
          BEGIN
          call service 00H to remove character from keyboard buffer
          call service 01H to test for another character
          END

  Contrary to what some technical reference manuals suggest, services 00H
  and 01H apply to both ordinary ASCII characters and special characters,
  such as function keys.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson