home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.atari.st.tech
- Path: sparky!uunet!mcsun!sun4nl!utrcu1!infnews!infnews!ramaer
- From: ramaer@cs.utwente.nl (Mark Ramaer)
- Subject: Re: Intterrupts for screen saver ...
- Message-ID: <1992Aug26.202556@cs.utwente.nl>
- Sender: usenet@cs.utwente.nl
- Nntp-Posting-Host: utis143
- Organization: University of Twente, Dept. of Computer Science
- References: <1992Aug25.095216.27991@sci.kun.nl>
- Date: Wed, 26 Aug 1992 18:25:56 GMT
- Lines: 42
-
- If you steal a vector, you should use an XBRA chain.
- See e.g. archive.cs.ruu.nl:misc/xbra.zoo for an explanation.
-
- An interrupt routine must preserve ALL registers, so I prefer
- to write it in assembly:
-
- .text
- .globl _sense_activity
- _sense_activity:
- .dc.b "XBRA"
- magic: .dc.b "mine"
- oldvec: .ds.l 1
- new: move.w #1,_keyboard_is_active
- move.l oldvec,-(sp)
- rts
-
-
- Now the global int keyboard_is_active is set to TRUE each
- time an interrupt arrives (watch out, not only for keypresses
- and mouse movements but also for timer packets and midi.)
- A timer routine may test and clear this variable:
-
- timer()
- {
- if (keyboard_is_active) {
- if (screen_is_saved)
- unsave_screen();
- keyboard_is_active = FALSE;
- counter = delay;
- } else {
- if (counter == 0)
- save_screen();
- else
- counter --;
- }
- }
-
- Watch out! If you use external synchronisation to make the screen
- black then you can not make 'timer' a VBL routine because with
- external synchronisation there will be no more VBL's.
-
- Hope this helps, Mark
-