delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/05/23/03:44:17

From: cnc AT netcom DOT com (Christopher Christensen)
Date: Sun, 22 May 1994 23:41:02 PDT
To: bbs AT bbsipc DOT newcastle DOT edu DOT au (Bryan Beresford-Smith)
Subject: Re: interrupts etc.
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

just to pass along my experience in the way of keyboard interrupt handlers
under DJGPP--
I've been working on it for some time and when I use the _go32_dpmi_...
functions to install my interrupt handler I get different behavior depending
on whether or not a DPMI server is being used (as opposed to just plain go32).

Under a DPMI server:
* you don't need to hook the real-mode interrupt vector because it is
  automatically redirected to protected mode for you.  Hooking the real mode
  vector has no effect.
* it generally works.  Although I did run into a really strange problem where
  if I used _go32_dpmi_allocate_iret_wrapper() it would crash my program on
  the first interrupt.  My solution:  don't use _go32_allocate_iret_wrapper,
  instead make your own iret wrapper with a bit of assembly language in a
  separate file.

In VCPI mode (i.e. no DPMI)
* go32 will not redirect real mode interrupts to a protected mode handler, so
  you have to hook the real mode ivector and point it to a real-mode callback
  which points to your protected mode function.  Do that with
  _go32_dpmi_allocate_real_mode_callback_iret()
* unfortunately, the above doesn't work yet.  I find that even though I have
  hooked real mode interrupts and allocated the callback it still doesn't
  catch the real mode interrupts, they must be going to some vector other
  than int 9 because when I exit my program I see all of the keypresses
  that were missed on the command line (i.e. they managed to find their way
  into the keyboard buffer even with both real and protected mode int 9
  vectors hooked)

I've found similiar behavior with other hardware interrupts, soundblaster
interrupts for example.
Oh, and to the guy who thought that DOOM was written with DJGPP, it wasn't,
I'm pretty sure it was ported to dos with Watcom C.  However, as soon as
these interrupt problems are cleared up, DJGPP will be quite capable of
something like DOOM.
Christopher


-- 
----------------------------------------------------------------------
:  Christopher  :  Huntington Beach California, USA                  :
:  Christensen  :  email:  cnc AT netcom DOT com                            :
----------------------------------------------------------------------

- Raw text -


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