cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/08/16:23:45

Message-Id: <199808082021.VAA30786@sable.ox.ac.uk>
Comments: Authenticated sender is <mert0407 AT sable DOT ox DOT ac DOT uk>
From: George Foot <george DOT foot AT merton DOT oxford DOT ac DOT uk>
To: rylan AT inbtekom DOT co DOT za
Date: Sat, 8 Aug 1998 21:20:17 +0000
MIME-Version: 1.0
Subject: Re: Testing for a key in an inline assembly loop
Reply-to: george DOT foot AT merton DOT oxford DOT ac DOT uk
CC: djgpp AT delorie DOT com

On  8 Aug 98 at 12:10, Rylan wrote:

> Hi,
> 
> How can I test for a key press in an inline assembly loop in DJGPP? I tried
> using a __dpmi_int call, which works fine for int 16h function 0x00 which
> waits until a key is pressed, then continues, so my interrupt setup seems to
> work. But when I try function 0x01 of int 16h, which sets the zero flag if a
> key has been pressed, how can I test the flags set by an int executed for me
> by __dpmi_int? 'Cause it seems that __dpmi_int alters them on exit of
> itself?

Of course, you can't rely on the flags and registers being what they 
were on return from the interrupt.  __dpmi_int is documented to 
update the __dpmi_regs struct you pass a pointer to with the new 
register contents.  See my last email, where I used the flags field 
for exactly this.  Of course I may have got it wrong; I don't know 
how int 16h works, I just basically copied the djgpp library's source 
code for `kbhit', translating it into assembler.

> Is there a way to do this? If I am on the wrong track then - how can I test
> for a keypress in inline DJGPP assembler??

You could of course just call `kbhit'; restore ES and DS, then "call 
_kbhit", and the return value will be in EAX.

> Please reply by mail if at all possible!

My last few replies have bounced from your email address, so I can't 
do that.

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019