[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Program idea?



In article <1993Jan7.062317.11268@nuscc.nus.sg> isc10327@nusunix1.nus.sg (ONG TAT-WEE) writes:
> Eric D. Shepherd (uerics@mcl.ucsb.edu) wrote:
> : 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.
> : 
> 	Eric, is there any other way of reading the HeartBeat tick
> counter like accessing a special location instead of calling GetTick?

Yes.  Use the GetAddr call to get the address of the tick counter, and
refer to it directly.  Note: the tick counter won't start counting
until the first HeartBeat task is installed.  The easiest way to force
this is to install a task and immediately remove it again.

You must leave interrupts enabled if you want the tick count to be
incremented.  This uses up some CPU time every VBL, but if you've
booted GS/OS, various INITs will probably have heartbeat tasks
installed anyway.

> I know it's good to use tools and stick to the standard way of accessing
> things on the IIGS, but my program currently only uses the Tool Locator
> and Memory Manager; nothing else.  I don't wish to startup the MiscTools
> 'coz it'll add overhead to the program.

Overhead?  Fourteen bytes for the Startup and Shutdown calls???  The
Miscellaneous toolset is in ROM, so you don't need to load it from disk.

If you are only interested in synchronizing with the vertical
blanking, just wait for the I/O location ($C019) to indicate the VBL
period.

You can also use the video counters ($C02E and $C02F) to aid in timing
your animation.
-- 
David Empson

Internet: David.Empson@bbs.actrix.gen.nz    EMPSON_D@kosmos.wcc.govt.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand