Path: 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 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