[alt.msdos.programmer] Screen Saver

tbechtel@polyslo.CalPoly.EDU (TrevorB) (03/02/90)

pas@lcs.mit.edu (Paul A. Selkirk) writes:
>Does anyone know of a bulletproof way for a TSR to tell whether DOS (assume
>2.x or 3.x) is idling in the command interpreter, or executing a program?

not off hand...
 
>For the record, I am writing a screen-saver TSR that will only trigger when DOS
>is idling.  There are dozens of screen-savers, but I need one that won't kill
>a lengthy graphics program.  (Ever try generating the Mandelbrot set on a 4.77 
>MHz XT with no FPU?  I thought so.)

How about this, run the screen saver off of the timer interrupt.  If
the correct amount of time has passed, then change the pallette to all
black (if EGA or VGA) or do a memory copy of the screen and blank it 
(if < EGA).  While the screen is blank, the screen saver won't stop
any program that's currently running, but will latch on to the
keyboard or mouse interrupt.  And, of course, when the keyboard/mouse
interrupt is caught, you simply restore the screen by restoring the
palette (if >= EGA), or copy the screen back into video memory (if
< EGA).

This sounds like it might be a more elegant solution and you won't
have to worry about losing that Mandlebrot you've been generating for
the last xx hours...and probably just as important, it won't stop that
Mandlebrot while it's generating.  The only thing that could hurt this
is that if a program decides to modify the palette while the screen is
blanked.  I don't know EGA very well, but I bet there's probably a way
to intercept incoming commands to change the palette, and what you'd
do is intercept that and change what you've saved the palette as
appropiately.

TrevorB


-- 
 _____   _____   _____   _   _    ___    _____                       _____
(_   _) |  _  \ | ____) | | | |  / _ \  |  _  \      InterNet:      |  _  )
  | |   |  _  / | __)_  | |_| | ( (_) ) |  _  /  tbechtel@polyslo.  |  _ (
  |_|   |_| \_\ |_____)  \___/   \___/  |_| \_\     calpoly.edu     |_____)

CMH117@psuvm.psu.edu (Charles Hannum) (03/02/90)

Uh, to elaborate ...  The program I referred to in my last article *will*
allow whatever you're running to continue.

zmact61@doc.ic.ac.uk (D Spinellis) (03/03/90)

In article <25ed7a61.29c1@polyslo.CalPoly.EDU> tbechtel@polyslo.CalPoly.EDU (TrevorB) writes:
>
>pas@lcs.mit.edu (Paul A. Selkirk) writes:
>>Does anyone know of a bulletproof way for a TSR to tell whether DOS (assume
>>2.x or 3.x) is idling in the command interpreter, or executing a program?
[...]
>>is idling.  There are dozens of screen-savers, but I need one that won't kill
>>a lengthy graphics program.
[...]
>How about this, run the screen saver off of the timer interrupt.  If
>the correct amount of time has passed, then change the pallette to all
>black (if EGA or VGA) or do a memory copy of the screen and blank it 
>(if < EGA).  While the screen is blank, the screen saver won't stop
>any program that's currently running, but will latch on to the
>keyboard or mouse interrupt.  And, of course, when the keyboard/mouse
>interrupt is caught, you simply restore the screen by restoring the
>palette (if >= EGA), or copy the screen back into video memory (if
>< EGA).

You don't need to mess with screen copying and pallette saving and restoring.

The following code will do the trick for VGA by setting a bit in the
sequencer that indicates that video access to the memory should be dissabled.
The result of this is that the screen blanks.

        mov     dx,3c4h                 ; Sequencer index
        mov     al,1                    ; Clock register
        out     dx,al
        inc     dx                      ; Point to data
        in      al,dx                   ; Get it
        or      al,20h                  ; Set video disable bit
        out     dx,al                   ; And set it

On the other cards (CGA, MDA etc.) you clear the screen enable bit in the
mode select register.  The following code illustrates it:

data            segment at      40h
                org     49h
crt_mode        db      ?
crt_cols        dw      ?
crt_len         dw      ?
crt_start       dw      ?
cursor_pos      dw      8 dup(?)
cursor_mode     dw      ?
active_page     db      ?
addr_6845       dw      ?
data            ends

        mov      ax,40h                 ; Address of data area
        assume   cs:code,ds:data,es:nothing
        mov      ds,ax                  ; Establish addressability
        mov      dx,addr_6845           ; Primary card address
        add      dx,4                   ; Address of 3X8 register (mode select)
        mov      al,crt_mode_set        ; See old value
        and      al,not 1000b           ; Make the display enable 0
        mov      crt_mode_set,al        ; Save it
        out      dx,al                  ; Out it

Diomidis
--
Diomidis Spinellis                  Internet:                 dds@cc.ic.ac.uk
Department of Computing             UUCP:                    ...!ukc!iccc!dds
Imperial College                    JANET:                    dds@uk.ac.ic.cc
London SW7 2BZ                      #include "/dev/tty"

mlord@bnr-rsc.UUCP (Mark Lord) (03/07/90)

In article <25ed7a61.29c1@polyslo.CalPoly.EDU> tbechtel@polyslo.CalPoly.EDU (TrevorB) writes:
>(if < EGA).  While the screen is blank, the screen saver won't stop
>any program that's currently running, but will latch on to the
>keyboard or mouse interrupt.  And, of course, when the keyboard/mouse
>interrupt is caught, you simply restore the screen by restoring the
>palette (if >= EGA), or copy the screen back into video memory (if
>< EGA).

Ok.. I'll bite.

Does anyone know of a screen saver that REALLY succeeds in this endeavor?

EVERY one I have tried (10+) has flunked the graphics + mouse test.
Ie.. there I am, working away with a graphics program + mouse (FRACTINT),
and .. kapooeee.. the screen goes blank, regardless of mouse activity!
-- 
 ______Mark S. Lord______________________ ______________________________
|    ..uunet!bnrgate!carrsc!mlord        | These are only MY opinions.  |
| or:  bnr-rsc!mlord@bnrgate             | I charge for official views. |
|________________________________________|______________________________|

schow@bcarh185.bnr.ca (Stanley T.H. Chow) (03/08/90)

In article <2276@bnr-rsc.UUCP> mlord@bnr-rsc.UUCP (Mark Lord) writes:
>In article <25ed7a61.29c1@polyslo.CalPoly.EDU> tbechtel@polyslo.CalPoly.EDU (TrevorB) writes:
>>(if < EGA).  While the screen is blank, the screen saver won't stop
>>any program that's currently running, but will latch on to the
>>keyboard or mouse interrupt.  And, of course, when the keyboard/mouse
>>interrupt is caught, you simply restore the screen by restoring the
>>palette (if >= EGA), or copy the screen back into video memory (if
>>< EGA).
>
>Ok.. I'll bite.
>
>Does anyone know of a screen saver that REALLY succeeds in this endeavor?
>

Hi Mark. 

Well, the screen saver that comes with PowerPak from MultiSoft does 
this correctly. All you should have to do is load the mouse driver
first.

I am not sure if it blanks the screen by playing with the palette, but
it does read both the keyboard and mouse.


Stanley Chow        BitNet:  schow@BNR.CA
BNR		    UUCP:    ..!psuvax1!BNR.CA.bitnet!schow
(613) 763-2831		     ..!utgpu!bnr-vpa!bnr-rsc!schow%bcarh185
Me? Represent other people? Don't make them laugh so hard.