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 > swi 0x05

#2650 - pollier - Mon Feb 10, 2003 12:57 am

I can't get swi 0x05 to work properly, except in the CowBite emulator (???). On VisualBoyAdvance and on hardware it locks up; I've turned on the VBlank interrupt and everything, but somehow it never detects the interrupt and simply hangs at the statement.
Code:
   rIME = 0x1;
   rIE = iVBlank;
   rDispStat |= bit3;
...
mainloop {
...
   asm("swi 0x05");
...
}

I'm using an interrupt table, and all the vblank function does is sets the correct bit in IF. I don't think there's a problem with the asm statement 'cause it works fine in CowBite...

Thanks.
_________________
(Works for me!)

#2719 - peebrain - Tue Feb 11, 2003 11:42 am

Might want to try:

asm("swi 0x050000");

~Sean

#2766 - doragasu - Wed Feb 12, 2003 12:34 pm

The same happens to me, I got to work other SWI's, and I also tried 0x50000, but the program hangs up and never wakes up. I know that the SWI call is executed because I can see it in the trace of BatGBA emulator, but the program never "wakes up".

#2768 - doragasu - Wed Feb 12, 2003 12:36 pm

The same happens to me, I got to work other SWI's, and I also tried 0x50000, but the program hangs up and never wakes up. I know that the SWI call is executed because I can see it in the trace of BatGBA emulator, but the program never wakes up.

#2770 - tepples - Wed Feb 12, 2003 3:23 pm

pollier wrote:
I can't get swi 0x05 to work properly, except in the CowBite emulator (???). On VisualBoyAdvance and on hardware it locks up; I've turned on the VBlank interrupt and everything, but somehow it never detects the interrupt and simply hangs at the statement.
Code:
   rIME = 0x1;
   rIE = iVBlank;
   rDispStat |= bit3;
...
mainloop {
...
   asm("swi 0x05");
...
}

I'm using an interrupt table, and all the vblank function does is sets the correct bit in IF.

Even if you acknowledge an interrupt to the hardware, you also need to acknowledge it to the BIOS. To do this, set the correct bit in 0x03fffff8.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#2813 - pollier - Thu Feb 13, 2003 2:34 am

Er...what is the correct bit? 0x03fffff8 isn't a usual register in GBA.H, is it? And if I do this, will I need to still enable the interrupt register and dispstat?

Thanks for your help so far
_________________
(Works for me!)

#2814 - pollier - Thu Feb 13, 2003 2:36 am

[double post]

Last edited by pollier on Fri Feb 14, 2003 2:23 am; edited 1 time in total

#2818 - DekuTree64 - Thu Feb 13, 2003 3:10 am

I just tried setting the bit at that address (checked the nocash doc and it's really 0x3007ff8, which is right near the end of IWRAM), and it does in fact work. In your IRQ handler, where you write your flag var back to REG_IF, write it to 0x3007ff8 too and everything works fine. I assume it's some sort of special BIOS pseudo-register, but I hadn't ever heard of it either. Oh well, if it works, it works.

#2826 - tepples - Thu Feb 13, 2003 4:55 am

DekuTree64 wrote:
I just tried setting the bit at that address (checked the nocash doc and it's really 0x3007ff8, which is right near the end of IWRAM)

IWRAM mirroring makes 0x03007ff8 and 0x03fffff8 point to the same memory cell. It's just a bit faster to write to 0x03fffff8 because of ARM architecture's weird (compared to MIPS) handling of constant values.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#2864 - pollier - Fri Feb 14, 2003 2:20 am

Thanks, I've got it working now. This post is mainly a test to see if the posting is working 'cause I was getting SQL errors when submitting.

EDIT: Yay, it works. I get this message however:

Quote:

Could not insert new word matches

DEBUG MODE

SQL Error : 1034 Incorrect key file for table: 'phpbb_search_wordmatch'. Try to repair it

INSERT INTO phpbb_search_wordmatch (post_id, word_id, title_match) SELECT 2864, word_id, 0 FROM phpbb_search_wordlist WHERE word_text IN ('thanks', 'ive', 'working', 'post', 'mainly', 'test', 'posting', 'cause', 'getting', 'sql', 'errors', 'submitting')

Line : 242
File : /data/www/gbadev.org/html/forum/includes/functions_search.php

_________________
(Works for me!)