[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Program idea?
The IIGS Heartbeat is an interrupt which occurs once every 1/60th of a
second, more or less (the variation is generally minimal, unless you have
disabled interrupts during that time, which would stop the heartbeat from
occurring). Basically, once you start the heartbeat interrupts, the
system tick counter increments once each 1/60th of a second. You can read
the current value of the tick counter by using the Miscellaneous Tools
call GetTick.
You can install tasks into the Heartbeat Interrupt Queue by calling
SetHeartbeat (Misc. Tools). Once installed, that event will be called
after a certain number of ticks have occurred. If you want the task to
run every 1/30th of a second, you would tell SetHeartbeat to run the event
in two ticks.
So there would be two ways to time events using the Heartbeat interrupt.
The first is to constantly check the tick count (using GetTick) and count
the 1/60th of a second until it's time to, say, more the object being
animated. The other way is to have a Heartbeat task which would run every
N ticks and set a flag telling your program that it's time to move the
object.
I don't know if this answers your question. Jawaid can probably
clarify/add to this. :)
Good luck!
- Eric S.
--
Eric D. Shepherd | Apple II Alliance Charter Member
InterNet: uerics@mcl.mcl.ucsb.edu | ACM Member
FidoNet: 1:206/2713 Eric Shepherd | Programming Law #1: "When in
AOL: Sheppy | doubt, rewrite from scratch."