Board index » delphi » keypressed without CRT-unit??

keypressed without CRT-unit??

function readkey:char;assembler;
asm
 mov ax,0
 int 16h
end

I think this works to substitute 'readkey'.
Does anyone know some ASM code for 'keypressed'??

Thanx.
--
*******************************************
HELMUT HICKERSBERGER

University of Technology -  Vienna, Austria
EMAIL: mailto:e9125...@student.tuwien.ac.at
*******************************************

 

Re:keypressed without CRT-unit??


Instead of assembler you can use the following;

function keypressed : boolean;
begin
   keypressed:= port[$60] < $80;
end;

Quote
Helmut Hickersberger wrote:
> function readkey:char;assembler;
> asm
>  mov ax,0
>  int 16h
> end

> I think this works to substitute 'readkey'.
> Does anyone know some ASM code for 'keypressed'??

> Thanx.
> --
> *******************************************
> HELMUT HICKERSBERGER

> University of Technology -  Vienna, Austria
> EMAIL: mailto:e9125...@student.tuwien.ac.at
> *******************************************

Re:keypressed without CRT-unit??


On 1997-12-30 e9125...@stud3.tuwien.ac.at said:
   >function readkey:char;assembler;
   >asm
   >mov ax,0
   >int 16h
   >end
   >I think this works to substitute 'readkey'.
   >Does anyone know some ASM code for 'keypressed'??
   >Thanx.
|
Function keypressed : boolean;
var reg : registers;
begin
  reg.ah :=1;   {check keystate}
  intr($16,reg);
  keypressed:=(reg.al=1); {al=1, no keypress, ignore char in ah     }
end;                      {al<>1, keypressed ah=key,al=extended code}
|
Jay

jaywa...@gte.net

"Energize," said Kirk, and the pink bunny appeared.

Net-Tamer V 1.10.1  - Test Drive

Re:keypressed without CRT-unit??


This code should help fix that problem;
ASM
    XOR    AX,AX
    INT      16h
END

If you would like more information on how toprgram in ASM Please visit
http://www.geocities.com/SiliconValley/Peaks/2093
and fill out the registration page!

Quote
mut Hickersberger wrote:
> function readkey:char;assembler;
> asm
>  mov ax,0
>  int 16h
> end

> I think this works to substitute 'readkey'.
> Does anyone know some ASM code for 'keypressed'??

> Thanx.
> --
> *******************************************
> HELMUT HICKERSBERGER

> University of Technology -  Vienna, Austria
> EMAIL: mailto:e9125...@student.tuwien.ac.at
> *******************************************

Re:keypressed without CRT-unit??


Quote
> function readkey:char;assembler;
> asm
>  mov ax,0
>  int 16h
> end

> I think this works to substitute 'readkey'.
> Does anyone know some ASM code for 'keypressed'??

function KeyPressed : boolean; assembler;
asm
   push dx
   mov ah,06h
   mov dl,0FFh
   int 21h
   xor ah,ah
   pop dx
end;

Regards
Mike Heydon

Re:keypressed without CRT-unit??


 132960 Dec 13 1997 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
 tsfaqp.zip Common Turbo Pascal Questions and Timo's answers

  Crt            Replacement                  Where
  ---            -----------                  -----
  AssignCrt      ..                           ..
  ClrEol         ..                           ..
  ClrScr         ClrScreen,CLS,CLS40          FAQ #117
  Delay          Wait                         FAQ #67
  DelLine        ..                           ..
  GotoXY         GOATXY                       TSUNTG in tspa*.zip
  HighVideo      ..                           ..
  InsLine        ..                           ..
  KeyPressed     KEYPREFN                     TSUNTM in tspa*.zip
  LowVideo       ..                           ..
  NormVideo      ..                           ..
  NoSound        ..                           ..
  ReadKey        READKEFN,RDENKEFN            TSUNTM in tspa*.zip
  Sound          AUDIO                        TSUNTD in tspa*.zip
  TextBackground ..
  TextColor      ..
  TextMode       ..
  WhereX         WHEREXFN                     TSUNTG in tspa*.zip
  WhereY         WHEREYFN                     TSUNTG in tspa*.zip
  Window         ..

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

--------------------------------------------------------------------

   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.

Re:keypressed without CRT-unit??


Thank you all for your response...
I think i have solved the problem now:
I substituted the CRT unit with the following code:

function INT16:word;assembler;
asm
 xor ax,ax
 int 16h
end;

function INT21:word;assembler;
asm
 mov ah,0bh
 int 21h
end;

const
 CYCLE:integer=-1;

function readkey:char;
var
 w:word;
 l:byte;
 res:char;
begin
 if CYCLE=-1
 then
 begin
  w:=INT16;
  l:=lo(w);
  CYCLE:=-1;
  if l=0 then CYCLE:=hi(w);
  res:=chr(l);
 end
 else
 begin
  res:=chr(CYCLE);
  CYCLE:=-1
 end;
 readkey:=res
end;

function keypressed:boolean;
var
 w:word;
 res:boolean;
begin
 res:=true;
 if CYCLE=-1 then
 begin
  w:=INT21;
  if lo(w)=0 then res:=false
 end;
 keypressed:=res
end;

--
*******************************************
HELMUT HICKERSBERGER
University of Technology -  Vienna, Austria
EMAIL: mailto:e9125...@student.tuwien.ac.at
*******************************************

Other Threads