#9457 - Wanderer - Tue Aug 05, 2003 11:54 am
Hi,
I'm having a bit of trouble getting some of my code to work on hardware, although it seems to work fine with VisualBoyAdvance 1.5.1
The code is using HBlank interrupts and is also calling the Bios VBlankIntrWait function. On the emu this works fine, however on the GBA the HBlank seems to get serviced but the code never returns from the Bios call (as far as I can tell).
Here's the code that seems to be at the centre of the problem:
From what I understand this should all work, but it doesn't. Can someone please tell me what I'm doing wrong?
cheers,
Wanderer.
I'm having a bit of trouble getting some of my code to work on hardware, although it seems to work fine with VisualBoyAdvance 1.5.1
The code is using HBlank interrupts and is also calling the Bios VBlankIntrWait function. On the emu this works fine, however on the GBA the HBlank seems to get serviced but the code never returns from the Bios call (as far as I can tell).
Here's the code that seems to be at the centre of the problem:
Code: |
void WaitForVsyncSetup() { GBA_INTERPROC = (u16*)&interProc; GBA_REG_IE |= GBA_VBLANK_INTR; GBA_REG_DISPSTAT |= 0x0008; GBA_REG_IME = 0x01; } void OnHBlankSetup(void (*HProc)(void)) { GBA_INTERPROC = (u16*)&interProc; MyHProc = HProc; GBA_REG_IE |= GBA_HBLANK_INTR; GBA_REG_DISPSTAT |= 0x0010; GBA_REG_IME = 0x01; } // Wait for the Vertical sync. void WaitForVsync() { asm volatile("swi 0x50000"); } void interProc() { GBA_REG_IME = 0x00; if(GBA_REG_IF & GBA_VBLANK_INTR) { (*(volatile u32*)0x03fffff8) = GBA_VBLANK_INTR; GBA_REG_IF |= GBA_VBLANK_INTR; } if(GBA_REG_IF & GBA_HBLANK_INTR) { (*(volatile u32*)0x03fffff8) = GBA_HBLANK_INTR; GBA_REG_IF |= GBA_HBLANK_INTR; MyHProc(); } GBA_REG_IME = 0x01; } |
From what I understand this should all work, but it doesn't. Can someone please tell me what I'm doing wrong?
cheers,
Wanderer.