Re: A89: Re: Disabling Interrupts


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

Re: A89: Re: Disabling Interrupts




I may be stupid but what is wrong with this:

void myHandler(void)
{
   // Your code
   asm("unlk %a6; rte");
} // wasted space here, but oh well... (unlk %a6; rts)

Zeljko Juric wrote:
> Such handler is incorrect
> 
> void myHandler(void)
> {
>   // Your code
>   asm("rte");
> }
> 
> because "rte" will not be happy with the content of the stack frame
> which is created on the beginning of each function. So, the interrupt
> handler must be a pure assembly procedure (which may call any other
> C procedure). I suggest the following handler:
> 
> void myHandler(void);
> asm("myHandler:
> movem.l %a0-%a6/%d0-%d7,-(%sp)
> bsr myHandler_main
> movem.l (%sp)+,%a0-%a6/%d0-%d7
> rte");
> 
> void myHandler_main(void)
> {
>   // Your code (in C)
> }
> 
> I hope that it helps.
> 
> Cheers,
> 
> Zeljko Juric

-- 
Scott "Wrath" Dial
wrath@calc.org
ICQ#3608935
Member of TCPA - tcpa.calc.org
PGP key available
_______________________________________________
Why pay for something you could get for free?
NetZero provides FREE Internet Access and Email
http://www.netzero.net/download/index.html



References: