Error dump from SRAM_enable()

SGDK only sub forum

Moderator: Stef

Post Reply
realbrucest
Interested
Posts: 27
Joined: Wed Sep 21, 2011 9:00 pm
Location: Sevilla, Spain
Contact:

Error dump from SRAM_enable()

Post by realbrucest » Sun Jun 23, 2019 10:03 am

Hi, I'm starting now to mess around with SRAM routines but sadly I got my first trouble at the very first routine :cry:

Calling "SRAM_enable()" I got this crash:

Image

I did check rom_head.c and changed the two chars control value ("RA"), same result.

What am I missing at those first steps?

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: Error dump from SRAM_enable()

Post by Chilly Willy » Sun Jun 23, 2019 4:31 pm

If your rom is too big, turning on the save ram may cause it to crash because the rom above 0x200000 is bank switch away. Code that turns on/off the sram or reads/writes the sram MUST be below that address or in work ram. If any interrupt code may be above that address, the interrupts MUST be disabled while sram is enabled.

Given your rom is tiny, my guess is you screwed up the header when you changed it, causing it to be too big or too small, or something to do with not setting the ram type to a proper value (0xF820 should follow the RA).

Double check all those strings in the header that you didn't change their length compared to the default header. The format of the rom header is CRUCIAL, and a single byte can make the rom fail.

realbrucest
Interested
Posts: 27
Joined: Wed Sep 21, 2011 9:00 pm
Location: Sevilla, Spain
Contact:

Re: Error dump from SRAM_enable()

Post by realbrucest » Mon Jun 24, 2019 5:05 pm

OK, I'll have a look to that; starting from a "clean" rom file I'll check the changes one by one.

Thanks a lot for all the clues Chilly Willy.

Post Reply