{***********************************************************************}
{									}
{ __DosInKey  Return a character or extended character code from the	}
{	      keyboard using DOS services				}
{									}
{ function  __DosInKey(var ExtendedCode : byte) : char; 		}
{									}
{	      ExtendedCode						}
{		       The ASCII code of a standard key sequence and	}
{		       and the extended code of the nonstandard key	}
{		       key sequence.					}
{									}
{ Description This function waits for a key sequence to be pressed, and }
{	      then returns character or extended character code for	}
{	      the key.	For extended key sequences not having an ASCII	}
{	      representation, the character returned is NUL (ASCII 0),	}
{	      but the scan code is returned in ExtendedCode. If the key }
{	      struck has an ASCII value, it is returned as the function }
{	      value, and its ASCII code is returned in ExtendedCode.	}
{	      Unlike __ExInkey, the scan code for standard characters	}
{	      is not returned.	However, using __DosInKey  input can be }
{	      redirected because it uses a DOS function call rather	}
{	      than the BIOS.						}
{									}
{	      NOTE:  DOS versions through 3.30 do not make use of the	}
{	      Enhanced Keyboard (12 function keys, separate cursor keys,}
{	      etc.) and use the traditional BIOS calls.  This means	}
{	      DOS will discard some keystrokes (like F11, F12) when	}
{	      using the Enhanced Keyboard, and some others keystrokes	}
{	      are translated to their traditional values.		}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc.  1987		}
{_______________________________________________________________________}

function  __DosInKey(var ExtendedCode : byte) : char;

  var
    Reg : registers;

  begin {__DosInKey}

    with Reg do 		       { Prepare to make a call to DOS	}
      begin			       { function 7, direct console I/O.}
	AH := $07;		       { AH = 0.			}
	Intr(_DOS,Reg);
	if (AL = 0) then	       { Have an extended sequence, so	}
	   begin		       { call again to get extended code}
	     __DosInKey := Chr(0);
	     AH 	:= $07;
	     Intr(_DOS,Reg)
	   end
	else			       { Have a standard sequence	}
	   __DosInKey := Chr(AL);
	ExtendedCode  := AL

      end

  end;	{__DosInKey}
