home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / atari / st / tech / 4582 < prev    next >
Encoding:
Text File  |  1992-08-26  |  1.4 KB  |  55 lines

  1. Newsgroups: comp.sys.atari.st.tech
  2. Path: sparky!uunet!mcsun!sun4nl!utrcu1!infnews!infnews!ramaer
  3. From: ramaer@cs.utwente.nl (Mark Ramaer)
  4. Subject: Re: Intterrupts for screen saver ...
  5. Message-ID: <1992Aug26.202556@cs.utwente.nl>
  6. Sender: usenet@cs.utwente.nl
  7. Nntp-Posting-Host: utis143
  8. Organization: University of Twente, Dept. of Computer Science
  9. References:  <1992Aug25.095216.27991@sci.kun.nl>
  10. Date: Wed, 26 Aug 1992 18:25:56 GMT
  11. Lines: 42
  12.  
  13. If you steal a vector, you should use an XBRA chain.
  14. See e.g. archive.cs.ruu.nl:misc/xbra.zoo for an explanation.
  15.  
  16. An interrupt routine must preserve ALL registers, so I prefer
  17. to write it in assembly:
  18.  
  19.     .text
  20.     .globl    _sense_activity
  21. _sense_activity:
  22.     .dc.b    "XBRA"
  23. magic:    .dc.b    "mine"
  24. oldvec:    .ds.l    1
  25. new:    move.w    #1,_keyboard_is_active
  26.     move.l    oldvec,-(sp)
  27.     rts
  28.  
  29.  
  30. Now the global int keyboard_is_active is set to TRUE each
  31. time an interrupt arrives (watch out, not only for keypresses
  32. and mouse movements but also for timer packets and midi.)
  33. A timer routine may test and clear this variable:
  34.  
  35. timer()
  36. {
  37.     if (keyboard_is_active) {
  38.         if (screen_is_saved)
  39.             unsave_screen();
  40.         keyboard_is_active = FALSE;
  41.         counter = delay;
  42.     } else {
  43.         if (counter == 0)
  44.             save_screen();
  45.         else
  46.             counter --;
  47.     }
  48. }
  49.  
  50. Watch out!  If you use external synchronisation to make the screen
  51. black then you can not make 'timer' a VBL routine because with
  52. external synchronisation there will be no more VBL's.
  53.  
  54. Hope this helps, Mark
  55.