www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/22/10:06:39

Newsgroups: comp.os.msdos.djgpp
From: Andy Eder <sp1edea AT doc DOT ntu DOT ac DOT uk>
Subject: Keyboard Handlers
Message-ID: <Pine.SUN.3.91.970422093604.28433B-100000@chris>
Sender: news AT doc DOT ntu DOT ac DOT uk
Organization: The Nottingham Trent University, DOC.
Mime-Version: 1.0
Date: Tue, 22 Apr 1997 08:47:46 GMT
Lines: 64
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Can somebody please help ? I am attempting to implement my own keyboard 
handler and I cannot get it to work. My system either crashes or locks 
up. As this is my first attempt at such things, I don't know where I am 
going wrong.

If you can help me out, or suggest some links that might help, please do.
My code is outlined below...

..
..
void OldKeyISR();		// For old handler
void NewKeyISR();		// For new handler

_go32_dpmi_seginfo Old_Handler,New_Handler;
int Key;
..
..

void NewKeyISR()
   {
   asm("
      sti
      inb	$0x60,%%al
      xorb	%%ah,%%ah
      movw	%%ax,_Key
      inb	$0x61,%%al
      orb	$0x82,%%al
      outb	%%al,$0x61
      andb	$0x7f,%%al
      outb	%%al,$0x61
      movb	$0x20,%%al
      outb	%%al,$0x20"
      :		// no output registers
      :		// no input registers
      : "%eax"
      );

   // KEYPRESS PROCESSED HERE
   }

void InstallKeyboard()
   {
   New_Handler.pm_offset = (long unsigned int)NewKeyISR;
   New_Handler.pm_selector = _go32_my_cs();

   _go32_dpmi_allocate_iret_wrapper(&New_Handler);
   _go32_dpmi_get_protected_mode_interrupt_vector(0x09,&Old_Handler);
   _go32_dpmi_set_protected_mode_interrupt_vector(0x09,&New_Handler);
   }

void RemoveKeyboard()
   {
   _go32_dpmi_set_protected_mode_interrupt_vector(0x09,&Old_Handler);
   }
     

Any suggestions ???

Thanks,
Andy

Andy - cc505870 AT ntu DOT ac DOT uk

- Raw text -


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