{***********************************************************************}
{									}
{ __ExInKey   Return a character and scan code from the keyboard	}
{									}
{ function  __ExInKey( UseExtended : boolean;				}
{		      var ScanCode : byte) : char;			}
{									}
{	      UseExtended						}
{			Use extended BIOS calls if available		}
{	      ScanCode	The scan code of the returned character.	}
{									}
{ Description This function waits for a key sequence to be pressed, and }
{	      then returns character and scan code of the character for }
{	      the key.	For extended key sequences not having an ASCII	}
{	      representation, the character returned is NUL (ASCII 0),	}
{	      or ASCII $E0 if the Enhanced Keyboard is preset, but the	}
{	      scan code is returned in ScanCode.			}
{									}
{	      If UseExtended is set to TRUE, the extended BIOS key-	}
{	      board function call (AH = $10) is used, if available.	}
{	      The extended function call will return codes for the	}
{	      new keys of the 101 key keyboard (e.g., F11, F12) as well }
{	      as returning different characters for duplicated keys	}
{	      (e.g., the two separate Enter keys).  The traditional	}
{	      BIOS call (AH = $00) will literally throw away keystrokes }
{	      (that is, it removes them from the keyboard buffer)	}
{	      for keys not present on the standard keyboard.  Moreover, }
{	      it returns identical scan codes and characters for	}
{	      duplicated keys, making it impossible to tell which	}
{	      of the two physical keys has been depressed.		}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc.  1987		}
{_______________________________________________________________________}

function  __ExInKey( UseExtended : boolean;
		    var ScanCode : byte) : char;

  var
    Reg : registers;

  begin {__ExInKey}

    with Reg do 		       { Prepare to make a call to BIOS }
      begin			       { Set AH to subfunction 0 or $10,}
	if ((_ExtendedKbdBIOS) and     { depending on input parameter	}
	    (UseExtended)) then        { and if BIOS supports the ex-	}
	  AH := $10		       { tended calls.			}
	else
	  AH := 0;
	AL := 0;
	Intr(_KEYBD,Reg);
	ScanCode  := AH;
	__ExInkey := char(AL)
      end

  end;	{__ExInKey}
