delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/08/12:35:09

From: SteelGolem <myork AT auracom DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: 3 button keyboard handler?? that sucks!!! -again
Date: Tue, 06 May 1997 14:22:37 -0300
Organization: Auracom Internet Services
Lines: 71
Message-ID: <5knp94$ng6$1@thor.atcon.com>
Reply-To: myork AT auracom DOT com
NNTP-Posting-Host: 199.126.230.172
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

This is a multi-part message in MIME format.

--------------52C8496A47EB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

i need to find out how to make an old unprotected mode keyboard handler
work under protected mode. i need to be able to process more keys at
once than allegro can handle. i have the keyboard handler function
below. i know i already posted this one, but i didn't realize i forgot
to add: email pleeeeze!

steelgolem

keyboard handler: (it works perfectly in QuickC)

--------------52C8496A47EB
Content-Type: text/plain; charset=us-ascii; name="Kybdhndt.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Kybdhndt.c"

#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);
}

--------------52C8496A47EB--

- Raw text -


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