atwell@utah-cs.UUCP (Bart L. Atwell) (01/13/87)
About a year ago, an accessory was posted that would turn off the screen. Unfortunately, it required you to select a desk accessory to do it. Does anybody have one that turns off the screen after a certain amount of idle time and turns it back on at a key/mouse click? My phosphors thank you and I thank you, Bart
XCG112@DBNUAMA1.BITNET (01/15/87)
I think this is what you want ...
If you turn your ST off after short times of usage, it will eventually suffer.
Solution: keep it turned on most of the time, even if you're not going to use
it for a while. Also, the RAM disk stays intact - none of that cold start
copying necessary. The disadvantage is that one has to turn the monitor off
to prevent burn-ins after prolonged use.
This posting contains a short utility that solves the problem by shutting
off the monitor CRT (like the video controllers in most modern terminals).
Since it is short, I post the assembler source. If anyone needs an uuencoded
copy, email me - I haven't been able to upload it yet.
- What it does:
NIGHT is a PD program published by the German computer magazine c't that
helps to extend monitor life by shutting off the CRT display after a pre-
specified time interval has elapsed and no user action (such as keys
pressed or the mouse moved) has occurred.
If any key on keyboard or mouse is pressed, if the mouse is moved or the
running program requests screen output via BIOS calls, the screen is
turned back on.
- How it works:
a) Put NIGHT.PRG into your AUTO folder. On system-startup, it will auto-
execute, display a short message telling you the default delay currently
set, and install its resident part.
or
b) Rename NIGHT.PRG to NIGHT.TTP, then invoke it from the desktop. Enter
the desired delay on the command line. Example: "360" will make the
system wait for 6 minutes of inactivity before it turns blank on you.
For the sake of program compactness, no particular error checking is
provided for whatever you enter.
(Note: if you call NIGHT from the desktop, be sure that you don't already
have a copy of it sitting in memory. Otherwise, you might sit around in
darkness forever...)
In both cases, NIGHT installs its resident part by redirecting the system
vectors for timer, bios and xbios, then intercepting system calls via
those vectors. For details, see the commented source code.
The screen is turned blank by setting the video sync mode to EXTERNAL.
Since there (usually) is nothing to provide sync signals, the screen just
turns blank. Thus, the program <should> work in all resolutions (I could
only try it on my mono system, however).
- Why I like it:
NIGHT is short, efficiently programmed and handles the system vectors
in a sensible way and thus serves as an example for people wishing to
learn how to write such "deep-down" utilities (like myself).
Note: this program does not work when the ETERNAL RAM-Disk (posted earlier
in this discussion) is resident (why ? anyone has a fix ?).
Volker A. Brandt
(Bonn, W. Germany)
--------- NIGHT.ASM: source code for NIGHT utility ---------------------------
title NIGHT - monitor CRT protection utility V0.2
section NIGHT
pagelen 74
* NIGHT - monitor CRT protection utility
*
* To assemble with the GST 68000 Macro Assembler:
*
* ASM NIGHT (ignore messages 'WARNING 5F ....')
* LINK NIGHT
*
* Usage: NIGHT sets the delay to default (currently 120 sec)
* NIGHT <value> sets the delay to <value>
*
* This program is based on a publication in "c't Magazin fuer Computertechnik"
* no. 12/1986 and is public domain. It may not be used for commercial purposes
* in any way. Copying for non-profit use only.
*
* This version is for the GST Assembler, but can easily be converted for use
* with others.
*
* Original program (c) by P. Glasmacher / c't 1986
* Improved program with english comments by Volker A. Brandt
*
* last mod: 05-Dec-86 VAB
*
* Notes: - global constants and vectors appear in UPPER CASE.
* - I have used a PASCAL-like notation:
* " := " means assignment, " = " means comparison.
GEMDOS equ 1 GEMDOS trap number
XBIOS equ 14 XBIOS trap number
TERM equ 0 GEMDOS: terminate process
PRTS equ 9 GEMDOS: print string
TERMRES equ $31 GEMDOS: terminate and keep process resident
MSHRINK equ $4A GEMDOS: return unused memory
SUPEXEC equ 38 XBIOS: supervisor execution
LF equ 10 line feed
CR equ 13 cursor return
* system variables that will be affected
BIOSVEC equ $0B4 BIOS trap vector
TIMVEC equ $114 system timer vector
KBDVEC equ $118 keyboard IRQ
* video shifter registers:
*
* VSYNC bit 0 = 1: external synchronisation
* VMID bit 7 = 1: activate ("just before VBLANK")
VMID equ $FFFF8207 video counter mid
VSYNC equ VMID+3 sync register
SYNCBIT equ 0 sync bit position
* set the following value to your favourite delay:
DEFAULT equ 120 default value: 120 seconds delay
* start of RAM-resident routine
bra start call non-resident init routine
* timer trap - called every 5 msec
*
* check if count = limit. If so, set sync to external.
* exit: old timer trap vector
timtrp movem.l a0-a1,-(sp) save work registers
lea count,a0 A0 := count
lea limit,a1 A1 := limit
addq.l #1,(a0) increment count
cmp.l (a0)+,(a1)+ count = limit ?
bhi.s norm not yet: continue normally
lea VMID,a0
tim1 cmp.b #$80,(a0) wait for VBLANK
bne tim1
bset #SYNCBIT,VSYNC sync bit := 1 ... good night !
lea ecb,a0
addq.w #1,(a0) post ecb ("event control byte")
norm movem.l (sp)+,a0-a1 restore registers ...
move.l timold,-(sp) ... and exit via original timer vector
rts
* keyboard trap - called on every mouse or keyboard interrupt
kbdtrp bsr.s manip perform operation ...
move.l kbdold,-(sp) ... and exit via original keyboard vector
rts
* BIOS trap - called on every BIOS call
*
* check if Bconout() is specified. If so, set count to 0. Reset screen to
* normal if ecb was 1. Exit to original BIOS trap handler.
biostrp move.l d0,-(sp) save D0
move.w 10(sp),d0 D0 := specified BIOS function code
cmp.w #3,d0 is it Bconout() ?
bne.s noout no: continue normally
bsr.s manip yes: perform operation ...
noout move.l (sp)+,d0 ... restore D0 ...
move.l biosold,-(sp) ... and exit via original BIOS trap vector
rts
* common code for BIOS and keyboard traps:
*
* reset count to 0. If ecb = 1, set screen mode back to normal.
manip tst.w ecb is it day or night ?
beq.s retr still day: do nothing
bclr #SYNCBIT,VSYNC it's nighttime: turn on lights !
clr.w ecb ecb := 0
retr clr.l count count := 0
rts
* storage for flags and pointers
limit ds.l 1 timer limit (delay x 200)
count ds.l 1 timer count (ticks every 5 msec)
ecb ds.w 1 night/day flag (0 = day)
timold ds.l 1 original system timer vector
kbdold ds.l 1 original keyboard interrupt vector
biosold ds.l 1 original BIOS trap vector
* end of RAM-resident routine, start of initialisation routine
* (all this will be killed after init)
start move.l 4(sp),a5 A5 := start of program
move.l #start,d0 D0 := end of resident part
sub.l a5,d0
move.l d0,prglen PRGLEN := D0 - A5
move.l d0,-(sp) return unused storage to GEMDOS
move.l a5,-(sp)
move.w #0,-(sp)
move.w #MSHRINK,-(sp)
trap #GEMDOS
lea 12(sp),sp adjust stack pointer
tst.l d0 MSHRINK successful ?
bne error no: abort with error message
bsr.s init everything ok: resume initialisation
move.w #0,-(sp)
move.l prglen,-(sp)
move.w #TERMRES,-(sp) terminate, keep run-time part resident
trap #GEMDOS
* check command tail (if any), init vectors
init lea $80(a5),a0 A0 ==> command tail
sub.l d0,d0
sub.l d2,d2 clear work registers
move.b (a0)+,d0 D0 := length byte
beq.s setlim length = 0: use default
* convert ASCII parameter string to binary
move.l a0,d7 D7 := start of command tail
move.w d0,d1 (used for display message)
move.l a0,a1
add.l d0,a1 A1 := A0 + D0 (one past last char on cmd line)
clr.b (a1) add end-of-string marker
subq.w #1,d1 decrement length
cloop move.b (a0)+,d0 D0 := current command line character
sub.b #'0',d0 ASCII --> binary
bmi.s noval < digit: assume end of value specification
cmp.w #9,d0
bgt.s noval > digit: assume end of value specification
mulu #10,d2
add.w d0,d2 valid digit: D2 := 10 * D2 + D0
noval dbra d1,cloop repeat for all chars in cmd line
setlim tst.l d2 any result ?
bne.s setl1 yes: use it
move.l #DEFAULT,d2 no: use default
clr.l d7
setl1 bsr.s signon display signon message
mulu #200,d2 convert seconds to timer ticks (every 5 ms)
move.l d2,limit save result
move.l #ivec,-(sp) set new vectors in supervisor mode
move.w #SUPEXEC,-(sp)
trap #XBIOS
addq.l #6,sp
rts all done, resume
* set system vectors: save original ones, replace them by new ones
ivec moveq.l #2,d0 we've got 3 vectors to process
sub.l d1,d1 clear D1 (index registers)
lea oldtab,a0 A0 ==> table for original vectors
inxt move.l 00(a0,d1.l),a1 A1 ==> vector address
move.l 12(a0,d1.l),a2 A2 ==> storage area for old value
move.l 24(a0,d1.l),a3 A3 ==> storage area for new value
move.l (a1),(a2) save old value ...
move.l a3,(a1) ... and set new vector
addq.l #4,d1 increment index register
dbra d0,inxt repeat for all 3 vectors
rts
oldtab dc.l BIOSVEC,KBDVEC,TIMVEC system vector locations
dc.l biosold,kbdold,timold old vector values
dc.l biostrp,kbdtrp,timtrp new vector values
prglen ds.l 1
* display signon msg and selected delay value
signon lea nmsg1,a0 A0 ==> signon message
bsr.s prt show it
lea deft,a0 A0 ==> default value string
tst.l d7 use default ?
beq.s deflt yes: skip
move.l d7,a0 D7 ==> command tail
bsr.s prt show it (and hope it makes sense)
lea deft+3,a0 pick up string after default value
deflt bsr.s prt show whatever is left to show
* simple wait loop (only necessary for GEM desktop users)
*wloop moveq.l #20,d1 D1 := outer loop counter
*loop2 moveq.l #-1,d0 D0 := outer loop counter
*loop1 dbra d0,loop1 execute inner ...
* dbra d1,loop2 ... and outer loop
rts return from subroutine "signon" as well
* display "load error" message and return to O/S
error lea errmsg,a0 A0 --> start of string
bsr.s prt
* bsr wloop call wait loop (so a desktop user can read
move.w #TERM,(sp) the message)
trap #GEMDOS terminate process, return to caller
prt move.l a0,-(sp) display string starting at A0
move.w #PRTS,-(sp)
trap #GEMDOS
addq.l #6,sp
rts
* signup and error message area
errmsg dc.b 'NIGHT utility load error',CR,LF,0
nmsg1 dc.b 'NIGHT monitor CRT protection utility - delay: ',0
deft dc.b '120 seconds',CR,LF,0
end
------ End of NIGHT utility -------------------------------------------------braner@batcomputer.tn.cornell.edu (braner) (01/16/87)
[] Here is a simplified version of 'night', coupled with 'killer'. (It is modified to conform to my "resident utility protocol". The source code (in assembler language) is available upon request.) Reminder: 'Night' blanks out the screen after 2 minutes of no activity. Any mouse or keyboard input, or any BIOS text output, will turn screen on again. 'Killer' enables escape from hung-up programs: hold down the <Control>, <Alternate>, and BOTH <Shift> keys and press <Return>. 'Nite' combines the two utilities. * WARNING: * * This is NOT a "well-behaved" TOS program. In fact, it probably * will not work as-is with the next version of the TOS ROMs. * (It's the 'killer' portion that's naughty, not the 'night' portion.) BTW: It works fine with the 'eternal' RAM disk. Just make sure the RAM disk is installed before 'nite'. (Put them in the 'auto' folder in that order.) - Moshe Braner ~~~~~~~~~~~~~~~ cut here ~~~~~~~~~~~~~~~~ begin 644 NITE.PRG M8!H '0 & *I.251% $CG ,!! M^@"40_H C%*0LXAB%D'X@@<,$ " 9OH(^ @@I!^@!Z4E!,WP, +SK_SDYU M3DE410 !A/@@7 5F% PX \.&V8,"-< !2]\ /P*6@ "+SK_WDYU3DE4 M10 O # O H,0 #9@)A"" ?+SK_ZDYU2GD "J9PP(N @@I">0 M *I"N0 *9.=0 7< J;P $(#P "LD(TCP 4@O "\-/SP M #\\ $I.04_O Q*@&8 (QA="\\ ]#\\ "9.3ER//SP "\Z %P_/ Q M3D%!^ $8(% ,J$Y)5$7_^&<>< *2@4'Z !HB<!@ )' 8#"9P&!@DD2*+6(%1 MR/_L3G4 "T !& 10 !L 0@ @ !P 1@ P M0?H 1&$<<A1P_U'(__Y1R?_X3G5!^@ 880AAZCZ\ !.02\(/SP "4Y!7(]. M=0T*"@E.251%.B!L;V%D(&5R<F]R(0T* T*"@E.251%.B!#4E0@<')O=&5C M=&EO;B!A;F0@87-S87-S:6X@=71I;&ET>2 M(&EN<W1A;&QE9"X-"@ -B X&%@@@5@0$! 0$ end
ccs011@vega.ucdavis.edu (Bill Frazer) (03/25/88)
I've just written a program that allows me to generate/display
the Mandelbrot set (at variable magnification). I'd like to be
able to save them in Degas compatible files, but I'm not familliar
with Degas format.
I was wondering if any of you could tell me where I could find
the specs on Dega files, or, if its not too much trouble, send
me a description. Better yet, if anyone has some C source
(preferably Megamax, but its not neccessary) that will save the screen
to a Degas file please send it to me!
Thanks in advance,
ccs011@vega.ucdavis.edu
..!ucbvax!ucdavis!vega!ccs011unpowell@csvax.liv.ac.uk (04/21/88)
In article <1524@ucdavis.ucdavis.edu>, ccs011@vega.ucdavis.edu (Bill Frazer) writes: > > I was wondering if any of you could tell me where I could find > the specs on Dega files, or, if its not too much trouble, send > me a description. Better yet, if anyone has some C source > (preferably Megamax, but its not neccessary) that will save the screen > to a Degas file please send it to me! > A Degas file (without animation data) is 32034 bytes long. The last 32000 bytes is the actual screen image. The first 34 bytes are the resolution and the pallettes. The first word of these bytes is the resolution (0,1 or 2) and the next 32 words are the pallette registers 0 to 15. I don't the format of the compressed files. C source? ... Yeuch! Mark Powell ******************************************************************************** "...I hate the white JANET unpowell@uk.ac.liv.csvax man, and the man UUCP {backbone}!mcvax!ukc!mupsy!liv-cs!unpowell who turned you all ARPA unpowell%csvax.liv.ac.uk@nss.cs.ucl.ac.uk loose..." R. Harper ********************************************************************************