🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #35033

Re: Need help with Xbtimer

#35033
From: Ken Soohoo
Date: Sun, 13 Nov 1988 06:51
38 lines
2063 bytes
In article <1227@atari.UUCP> apratt@atari.UUCP (Allan Pratt) writes:
>In article <26751@ucbvax.BERKELEY.EDU> morrison@renoir.Berkeley.EDU 
>(Scott Morrison) writes:
>> I am having trouble getting a timer interrupt routine to work.
>
>Xbtimer takes four arguments: the timer to set up, the control and data
>values for the timer, and a pointer to an interrupt handler.  You are
>passing a pointer to a C procedure, which is not the same thing: C
>procedures end with RTS, while interrupt handlers end with RTE.  I don't
>know if MWC has a function you can call which causes your procedure to
>end with RTE (some compilers do), but this is definitely your problem. 
>

Allan's right!
I've used MWC and Xbtimer, and _my_ solution was to write a little
assembly language routine that does the timer interrupt handling:
1) Don't forget to save the registers you use before processing,
   and restore them after (use movem.l).
2) You'll have to handle clearing the interrupt pending, enable,
   and in-service bytes:

	0xFFFa07	enable A
	0xFFFa0b	pending A
	0xFFFa0f	in-service A
	
   I believe bit 0 determines if its active or not, don't disturb
   the other bits when you clear one..
   (You only have to clear the in-service, the system clears 
    the pending one by itself).

3) rte at the end of your routine.


Hope this helps.
--Kenneth Soohoo	(soohoo@cory.Berkeley.Edu)
  Atari 400/800/600xl/800xl/1200/130xe/65xe, 1040ST hacker
  Sometime Berkeley Student, othertimes...
  My opinions are my OWN, not necessarily Atari's
Technical Details
Message-ID: <7341@pasteur.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!pacbell!lll-tis!helios.ee.lbl.gov!pasteur!cory.Berkeley.EDU!soohoo
References: <26751@ucbvax.BERKELEY.EDU> <1227@atari.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!pacbell!lll-tis!helios.ee.lbl.gov!pasteur!cory.Berkeley.EDU!soohoo
From: soohoo@cory.Berkeley.EDU (Ken Soohoo)
Newsgroups: comp.sys.atari.st
Subject: Re: Need help with Xbtimer
Message-ID: <7341@pasteur.Berkeley.EDU>
Date: 13 Nov 88 06:51:13 GMT
References: <26751@ucbvax.BERKELEY.EDU> <1227@atari.UUCP>
Sender: news@pasteur.Berkeley.EDU
Reply-To: soohoo@cory.Berkeley.EDU.UUCP (Ken Soohoo)
Organization: University of California, Berkeley
Lines: 38