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.

Coding > Interrupts?!

#24525 - ProblemBaby - Thu Aug 05, 2004 3:03 am

My program runs fine in both VBA and No$GBA
and at Hardware if I flash it to my flashcard.
But since my program still is small and I need to check a lot of stuff at hardware I want to run it as Multiboot!
But It wont work. the Interrupts doesnt work.
Ive tried both Jeff Frohweins Interrupt Handler
and to write my own in pure ASM (with ARM instructions of course) that just handles the Interrupt iam interested in (for now). Ive no idea of why it is like this.
Plz Help

I am using Flash2Advance and junk on the screen is left from the loader I dont know if this has something to do with my problem.

#24530 - tepples - Thu Aug 05, 2004 6:03 am

Could you post the minimal source code that exhibits the misbehavior (main.c and isr.c)?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#24536 - ProblemBaby - Thu Aug 05, 2004 11:34 am

Yes:

Main.c:
Code:

int __gba_multiboot;

// Funktioner
void AgbMain()
{
   REG_INTERRUPT = (u32)&InterruptProcess;
   REG_DISPSTAT |= 0x8;
   REG_IE = 0x1;
   REG_IME = 1;


   while (1)
   {
      // game stuff
      BIOS_VBlankIntrWait();
      CopyOAM();
   }
}


(InterruptSupport is commented in crt0.s)
here is my InterruptProcess:

Code:

.thumb
.align 1
.text

some functions in thumb...

.arm
.align 2
.section .iwram, "ax", %progbits

.global InterruptProcess
InterruptProcess:
   LDR r0, =REG_IME
   LDR r1, =0x0
   STRH r1, [r0]

   LDR r0, =REG_IF
   LDR r1, =0x1
   STRH r1, [r0]

   LDR r0, =0x3FFFFF8
   LDR r1, [r0]
   ORR r1, r1, #0x1
   STR r1, [r0]

   LDR r0, =REG_IME
   LDR r1, =0x1
   STRH r1, [r0]
   
   BX lr

.pool
.end


I tried some before with a hblank interrupt to not look up the system as this does if it doesnt work but the multiboot version (on hardware) simply ignored the interrupt.

#24546 - wintermute - Thu Aug 05, 2004 3:52 pm

There is no support for the bios IntrWait functions in the majority of publically available interrupt handler code.

Have a look at libgba on http://www.devkit.tk

single_ints.s & interrupt.c are the files of interest

#24549 - tepples - Thu Aug 05, 2004 3:57 pm

Another thing popped into my head: Are you making sure to name your binary with a .mb (not .gba) suffix when running it in VBA?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#24558 - ProblemBaby - Thu Aug 05, 2004 9:54 pm

wintermute wrote:

There is no support for the bios IntrWait functions in the majority of publically available interrupt handler code.

Have a look at libgba on http://www.devkit.tk

single_ints.s & interrupt.c are the files of interest


I dont understand what you mean...
If you saw my code the interrupt handler was programmed special only for this interrupt.
Ive tried you interrupt code and tried to run the BGScroll example both with the same results. the interrupts doesnt work if I just have a HBlank interrupt it doesnt work either. so I dont think it has something to do with the code or IntrWait.

Tepples:
i tried .bin suffix I tried .mb and it works also.

Iam quite sure that it has something to do with Flash2Advance does it exist any freeware alternative so I can use the same cable USB-GBA?

[/quote]

#24562 - dagamer34 - Thu Aug 05, 2004 11:22 pm

Your code won't work as of now. You are trying to use the BIOS Vblank interrupt without ever telling the BIOS that a VBlank has occured. You have to write to a certain bit during a Vblank to so that the bios knows a vblank has occured and your normal loop can continue execution.

Here's a link to what I'm talking about: http://forum.gbadev.org/viewtopic.php?t=3791

I just made up a name for the register, it's nothing official. I think it describes it quite nicely though.
_________________
Little kids and Playstation 2's don't mix. :(

#24565 - wintermute - Fri Aug 06, 2004 12:07 am

dagamer34 wrote:
Your code won't work as of now. You are trying to use the BIOS Vblank interrupt without ever telling the BIOS that a VBlank has occured. You have to write to a certain bit during a Vblank to so that the bios knows a vblank has occured and your normal loop can continue execution.


Actually he is doing the needfule with the BIOS interrupt flags - I missed it when I was looking through the code too.