Board index » delphi » Keypressed -- not using bios or crt

Keypressed -- not using bios or crt

Klaus,
     This one does not seem to be very responsive under Desqview,
but it works:

Function Keypressed:Boolean;
Var Head:Word absolute $40:$1A;
    Tail:Word absolute $40:$1C;
Begin
  Keypressed:=(Head<>Tail);
End;

Begin
 Repeat until keypressed;
End.

Regards,
Pierre

On 9 Sep 1998 08:56:59 GMT,
Klaus Hartnegg  <hartn...@sun2.ruf.uni-freiburg.de> wrote:

Quote
>Keith Tysinger (ty3...@concentric.net) wrote:
>: Anyone have a routine to check for a "keypressed" without using the BIOS
>: or CRT unit?

>This sounds as if you have a problem with the CRT unit
>and thus don't want to use it.

>Usually it's better to solve the problem than to
>use another CRT unit.

>If you really need a keypressed function without
>using CRT or BIOS (CRT uses the BIOS), then I can
>send you one that intercepts the keybaord interrupt,
>but if you have other problems like not being able
>to redirect the program output to a file or
>runtime error 200, then please tell so and
>we'll show you better solutions.

>Klaus
>--
>Klaus Hartnegg, Institut fuer Biophysik, Hansa-Strasse 9a, D-79104 Freiburg
>hartn...@uni-freiburg.de   http://www.brain.uni-freiburg.de/~klaus/

=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Pierre van Rooyen
Agrimetrics Institute,ARC.
Private Bag x1251,
Potchefstroom,2520
South Africa.
Tel +27-18-299-6206
Fax +27-18-294-7146
+=+=+=+=+=+=+=+=+=+=+=+=+=+
 

Re:Keypressed -- not using bios or crt


Pierre van Rooyen (PvRoo...@IGG2.Agric.ZA) wrote:
: Function Keypressed:Boolean;
: Var Head:Word absolute $40:$1A;
:     Tail:Word absolute $40:$1C;
: Begin
:   Keypressed:=(Head<>Tail);
: End;

If you do this, you indirectly dependend on a functional Bios,
because the Head and Tail pointer in the keyboard buffer are
updated by a Bios routine. If you want to be completely
independend, you must intercept the keyboard interrupt.

Klaus
--
Klaus Hartnegg, Institut fuer Biophysik, Hansa-Strasse 9a, D-79104 Freiburg
hartn...@uni-freiburg.de   http://www.brain.uni-freiburg.de/~klaus/

Other Threads