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

Keypressed -- not using bios or crt

Anyone have a routine to check for a "keypressed" without using the BIOS
or CRT unit?

Thanks,
Keith

 

Re:Keypressed -- not using bios or crt


Keith Tysinger schrieb:

Quote

> Anyone have a routine to check for a "keypressed" without using the BIOS
> or CRT unit?

> Thanks,
> Keith

http://www.ctyme.com/intr/RB-2498.HTM

Re:Keypressed -- not using bios or crt


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/

Re:Keypressed -- not using bios or crt


Quote
> Anyone have a routine to check for a "keypressed" without using the BIOS
> or CRT unit?

Hi!

It's difficult. You have to manage an array and track if a key is pressed or
released. If you have the run-time error 200 bug, it's far better to apply a
patch (URLs posted here frequently) or use BIOS.

function keyPressed; assembler;
asm
  mov ah,1
  int 16h
  mov al,0
  jz  @@1
  inc al
  @@1:
end;

Andras

Re:Keypressed -- not using bios or crt


Quote
Keith Tysinger (ty3...@concentric.net) wrote:

: Anyone have a routine to check for a "keypressed" without using the BIOS
: or CRT unit?

 115280 Sep 7 1996 ftp://garbo.uwasa.fi/pc/ts/tspa3570.zip
 tspa3570.zip Turbo Pascal 7.0 real mode units for (real:-) programmers.

Look for
  KEYPREFN As the ordinary KeyPressed but no Crt unit required
  RDENKEFN Enhanced keyboard ReadKey, detects also F11 and F12
  READKEFN As the ordinary ReadKey but no Crt unit required

   All the best, Timo

....................................................................
Prof. Timo Salmi   Co-moderator of news:comp.archives.msdos.announce
Moderating at ftp:// & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland

Spam foiling in effect.  My email filter autoresponder will return a
required email password to users not yet in the privileges database.
Advice on spam foiling at http://www.uwasa.fi/~ts/info/spamfoil.html

Re:Keypressed -- not using bios or crt


You can use DOS:
Function Keypressed:boolean; Assembler;
asm
   mov ah,0bh
   int 21h
end;
I don't prefer this for you if you need speed.

Bye,
    Mojmir Nebel

Keith Tysinger p?e ve zprv <35F62D2B.5367B...@concentric.net>

Quote
>Anyone have a routine to check for a "keypressed" without using the BIOS
>or CRT unit?

>Thanks,
>Keith

Re:Keypressed -- not using bios or crt


Quote
Keith Tysinger (ty3...@concentric.net) wrote:

: Anyone have a routine to check for a "keypressed" without using the BIOS
: or CRT unit?

See keyboard.zip at http://users.leading.net/~rdonais/tpascal.htm

    ...red

Re:Keypressed -- not using bios or crt


JRS:  In article <35F62D2B.5367B...@concentric.net> of Wed, 9 Sep 1998
00:20:55 in comp.lang.pascal.borland, Keith Tysinger

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

Perhaps Timo has : from TSFAQP #124 :

Quote
>  KeyPressed     KEYPREFN                     TSUNTM in tspa*.zip

Otherwise, KeyP := MemW[Seg0040:$001A]<>MemW[Seg0040:$001C] ; or similar
should do it.  If your PC is not ancient and you can use ROM BIOS, maybe
Int16/11h.

Or, in my program (see Sig) keybuff.pas :

Derived from a post by Joe Merten <j...@jme.de>, JME Engineering Berlin :
If your reason to replace the KeyPressed-Function is only
that you don't want to use the CRT-unit, try:
  Function KeyPressed: Boolean; Assembler;
  Asm  Mov AH,$01 ; Int $16
    Mov AL,TRUE ; JNZ @Ende ; Mov AL,FALSE ; @Ende: end;
But if you want to prevent the BIOS-call, try:
    Function KeyPressed: Boolean;
    begin KeyPressed := MemW[Seg0040:$1A]<>MemW[Seg0040:$1C] end ;

or in atom046c.pas :
var head : word absolute $40:$1A ;
    tail : word absolute $40:$1C ;
procedure FlushKB ; begin head := tail end { TSFAQP #16 } ;
function KeyPressed : boolean { without Crt } ;
begin KeyPressed := head<>tail end ;

and the answer is IMHO implicit in TSFAQP #120.

--
John Stockton, Surrey, UK.    j...@merlyn.demon.co.uk    Turnpike v1.12    MIME.
  Web <URL:http://www.merlyn.demon.co.uk/> - TP/BP/&c.  FAQqish topics & links.
  Timo's TurboPascal <A HREF="ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip">FAQ</A>.
  PAS, EXE in <URL: http://www.merlyn.demon.co.uk/programs/> - see 00index.txt.

Other Threads