gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Audio > Setting Interrupt Handler With Standart GCC crt0.s

#4587 - rome - Thu Apr 03, 2003 9:32 pm

?m using startfiles (crt0.s lnkscript, etc...) from GCC compiler. And i wanna setup my interrupt handler correctly. i do something like that:
Code:


void InterruptProcess()
{
   if (REG_IF &  INT_TIMER1)
   {
      //Handling Timer 1
   }
   else
   if(REG_IF & INT_TIMER0)
   {
      // Handling Timer 0
   }

   REG_IF |=REG_IF;
}


void main()
{
REG_INTERUPT = (u32)&InterruptProcess;
REG_IE = 0x18;
REG_IME = 1;
...
...
// bla bla bla....
}


that?s correct? There is any Register unsaved? Processor State changed, context error on return etc...
Thanks a lot!!!!

#4598 - DekuTree64 - Fri Apr 04, 2003 4:22 am

Hmm, well for one thing, take the & out of (u32)&InterruptProcess. Just the function name is its address. And of course you'll have to set the IRQ bits ni the timer control regs, but you probably already did that. Other than that I don't see any reason it wouldn't work. Have you tried just testing it yet?