what causes an "address error!" ?

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

what causes an "address error!" ?

Post by djcouchycouch » Sun May 06, 2012 3:40 pm

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

Eke
Very interested
Posts: 885
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Sun May 06, 2012 5:10 pm

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

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: what causes an "address error!" ?

Post by Stef » Mon May 07, 2012 8:38 am

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.

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Re: what causes an "address error!" ?

Post by djcouchycouch » Mon May 07, 2012 7:02 pm

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? :)

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: what causes an "address error!" ?

Post by Stef » Tue May 08, 2012 9:48 am

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 :)

Post Reply