delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/26/08:00:37

Message-ID: <35BB1934.19623E27@mailexcite.com>
Date: Sun, 26 Jul 1998 07:55:34 -0400
From: Doug Gale <dgale AT mailexcite DOT com>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ScreenSaver?
References: <35B1977C DOT 8A1DACD2 AT jove DOT acs DOT unt DOT edu>
NNTP-Posting-Host: oshawappp52.idirect.com
Organization: "TUCOWS Interactive Inc"
Lines: 67
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


Tim Faehnle wrote:

> What library would I need to make a screensaver?  I'm thinking that it
> would have to use some windows function or something.  Is there a way
> that I could do this?

Assuming you are talking about DOS, this is a serious undertaking.
Assuming you want to do this in DJGPP (that is where you posted in :) you
will have to do a bunch of real-mode<>protected mode transition.

You will have to make a TSR. You will have to hook and monitor several
interrupts. You will have to either write real-mode stubs for the ISR's,
or you will be causing a LOT of mode transitions.

(Newbie note: ISR means Interrupt Service Routine)

To make a stable TSR that can interrupt program operation, you will need
to hook and monitor INT 0x10, INT 0x13, INT 0x21, INT 0x08, and INT 0x09.

You hook INT 0x10, 0x13, and 0x21 to monitor them for use. The ISR's for
these will simply increment flags (like in_int_21, in_int_10, in_int_13,
etc...) when they are executing.

Example monitoring-wrapper code:

void INT_0x21_ISR(void)
{
    in_int_21++;
    __asm__ ("pushf;lcall %0" : : "m" (&old_int21_handler_vector));
    in_int_21--;
}

(Note that you will have to write an interrupt handler stub in assembly,
you can't just point the interrupt vector to this function!! Better yet,
write 16-bit assembly stubs so you don't cause tons of
real-mode-to-protected-mode transitions)

The ISR for INT 0x09 is used to detect keyboard activity. The ISR for INT
0x08 is used to detect the passage of time (for your screen saver
timeout).

Let's say you've got all this stuff hooked and ready to go. When your INT
0x08 (timer) tells you that INT 0x09 (keyboard) has not been called for X
number of INT 0x08's, CHECK YOUR in_int_21, in_int_10, etc. flags and
don't start your screen saver if any of those flags are nonzero. If all
those flags are nonzero, it should be ok for you to call your cool screen
saver program that blasts 3D stuff all over the screen or whatever. Note
that when you switch to your screen saver, enable interrupts while it is
running because interrupts are automatically disabled by the CPU in an
ISR.

Oh yes, you will also have to monitor the INDOS flag, which is hidden in
DOS memory somewhere. Search the net for info about Dos's "List of Lists".

As I said, serious undertaking.

Best of luck, you're going to need it!

(Hmmm, now that I have reread your message, it does look kinda like you
are talking about Windows. Oh well, I typed out all this stuff, so here it
is!)

:)


- Raw text -


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