🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.atari
Article #2010

Re: ST timer tick?

#2010
From: Lee Mendoza
Date: Sun, 12 Jan 1986 06:30
39 lines
2099 bytes
In article <1241@gitpyr.UUCP> tynor@gitpyr.UUCP (Steve Tynor) writes:
>Can anyone tell me how I can get a simple timer tick on my ST?
>

     I have written a simple function which accesses the 200 Hz timer tick,
unfortunately it is the highest resolution timer that I could find.  [If
anyone knows of a 1 ms timer I would like to hear about it.]

     This function requires that your program include osbind.h (for the
Super() function); which requires that you include osbind.o when you link
your program.  Note that the address pointed to in the "Hitchhiker's Guide
to the BIOS" is not correct.  I suffered greatly over this until I started
poking around using SID.  The address is correct in the BIOS listings.

Lee Mendoza

------

/* timer.h -- returns a longword containing the number of milliseconds since
 *            booting, with a resolution of 5 ms.
 *
 * Written by Lee Mendoza
 *
 */

long timer()
{
  long stack, time, *timer;

  timer = 0x4ba;               /* _hz_200:  200 Hz system timer tick */
  stack = 0;                   /* null the stack pointer */

  stack = Super(stack);        /* enter supervisor mode, save the stack */
  time = *timer;               /* get 5 ms timer tick */
  stack = Super(stack);        /* exit supervisor mode, restore the stack */

  time = 5*time;               /* calculate the time... */
  return(time);                /* and return it to the caller */
}
Technical Details
Message-ID: <207@aero.ARPA>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!qantel!hplabs!sdcrdcf!trwrb!trwrba!aero!mendoza
References: <1241@gitpyr.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site aero.ARPA
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!qantel!hplabs!sdcrdcf!trwrb!trwrba!aero!mendoza
From: mendoza@aero.ARPA (Lee Mendoza)
Newsgroups: net.micro.atari
Subject: Re: ST timer tick?
Message-ID: <207@aero.ARPA>
Date: Sun, 12-Jan-86 01:30:25 EST
Article-I.D.: aero.207
Posted: Sun Jan 12 01:30:25 1986
Date-Received: Tue, 14-Jan-86 05:08:25 EST
References: <1241@gitpyr.UUCP>
Reply-To: mendoza@aero.UUCP (Lee Mendoza)
Organization: The Aerospace Corporation, El Segundo, CA
Lines: 40
Keywords: timer routine