Mail Archives: djgpp/2002/07/18/01:50:55
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 -