Mail Archives: djgpp/1997/05/03/07:04:59
From: | SteelGolem <myork AT auracom DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | allegro: 3 button keyboard handler?? THAT SUCKS!!!
|
Date: | Sat, 03 May 1997 02:21:36 -0300
|
Organization: | Auracom Internet Services
|
Lines: | 61
|
Message-ID: | <5keie7$2fn$1@thor.atcon.com>
|
Reply-To: | myork AT auracom DOT com
|
NNTP-Posting-Host: | 199.126.230.185
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
i have a [non]protected mode keyboard handler that handles X number of
keys.. if i display it, can someone show me how to change it so it works
under djgpp protected mode?? or am i screwed?
*** start of C file [which worked wonderfully under MS quickC]
#include <graph.h>
#include <conio.h>
#include <dos.h>
//first we'll declare some things we'll need..
#define KEYBOARDINTR 9
#define KEYBOARDPORT 0x60
int exitprog=0;
void (_interrupt _far *BIOSkeyboardhandler)(void);
_interrupt _far keyboardhandler(unsigned int ax, unsigned int bx,
unsigned int cx, unsigned int dx,
unsigned int si, unsigned int di,
unsigned int cflag);
main(void) {
BIOSkeyboardhandler = _dos_getvect(KEYBOARDINTR);
_dos_setvect(KEYBOARDINTR, keyboardhandler);
_clearscreen(_GCLEARSCREEN);
printf("\n\nHIT ENTER TO STOP\n");
while (!exitprog)
;
_clearscreen(_GCLEARSCREEN);
//when the program is finished, we set the old keyboard handler again
_dos_setvect(KEYBOARDINTR, BIOSkeyboardhandler);
}
_interrupt _far keyboardhandler(unsigned int ax, unsigned int bx,
unsigned int cx, unsigned int dx,
unsigned int si, unsigned int di,
unsigned int cflag){
unsigned char key, scancode;
key = inp(KEYBOARDPORT);
scancode = key & 127;
printf("%d %d\n",key,scancode);
if ((scancode == 28) && (key & 128))
exitprog = 1;
outp(0x20, 0x20);
}
*** end of c file.. its a horrible program, but it works. is there a
keyboard handler that will do THIS, instead of the sucky 3 button
handler allegro has? don't get me wrong, allegro is awesome, but i'd
rather have a better keyboard handler.. 3 buttons.. what do they think
we are, ANIMALS???
steelgolem
- Raw text -