home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / apple2 / 26491 < prev    next >
Encoding:
Internet Message Format  |  1993-01-06  |  1.8 KB

  1. Path: sparky!uunet!europa.asd.contel.com!emory!swrinde!network.ucsd.edu!ucsbcsl!mcl!uerics
  2. From: uerics@mcl.ucsb.edu (Eric D. Shepherd)
  3. Newsgroups: comp.sys.apple2
  4. Subject: Re: Program idea?
  5. Message-ID: <uerics.726359386@mcl>
  6. Date: 6 Jan 93 22:29:46 GMT
  7. References: <bazyar.726298918@teal> <1993Jan6.100420.19800@nuscc.nus.sg>
  8. Sender: root@ucsbcsl.ucsb.edu
  9. Lines: 33
  10.  
  11. The IIGS Heartbeat is an interrupt which occurs once every 1/60th of a
  12. second, more or less (the variation is generally minimal, unless you have
  13. disabled interrupts during that time, which would stop the heartbeat from
  14. occurring).  Basically, once you start the heartbeat interrupts, the
  15. system tick counter increments once each 1/60th of a second.  You can read
  16. the current value of the tick counter by using the Miscellaneous Tools
  17. call GetTick.
  18.  
  19. You can install tasks into the Heartbeat Interrupt Queue by calling
  20. SetHeartbeat (Misc. Tools).  Once installed, that event will be called
  21. after a certain number of ticks have occurred.  If you want the task to
  22. run every 1/30th of a second, you would tell SetHeartbeat to run the event
  23. in two ticks.
  24.  
  25. So there would be two ways to time events using the Heartbeat interrupt.
  26. The first is to constantly check the tick count (using GetTick) and count
  27. the 1/60th of a second until it's time to, say, more the object being
  28. animated.  The other way is to have a Heartbeat task which would run every
  29. N ticks and set a flag telling your program that it's time to move the
  30. object.
  31.  
  32. I don't know if this answers your question.  Jawaid can probably
  33. clarify/add to this. :)
  34.  
  35. Good luck!
  36.  
  37. - Eric S.
  38.  
  39. --
  40. Eric D. Shepherd                   | Apple II Alliance Charter Member
  41. InterNet: uerics@mcl.mcl.ucsb.edu  |           ACM Member
  42. FidoNet:  1:206/2713 Eric Shepherd | Programming Law #1: "When in
  43. AOL:      Sheppy                   | doubt, rewrite from scratch."
  44.