delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/14/07:11:25

From: "Felix" <natter AT metronet DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Detecting Arrow Key Presses
Date: Wed, 14 Oct 1998 13:13:48 +0100
Organization: -
Lines: 30
Message-ID: <7020ek$i79$1@news.metronet.de>
References: <5a92fc80 DOT 36229998 AT aol DOT com>
NNTP-Posting-Host: bonn2.pop.metronet.de
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

if you want to use allegro, you probably have to switch to DJGPP (which is
the newsgroup you are using right now), otherwise intercept IRQ 1 (INT 9),
then (when you receive an IRQ) keep track of the key states (ie with an
array, like char KEY_FLAGS[MAX_SCANCODES]).
so when your int-9-handler is called you have to read from the PPI
(programmable peripheral interface), port 0x60, to get the scancode. if it
has bit 7 set, the key is released, otherwise pressed (or the other way
around).
i have not figured out how to read extended scancodes, so if you do, let me
know!
there are also many other ways (like reading from port 0x64, which I believe
doesn't work on XT's), you can also call int 0x16 (BIOS), or use some dos
functions..
i've just started using DJGPP and I've been using Turbo C++ 3.0 for almost
half a year before.... somewhere on the web there is a doc on how to deal
with its bugs (like increasing memory available to the program, executing
32bit inline-assembly-instructions...) - you might want to look at that!
it's from Jouni Miettunen (jon AT stekt DOT oulu DOT fi)
besides, my name is Felix, not whatever the from-line says (i don't know how
to change it!)
DoctorXV AT aol DOT com schrieb in Nachricht <5a92fc80 DOT 36229998 AT aol DOT com>...
>How do I get C++ to detect when someone presses and arrow key. I want to
make
>something move when someone press the arrow key. Also...is it possible to
load
>an image into my program without using Allegro? I use Turbo C++ 3.0.
>
>- Brett


- Raw text -


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