delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/26/11:44:24

Date: Sun, 26 Jan 1997 18:31:24 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: John Eccleston <johne AT parallax DOT co DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Help: Keyboard interrupt
In-Reply-To: <854022514.613673@red.parallax.co.uk>
Message-ID: <Pine.SUN.3.91.970126182433.6794B-100000@is>
MIME-Version: 1.0

On Thu, 23 Jan 1997, John Eccleston wrote:

> Currently if you hit a key whilst the program is running it completes
> but does not re assign the old keyboard handler, and also if you press
> several keys it only counts to 1 and misses the others.

That's because you don't send the EOI (End Of Interrupt) command to the 
Interrupt Controller, so it blocks any further interrupts from reaching 
the CPU.  You should write the value 20h to the port number 20h.

> Is it OK to write an interrupt handler in C if you lock the code and
> data?  I know the FAQ says to write it in assembler but it mentions nothing
> about _go32_dpmi_lock_ functions.

The problem with C handlers is that you cannot lock them, since the size
of a function cannot be computed in C.  The trick that you use will work
most of the time, but some minor changes in your code or some compiler
switches (such as -O3) could break it, and some future version of gcc can
change the way it generates the code for the functions in a way that will
totally break this.  That is the primary reason for what the FAQ says. 

- Raw text -


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