Page 1 of 1

what causes an "address error!" ?

Posted: Sun May 06, 2012 3:40 pm
by djcouchycouch
Hi,

Running Goplanes on hardware lately has been giving me crashes, with a message of "Address Error!". What would typically cause that?

I've tried a few different emulators but none picked up on the error.

Also, is there a way to plug-in my own error callbacks?

Thanks!
DJCC

Posted: Sun May 06, 2012 5:10 pm
by Eke
Address error happens when you try to read a word from an odd address, think about it as a misaligned memory access.

Now, emulators generally don't emulate it because no official games rely on it and it slowdowns CPU emulation (since you have to check address alignment on each word reads) but I think Regen at least emulates it.

Also, is there a way to plug-in my own error callbacks?
yes, address error exception jump vector is picked from ROM offset $0C so you simply have to put your callback address there

Re: what causes an "address error!" ?

Posted: Mon May 07, 2012 8:38 am
by Stef
djcouchycouch wrote: Also, is there a way to plug-in my own error callbacks?
In the SGDK boot header (sega.s), the interrupt calls the following method (located in base.c) :

Code: Select all

void _addresserror_callback()
{
    VDP_init();
    VDP_drawText("ADDRESS ERROR !", 10, 10);

    while(1);
}
So it is somewhat hardwired... i really wonder why i used hardwired methods instead of callback pointer O_o ? So right now to use your method you have to modify sega.s or base.c file and recompile the library.
I will use callback pointer in the next version to offer more flexibility here.

Re: what causes an "address error!" ?

Posted: Mon May 07, 2012 7:02 pm
by djcouchycouch
Stef wrote:.
I will use callback pointer in the next version to offer more flexibility here.
Ok, I'll modify my local copy for now.

Any idea when that "next version" will appear? :)

Re: what causes an "address error!" ?

Posted: Tue May 08, 2012 9:48 am
by Stef
djcouchycouch wrote:
Stef wrote:.
I will use callback pointer in the next version to offer more flexibility here.
Ok, I'll modify my local copy for now.

Any idea when that "next version" will appear? :)
Hehe always difficult to answer here :p
I have so few time to work on it but honestly i think i will do a release really soon, even if some stuff are missing :)
Edit: So it's done :)