Saving in SRAM- Need any info on how cartridge saving works!
Moderator: Moderators
- Hamtaro126
- Posts: 783
- Joined: Thu Jan 19, 2006 5:08 pm
Saving in SRAM- Need any info on how cartridge saving works!
I am still working on my ''Super Mario Brothers 1 Hack'', I need help creating a Zelda/Star Tropics style ''Save Game Screen'' for a Save RAM Hack. any tutorial, code, or documentation on how it should become is appreciated.
Any info on how to save, load and delete games, plus info on how to input names?
One last thing, info provided can be used in any games that are hacked, free, or/and has source with it.
Any info on how to save, load and delete games, plus info on how to input names?
One last thing, info provided can be used in any games that are hacked, free, or/and has source with it.
AKA SmilyMZX/AtariHacker.
There is no trick. Whatever you write to SRAM stays there and doesn't vanish when the power is switched off. Well, this is what should happen, because there are some conditions that might corrupt SRAM, but there is nothing a programmer can do to avoid this. Newer mappers have some means of protecting that memory, often offering registers to prevent or allow writing to SRAM. Just read the mapper-specific documents to see if they offer SRAM protection and how you can use it.
For saving games you have to backup whatever variables the game needs to resume it's state. Since you didn't program SMB1 it might be hard to tell what those variables are for that game. But since SMB1 didn't have any extra RAM, you should be able to save a game by backing up the whole 2KB of built in RAM ($0000-$07FF). With the standard 8KB of SRAM you could save up to 4 games.
It should be very easy to write a loop to copy the whole RAM to SRAM, as should be copying it back. The hardest part should be programming the menu interface to select those options. If you ave no idea on how to do this, you are out of luck because I doubt you are going to find a guide/tutorial for something as specific as this.
Writing a menu is like any other kind of NES programming. You have to draw the menu to the Name Tables, read the controllers and move a cursor around, and so on. Inputting names is the same thing, you ned to code your own interface, with all the letters and a cursor. This should be easy for anyone that has programmed anything serious (more complex than "Hello World") for the nes, I don't know exactly how much experience with it you have. But if you ask me, your necessity to build this interactive menu might be a great opportunity to learn some more NES programming.
For saving games you have to backup whatever variables the game needs to resume it's state. Since you didn't program SMB1 it might be hard to tell what those variables are for that game. But since SMB1 didn't have any extra RAM, you should be able to save a game by backing up the whole 2KB of built in RAM ($0000-$07FF). With the standard 8KB of SRAM you could save up to 4 games.
It should be very easy to write a loop to copy the whole RAM to SRAM, as should be copying it back. The hardest part should be programming the menu interface to select those options. If you ave no idea on how to do this, you are out of luck because I doubt you are going to find a guide/tutorial for something as specific as this.
Writing a menu is like any other kind of NES programming. You have to draw the menu to the Name Tables, read the controllers and move a cursor around, and so on. Inputting names is the same thing, you ned to code your own interface, with all the letters and a cursor. This should be easy for anyone that has programmed anything serious (more complex than "Hello World") for the nes, I don't know exactly how much experience with it you have. But if you ask me, your necessity to build this interactive menu might be a great opportunity to learn some more NES programming.
- Hamtaro126
- Posts: 783
- Joined: Thu Jan 19, 2006 5:08 pm
Thanks, I'll see what I come up with,tokumaru wrote:There is no trick. Whatever you write to SRAM stays there and doesn't vanish when the power is switched off. Well, this is what should happen, because there are some conditions that might corrupt SRAM, but there is nothing a programmer can do to avoid this. Newer mappers have some means of protecting that memory, often offering registers to prevent or allow writing to SRAM. Just read the mapper-specific documents to see if they offer SRAM protection and how you can use it.
For saving games you have to backup whatever variables the game needs to resume it's state. Since you didn't program SMB1 it might be hard to tell what those variables are for that game. But since SMB1 didn't have any extra RAM, you should be able to save a game by backing up the whole 2KB of built in RAM ($0000-$07FF). With the standard 8KB of SRAM you could save up to 4 games.
It should be very easy to write a loop to copy the whole RAM to SRAM, as should be copying it back. The hardest part should be programming the menu interface to select those options. If you ave no idea on how to do this, you are out of luck because I doubt you are going to find a guide/tutorial for something as specific as this.
Writing a menu is like any other kind of NES programming. You have to draw the menu to the Name Tables, read the controllers and move a cursor around, and so on. Inputting names is the same thing, you ned to code your own interface, with all the letters and a cursor. This should be easy for anyone that has programmed anything serious (more complex than "Hello World") for the nes, I don't know exactly how much experience with it you have. But if you ask me, your necessity to build this interactive menu might be a great opportunity to learn some more NES programming.
All I have to do is make a separate title screen, And using SMBDIS, turn the menu into a Save Game Menu, Pretty simple, but can take time to figure out.
No more 2 player mode. 3 saves for Mario only unless otherwise noted, Game over must have a selection screen.
I figured out Graphics already, And Memblers gave me his NESLIB library for nametable uploads!
AKA SmilyMZX/AtariHacker.
I guess this is OK. Having your own title screen and menus is a good idea, but you have to find the appropriate entry points in the original game for starting a game and for continuing an old one.Hamtaro126 wrote:All I have to do is make a separate title screen, And using SMBDIS, turn the menu into a Save Game Menu, Pretty simple, but can take time to figure out.
This is good, because you can use the rest of the SRAM for names entered by players and checksums to validate the saves. You could probably use it for the menu variables too, so that you don't have to worry about overwriting them when restoring saves.3 saves
Sounds simple, just another menu. Once you have a menu system, making new ones should be easy.Game over must have a selection screen.
Will you make saving automatic or does the player get to decide when to save?
- neilbaldwin
- Posts: 481
- Joined: Tue Apr 28, 2009 4:12 am
- Contact:
- Hamtaro126
- Posts: 783
- Joined: Thu Jan 19, 2006 5:08 pm
I'd just go with only letting the players be named MARIO only, for nowtokumaru wrote:Sounds simple, just another menu. Once you have a menu system, making new ones should be easy.Game over must have a selection screen.
Will you make saving automatic or does the player get to decide when to save?
I'll let the player decide on continuing or just saving while quitting, And the game over screen is going to be like in Doki Doki Panic style:
GAME OVER
CONTINUE
SAVE & QUIT
AKA SmilyMZX/AtariHacker.
-
CKY-2K/Clay Man
- Posts: 214
- Joined: Sun Apr 01, 2007 2:10 pm
