delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/17/09:35:22

Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE37BEEBB@probe-2.acclaim-euro.net>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Keyboard Handler question
Date: Wed, 17 Mar 1999 14:34:38 -0000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1460.8)
Reply-To: djgpp AT delorie DOT com

Thibaut Murez writes:
> I've made a keyb handler for my game which is really basic(left right up 
> down printscreen escape and enter) and i'd like to be able to call a set 
> of function every time an int is generated. I mean i don't want to check 
> my keyb flags in my main loop, i'd like to be able to add and remove 
> functions within a "list" as modules... 

I really can't recommend you doing this: hardware interrupts are a
very problematic place to run code (must be locked, can't call libc
functions, impossible to debug, prone to subtle synchronisation bugs), 
so I think you would be much better off to just set a flag and then 
check it from your main program loop.

> when i try to call a C or C++ function from within my keyb handler, all 
> i got is a GPF ! 

Did you lock all the memory that is used by your interrupt handler?


	Shawn Hargreaves.

- Raw text -


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