Newsgroup: alt.msdos.programmer


Path: icdoc!zmact61
From: zmact61@doc.ic.ac.uk (D Spinellis)
Newsgroups: alt.msdos.programmer,comp.sys.ibm.pc.programmer
Subject: Re: Screen Saver (was Re: idling in the interpreter)
Message-ID: <1663@gould.doc.ic.ac.uk>
Date: 2 Mar 90 17:03:20 GMT
References: <PAS.90Mar1120125@saffron.lcs.mit.edu> <25ed7a61.29c1@polyslo.CalPoly.EDU>
Sender: news@doc.ic.ac.uk
Reply-To: dds@cc.ic.ac.uk (Diomidis Spinellis)
Organization: Imperial College Department of Computing
Lines: 64
Content-Length: 2951
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"



Newsgroup alt.msdos.programmer contents
Newsgroup list
Diomidis Spinellis home page

Creative Commons License Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-Share Alike 3.0 Greece License.