delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/07/18/01:50:55

Date: Thu, 18 Jul 2002 07:44:11 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp AT delorie DOT com
Subject: Re: Logging data from an interrupt to a file
In-Reply-To: <ah4enl$hb7$1@knossos.btinternet.com>
Message-ID: <Pine.SUN.3.91.1020718074104.9966C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 17 Jul 2002, Thomas Harte wrote:

> My problem is that although logging to a memory buffer is nice, I would like
> to log to disc. But I can't find a way to do this, assuming that I don't
> have the memory to log all keypresses and then write them to disc when the
> second program terminates.
> 
> What would I do to achieve this?

Make the interrupt handler set a flag when the memory buffer is almost 
full, and make the main foreground function of your logger look at the 
flag and write out the buffer when the flag is set; then reset the flag.  
The interrupt handler should notice that the flag went from set to reset, 
and start recording keys from the beginning of the buffer.

If you use this method, be sure to disable interrupts around code, both 
in the foreground code and in the interrupt handler, which accesses the 
flag and the buffer pointer, to prevent the two parts stepping on each 
other's toes.

- Raw text -


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