Banner
Views: 737,601,900
Time:
14 users online: chillyfox, Hiro-sofT, Infinity, Isikoro, JP32, NGB, o Plasmodium00, Romano338, o RPG Hacker, sinseiga, Telinc1, Teyla, UTF, westslasher2 - Guests: 34 - Bots: 181Users: 38,803 (1,931 active)
Latest: rocketfire
Tip: Don't use savestates when testing your own levels.Not logged in.
SRAM help
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - SRAM help
Pages: « 1 »
I want to have a bunch of collectibles in my hack (think star coins in NSMB) but I can't seem to figure out how I would actually save it to SRAM. I searched the RAM map saw the description for the three bytes at $1F2B:
"Empty. Cleared at reset and titlescreen load. Unlike most empty addresses, this one is saved to and loaded from SRAM."
This doesn't seem to be quite what I'm looking for, however, as all I want is to save something other than cleared exits and player positions.

We’re looking for level designers to work on Extra Mario World!
From ASM Workshop 2013 Summaries (by MarioE)

SRAM stands for Static RAM, meaning that its values are stored to the cartridge, or computer. Because of this, it's commonly used for save game data -- SMW uses it to store how many exits have been found and where the player is in the overworld. In SMW, the SRAM data ranges from $700000-$7007FF, but only $700000-$700359 is actually used. While SMW uses only 2 KB of SRAM, games can have more than that -- SMAS uses 8 KB of SRAM, and the maximum amount of SRAM possible is 128 KB. The SRAM data ranges from addresses $0000-$7FFF in banks $70-$73.

The SRAM size is stored at SNES address $00FFD8. To calculate the SRAM size, in bytes, this formula can be used: 0x800 * 2X-1, where X is the value of $00FFD8. If X = $00, then there is simply no SRAM at all. SMW uses $01 as its value, which is a 2 KB SRAM size.

--------------------
Anime statistic on MyAnimeList:
400 animes completed ✓
6000 episodes completed ✓
100 Days completed ✓
... what even am I doing with my life?
If you want to save something small (three bytes or less), then those three are exactly what you want. Ignore that "cleared on titlescreen load" part; it's loaded after it's cleared, so it doesn't matter that it's cleared.
But I'll reword it a bit. I can admit it is a bit confusing.

If you want to store large amounts of data, you'll need to mess with SRAM, as Jack said.

--------------------
<blm> zsnes users are the flatearthers of emulation
So if I just store my data (I believe it will end up being about 10 bytes or something, so 1F2B won't quite cut it) to empty space like this:

Code
LDA #Whatever
STA $70035A

Will this work?

Edit: Will this still be there even if the player restarts the game?

We’re looking for level designers to work on Extra Mario World!
You have to keep track of what save file you're using. But yes, it'll be there when the player restarts the game.

However, in most cases, you want to write to a buffer and then transfer the buffer over to SRAM when saving the game. SMW does this in order to save level progress at castles instead of saving it immediately.

EDIT: For your purposes I recommend using my SRAM patch, which can be found here. It actually saves you 141 bytes of RAM at $1F49, so you don't need to use anything outside the range of absolute addressing.
Ok, thanks a lot!

We’re looking for level designers to work on Extra Mario World!
Pages: « 1 »
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - SRAM help

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2019 - SMW Central
Legal Information - Privacy Policy - Link To Us


Total queries: 25

Menu

Follow Us On

  • Facebook
  • Twitter
  • YouTube

Affiliates

  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • ROMhacking.net
  • MFGG
  • Gaming Reinvented