Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
1 user currently in Super Mario World hacking: labmaster | 3 guests
Acmlm's Board - I2 Archive - Super Mario World hacking - SRAM Read/Write [ASM]
  
User name:
Password:
Reply:
 

UserPost
BMF98567
Posts: 79/1261
SMW's SRAM is 2KB in size, and the space from $70035A to $7007FF (the end of the file) is unused, filled with #$FF.
MathOnNapkins
Posts: 19/2189
Or what you could do is use a hex editor to search for indexed and non indexed reads from SRAM.

For instance, you could search for AF 00 00 70 or BF 00 00 70, which would be looking for LDA $700000 or LDA $700000, X. You could also change AF and BF to 8F and 9F, respectively for STA. Or use any other opcodes with those addressing modes, such as CMP, which would be CF or DF.

This is of course not fool proof, but it might help in checking whether an address is filler or not. You'll need to study the ASM routines they fall in though to make sure.
HyperLamer
Posts: 214/8210
SMW uses $55 in RAM, haven't looked at SRAM. (I thought that was just a hardware abnormality.) Course you could just beat everything on all 3 save slots (cheat ) and look, or trace the ASM.
MathOnNapkins
Posts: 13/2189
Originally posted by w00t

I thought it used #55 as a filler, but I could be wrong...


That could be true for SMW, but I generally don't hack that game. (In spite of being on that board right now ) LTTP and Super Metroid I'm positive both use #60 as filler towards the ends of the file.
w00t
Posts: 1/3
Originally posted by MathOnNapkins
Some games, particularly those by Nintendo, use repeated #60's as filler for unused space.


I thought it used #55 as a filler, but I could be wrong...
Smallhacker
Posts: 67/2273
Woah! Thank you!
MathOnNapkins
Posts: 10/2189
Can anyone tell me how to read from/write to the SRAM with ASM?

You write to SRAM using bank $70.

So for example, you wanted to write the hex value #57FF to $701000, you'd write:

REP #20
LDA #57FF
STA $701000

Or in hex:

C2 20 A9 FF 57 8F 00 10 70

The other possibility is to change your data bank to $70 via PLB.

Also, what parts of the SRAM are unused?

How much SRAM there is to work with depends on how much came with the game cart itself. There is information in the cart that probably says how much of this battery back up memory there is. Typically SRAM can be 2, 4, or 8kilobits. (maybe Kilobytes, I can't remember) Some games in an emulator (Snes9x), such as Starfox, will claim to have a 64 kB SRAM file, when they obviously don't.)

Finding unused space is trickier, because it requires you to be very careful. Sometimes space that looks empty may be used later in the game. So just be careful. Some games, particularly those by Nintendo, use repeated #60's as filler for unused space. Just open up a random save file from the game you're interested in and see if anything stands out as useless.

Update: Now that I think about it, there may be a way to expand the SRAM size if you need more. Let me look into that in over the next few days.
Smallhacker
Posts: 65/2273
Can anyone tell me how to read from/write to the SRAM with ASM?
Also, what parts of the SRAM are unused?
Acmlm's Board - I2 Archive - Super Mario World hacking - SRAM Read/Write [ASM]


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.020 seconds.