Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Archive » net.micro.atari » ST timer tick?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
ST timer tick? [message #282542] Wed, 08 January 1986 13:45 Go to next message
tynor is currently offline  tynor
Messages: 28
Registered: May 2013
Karma: 0
Junior Member
Article-I.D.: gitpyr.1241
Posted: Wed Jan  8 13:45:20 1986
Date-Received: Thu, 9-Jan-86 03:39:10 EST
Reply-To: tynor@gitpyr.UUCP (Steve Tynor)
Organization: Georgia Institute of Technology
Lines: 16

Can anyone tell me how I can get a simple timer tick on my ST?  I need a
high resolution timer so that I can record keystrokes off of MIDI for a 
simple sequencer I'm writing.  However, I've looked through all the
developer documentation and can't figure out how to do it...  Do I have to
write an interupt handler to count timer interupts? (ugh...) I can't believe
it's as hard as that...

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Progress means replacing something wrong with something more subtly wrong.
                     
    Steve Tynor
    Georgia Instutute of Technology

 ...{akgua, allegra, amd, harpo, hplabs,
     ihnp4, masscomp, ut-ngp, rlgvax, sb1,
     uf-cgrl, unmvax, ut-sally}  !gatech!gitpyr!tynor
Re: ST timer tick? [message #282615 is a reply to message #282542] Sat, 11 January 1986 22:53 Go to previous messageGo to next message
bammi is currently offline  bammi
Messages: 27
Registered: January 1986
Karma: 0
Junior Member
Article-I.D.: cwruecmp.1368
Posted: Sat Jan 11 22:53:10 1986
Date-Received: Tue, 14-Jan-86 04:19:23 EST
References: <1241@gitpyr.UUCP>
Organization: CWRU Dept. Computer Eng., Cleveland, OH
Lines: 49

[color=blue]>  Can anyone tell me how I can get a simple timer tick on my ST?  I need a[/color]
[color=blue]>  high resolution timer so that I can record keystrokes off of MIDI for a [/color]
[color=blue]>  simple sequencer I'm writing.  However, I've looked through all the[/color]
[color=blue]>  developer documentation and can't figure out how to do it...  Do I have to[/color]
[color=blue]>  write an interupt handler to count timer interupts? (ugh...) I can't believe[/color]
[color=blue]>  it's as hard as that...[/color]
[color=blue]>  [/color]
[color=blue]>      Steve Tynor[/color]
[color=blue]>      Georgia Instutute of Technology[/color]
	The simplest way is to read the value of the 200 Hz system
timer contained in location 4BA -- The hitch Hikers guide says 4BC but
that is a misprint. It has to be done in super mode otherwise you get
mushrooms. Here is a example

long ticks;
long *_hz200 = 0x000004ba;

read_ticks()
{
	ticks = *_hz200;
}

main()
{
......
	/* Call read_ticks in super mode - this def if missing  in
	osbind.h */
	xbios(38,read_ticks);
	/* ticks now has the value of the 200 Hz timer */
}

You could also use the Xbtimer() xbios call with timer a, but I
have'nt gotten it to work correctly as yet ( I had posted a query a
couple of days back, but still have no answer ).

Some people over here have been hacking midi code too. One of their
experiences was that incresing the size of the midi receive buffer
helps a lot too in keeping up with some of the Yahama equipment that
send status bytes every 200 ms (I think). this can be done by using
the Iorec() xbios call. Hope this helps.



-- 
					Jwahar R. Bammi
			       Usenet:  .....!decvax!cwruecmp!bammi
			        CSnet:  bammi@case
				 Arpa:  bammi%case@csnet-relay
			   CompuServe:  71515,155
Re: ST timer tick? [message #282620 is a reply to message #282542] Sun, 12 January 1986 01:30 Go to previous messageGo to next message
mendoza is currently offline  mendoza
Messages: 4
Registered: December 1985
Karma: 0
Junior Member
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

In article <1241@gitpyr.UUCP> tynor@gitpyr.UUCP (Steve Tynor) writes:
[color=blue]> Can anyone tell me how I can get a simple timer tick on my ST?[/color]
[color=blue]> [/color]

     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 */
}
Re: ST timer tick? [message #282701 is a reply to message #282542] Thu, 16 January 1986 20:36 Go to previous message
knnngt is currently offline  knnngt
Messages: 19
Registered: December 1985
Karma: 0
Junior Member
Article-I.D.: ukma.2469
Posted: Thu Jan 16 20:36:04 1986
Date-Received: Sat, 18-Jan-86 00:31:06 EST
References: <1241@gitpyr.UUCP> <1368@cwruecmp.UUCP>
Reply-To: knnngt@ukma.UUCP (Alan Kennington)
Organization: Univ. of KY Mathematical Sciences
Lines: 18

**** "They eat lions, don't they?" - film title ****
	On the subject of timer A in the 78901 chip, I checked out the entire
bios code that is executed upon entry to xbtimer from start to finish. And it
all seemed to be beautifully in accord with the specifications for the
timer chip. I was just about to give up when I read in the bios manual that
some tricky business with the Hsync interrupt could be done by faking RTEs.
Then I realised that timer interrupts put a short stack frame onto the
supervisor stack. Which means that an RTE in Super mode is required. A C
program return can presumably only ever be an RTS. Hence the program
can not possibly work by diverting the timer interrupt to a C function
as an interrupt handler.
	First, can anybody out there confirm my brief analysis of the problem.
Second, has anybody discovered the means of RTEing at the end of a C program?
The bios manual defines xbtimer as a C program. But it doesn't mention
anything about having to write an assembly language program to handle
timer interrupts. Many of you must have long ago written programs to
handle such interrupts. So please tell me if I am incorrect in all of this.
Thanks.............................ak.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Public domain assembler for the ST; uuENcoded, long
Next Topic: Re: 1meg upgrade killer - safer way?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Mon May 16 05:17:27 EDT 2022

Total time taken to generate the page: 0.00725 seconds