SRAM with 4MiB game?

SGDK only sub forum

Moderator: Stef

Post Reply
Very interested
Posts: 86
Joined: Fri Sep 25, 2015 4:16 pm

SRAM with 4MiB game?

Post by mikejmoffitt » Fri Apr 14, 2017 6:31 pm

I am anticipating that my game will grow larger than 2MiB. From what I can gather, a typical arrangement for a <=2MiB game is that SRAM is mapped to the upper 2MiB of addresss space while the ROM is mapped to the lower 2MiB (starting at 0x000000).

For a game that has grown considerably, does SGDK have any methods in place to deal with the needed banking techniques?

Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm

Re: SRAM with 4MiB game?

Post by Sik » Fri Apr 14, 2017 11:28 pm

Bingo: ... inc/sram.h

Your code is likely under 2MB so this shouldn't be an issue (and you probably aren't transferring graphics meanwhile). The biggest issue in this case would be to ensure the Z80 is not trying to access the >2MB area. You may have to need to halt the Z80 while SRAM is in use.

If you're using for saving only this probably is not an issue since you only touch SRAM during load/save (and otherwise keep any data in RAM) so at worst it'd be a tiny disruption (which you could try covering up with a sound effect). Depending how the game is designed, it's possible sound isn't even playing, in fact.
Sik is pronounced as "seek", not as "sick".

Post Reply