Skip to main content
© Flex

SCREEN AT NIGHT
by Michael Bittner

As computer monitors grow older, they have a tendency that is,
to say it plainly, not very nice: They tend to 'remember'
whatever is usually displayed, so that you can even see it when
the monitor is turned off.
This 'burning in' of an image specifically happens on the ST's
monochrome monitor, and the thing you're most likely to see is
the border (or, when you've been word processing a lot, the pull-
down menu of your word processor).
This is not nice.

So that's why programs exist that 'turn off' the screen after x
minutes have passed. They are called "Night", "Dark" or "Black"
or whatever, and likewise is mine: It's called "Nite".
Whereas most of these other programs are either an accessory
(taking up a valuable slot and quite a bit more of memory) or
they use external sync (can be lethal for your monitor!), I wrote
one that is not an accessory and that will not damage your
monitor. Instead, it does take up 32 Kb of memory.
I guess it's just a matter of priorities.
The source is present in the PROGRAMS folder of this ST NEWS
disk, and you can also see it down here.
The time after which the screen will be blackened can be
determined in the first line of the program. The value put in
'delay0' should be the amount of timer ticks - number of minutes
times 60 (seconds per minute) times 200 (timer ticks per
second).

;****************************************************************
;*********************** NITE-PROGRAM ***************************
;****************************************************************
;by Michael Bittner, October 18th 1990, for "ST NEWS"

start_prog:

move.l #3*60*200,delay0 ;3 min
clr.w move_flag

pea install_vectors(pc)
move #38,-(sp)
trap #14 ;SUPEXEC
addq.l #6,sp

;*** keep resident ***
clr.w -(sp)
move.l #end_prog-start_prog+256+32256,-(sp)
move #$31,-(sp)
trap #1

;*** set new vectors ***
install_vectors:
move.l $4ba.w,old_4ba
;--- change keyboard ---
move.l $118.w,old_kbd
move.l #new_kbd,$118.w
;--- change vbl ---
move.l $70.w,old_vbl
move.l #new_vbl,$70.w
rts

;******************************
;*** new keyboard-interrupt ***
;******************************
new_vbl:
move.l d0,-(sp)
move.l $4ba.w,d0
sub.l old_4ba(pc),d0
cmp.l delay0(pc),d0
blt.s waitlonger
move.l $4ba.w,old_4ba
;--- timeout ---
tst nite_flag
bne.s waitlonger ;-> already dark
move #-1,nite_flag
clr.w move_flag
;--- switch away !!!! ---
move.l $ffff8200.w,save_scraddr ;old screen address
move.l #screen+256,d0 ;new screen-adress
lsr.w #8,d0
move.l d0,$ffff8200.w
move $ffff8240.w,save_color
clr.w $ffff8240.w ;black
waitlonger:
;--- switch back ? ---
tst nite_flag
beq.s vbl_ready
tst move_flag
beq.s vbl_ready
;--- switch back !!!! ---
clr.l $45e.w
move.l save_scraddr,$ffff8200.w
move.w save_color(pc),$ffff8240.w
clr.w nite_flag
vbl_ready:
move.l (sp)+,d0
old_vbl=*+2
jmp $123456

;*************************
;*** new vbl-interrupt ***
;*************************
new_kbd:
move #-1,move_flag
move.l $4ba.w,old_4ba ;start delay again

old_kbd=*+2
jmp $123456

bss

move_flag: ds.w 1
delay0: ds.l 1
old_4ba: ds.l 1
nite_flag: ds.w 1
save_color: ds.w 1
save_scraddr: ds.l 1

end_prog:
screen: ds.b 32256

end

That's all there is to it. The source was written in HiSoft's
"Devpac", but it's probably dead-easy to adapt it for other
assemblers.

Disclaimer
The text of the articles is identical to the originals like they appeared in old ST NEWS issues. Please take into consideration that the author(s) was (were) a lot younger and less responsible back then. So bad jokes, bad English, youthful arrogance, insults, bravura, over-crediting and tastelessness should be taken with at least a grain of salt. Any contact and/or payment information, as well as deadlines/release dates of any kind should be regarded as outdated. Due to the fact that these pages are not actually contained in an Atari executable here, references to scroll texts, featured demo screens and hidden articles may also be irrelevant.