Mail Archives: djgpp/1998/11/20/16:35:25
From: | deus AT mpsi DOT net
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | keyboard handler
|
Date: | Fri, 20 Nov 1998 21:20:37 GMT
|
Organization: | Deja News - The Leader in Internet Discussion
|
Lines: | 57
|
Message-ID: | <734mek$ana$1@nnrp1.dejanews.com>
|
NNTP-Posting-Host: | 207.252.220.179
|
X-Article-Creation-Date: | Fri Nov 20 21:20:37 1998 GMT
|
X-Http-User-Agent: | Mozilla/4.05 [en] (Win95; I)
|
X-Http-Proxy: | 1.0 x11.dejanews.com:80 (Squid/1.1.22) for client 207.252.220.179
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hello everyone,
I'm trying to port some of my code from Watcom C/C++ to DJGPP.
I seem to be stuck on how to convert my keyboard handler. Here's what it
looks like in Watcom:
// holds the old interrupt
void (__interrupt __far *oldint9h)();
// holds key statuses
volatile unsigned char key[256];
// new custom interrupt
void __interrupt __far myint9h()
{
register unsigned char keyinfo;
keyinfo = (unsigned char)inp(0x60); // inp() is the same as inportb()
if(keyinfo==0xE0 || keyinfo==0xE1)
{
outp(0x20, 0x20); // outp() is the same as outportb()
return;
}
key[keyinfo & (~0x80)] = keyinfo>>7;
outp(0x20, 0x20);
}
void main(void)
{
// save old interrupt
oldint9h = _dos_getvect(0x9);
// point vector to new custom routine
_dos_setvect(0x9,myint9h);
// init key statuses to unpressed
for(int clear=0; clear<256; clear++) key[clear]=1;
:
:
:
// point vector to old handler
_dos_setvect(0x9,oldint9h);
}
I realize my handler is too simple to be robust (suggestions are welcome) but
for now, it serves its purpose. My question is, how do I get and set the
interrupt vector in DJGPP? Am I going to run into any other problems with
this code in DJGPP?
TIA
deus
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
- Raw text -