The current URL is datacrystal.tcrf.net.
Mother 3/SRAM map: Difference between revisions
Lelegofrog (talk | contribs) mNo edit summary |
|||
(29 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
{{srammap|game=Mother 3}} | |||
A MOTHER 3 save file contains data for two file slots. This page will follow the convention of using $ as a prefix for addresses, and 0x as a prefix for values. | |||
==Overview== | ==Overview== | ||
MOTHER 3 uses 512 kilobits (64 KB) of flash memory for storing save data, instead of actual "SRAM" like some other GBA games. This flash memory is divided into 16 banks of 0x1000 bytes each. All banks that are in use begin with the 4-byte header | |||
02 00 4D 33 | 02 00 4D 33 | ||
Line 45: | Line 47: | ||
==Bank 1 (01000-01FFF)== | ==Bank 1 (01000-01FFF)== | ||
Mirror of bank 0. | |||
==Banks 2 and 3 (02000-03FFF)== | ==Banks 2 and 3 (02000-03FFF)== | ||
Unclassified; most likely unused, as | Unclassified; most likely unused, as they are filled with 0xFF, and are missing the standard header and checksum. | ||
==Bank 4 (04000-04FFF)== | ==Bank 4 (04000-04FFF)== | ||
This bank contains the slot 1 data. It is mirrored at bank 7. | This bank contains the slot 1 data. It is mirrored at bank 7. | ||
* <tt>04000-04003 (004)</tt> = Standard header | * <tt>04000-04003 (004)</tt> = [[#Overview|Standard header]] | ||
* <tt>04004-04005 (002)</tt> = Checksum complement | * <tt>04004-04005 (002)</tt> = [[#Checksums|Checksum complement]] | ||
* <tt>04006-04007 (002)</tt> = ''Unclassified data'' | * <tt>04006-04007 (002)</tt> = ''Unclassified data'' | ||
* <tt>04008-0400B (004)</tt> = Current party. Mirrored at $00016 in bank 0 | * <tt>04008-0400B (004)</tt> = Current party. Mirrored at $00016 in bank 0 | ||
* <tt>0400C-0400F (004)</tt> = ''Unclassified data'' | * <tt>0400C-0400F (004)</tt> = ''Unclassified data'' | ||
* <tt>04010-04013 (004)</tt> = Money on hand | * <tt>04010-04013 (004)</tt> = Money on hand | ||
* <tt>04014-04017 (004)</tt> = Money in bank | * <tt>04014-04017 (004)</tt> = Money in bank | ||
* <tt>04018-04117 (100)</tt> = Key item flags | * <tt>04018-04117 (100)</tt> = [[#Key item flags|Key item flags]] | ||
* <tt>04752-04771 (020)</tt> = Enemy-seen flags (front) | * <tt>04118-04217 (100)</tt> = [[#Item Guy's inventory|Item Guy's inventory]] | ||
* <tt>04772-04791 (020)</tt> = Enemy-seen flags (back) | * <tt>04218-0421B (004)</tt> = [[#Play time|Play time]] | ||
* <tt>0421C-04247 (02C)</tt> = ''Unclassified data'' | |||
* <tt>04248-04347 (100)</tt> = Event flags | |||
* <tt>04348-04407 (0C0)</tt> = ''Unclassified data'' | |||
* <tt>04408-04487 (080)</tt> = Giftbox flags | |||
* <tt>04488-04689 (202)</tt> = ''Unclassified data'' | |||
* <tt>0468A-04699 (010)</tt> = Hinawa's name | |||
* <tt>0469A-046A9 (010)</tt> = Claus' name | |||
* <tt>046AA-046BB (012)</tt> = Favorite food | |||
* <tt>046BC-046CD (012)</tt> = Favorite thing | |||
* <tt>046CE-046DF (012)</tt> = Player's name (short) | |||
* <tt>046E0-046FF (020)</tt> = Player's name (long) | |||
* <tt>04700-04727 (028)</tt> = ''Unclassified data'' | |||
* <tt>04728-0472F (008)</tt> = [[#PSI flags|Lucas PSI flags]] | |||
* <tt>04730-04741 (012)</tt> = ''Unclassified data'' | |||
* <tt>04742-04749 (008)</tt> = [[#PSI flags|Kumatora PSI flags]] | |||
* <tt>0474A-04751 (008)</tt> = ''Unclassified data'' | |||
* <tt>04752-04771 (020)</tt> = [[#Enemy-seen flags|Enemy-seen flags (front)]] | |||
* <tt>04772-04791 (020)</tt> = [[#Enemy-seen flags|Enemy-seen flags (back)]] | |||
* <tt>04792-04833 (0A2)</tt> = ''Unclassified data'' | |||
* <tt>04834-0489F (06C)</tt> = [[#Character data|Empty character data]] | |||
* <tt>048A0-0490B (06C)</tt> = [[#Character data|Flint's character data]] | |||
* <tt>0490C-04977 (06C)</tt> = [[#Character data|Lucas's character data]] | |||
* <tt>04978-049E3 (06C)</tt> = [[#Character data|Duster's character data]] | |||
* <tt>049E4-04A4F (06C)</tt> = [[#Character data|Kumatora's character data]] | |||
* <tt>04A50-04ABB (06C)</tt> = [[#Character data|Boney's character data]] | |||
* <tt>04ABC-04B27 (06C)</tt> = [[#Character data|Salsa's character data]] | |||
* <tt>04B28-04B93 (06C)</tt> = [[#Character data|Wess' character data]] | |||
* <tt>04B94-04BFF (06C)</tt> = [[#Character data|Thomas' character data]] | |||
* <tt>04C00-04C6B (06C)</tt> = [[#Character data|Ionia's character data]] | |||
* <tt>04C6C-04CD7 (06C)</tt> = [[#Character data|Fuel's character data]] | |||
* <tt>04CD8-04D43 (06C)</tt> = [[#Character data|Alex's character data]] | |||
* <tt>04D44-04DAF (06C)</tt> = [[#Character data|Fassad's character data]] | |||
* <tt>04DB0-04E1B (06C)</tt> = [[#Character data|Claus' character data]] | |||
* <tt>04E1C-04FFF (1E4)</tt> = ''Unclassified data'' | |||
===Key item flags=== | ===Key item flags=== | ||
From $04018 to $04117, there are one-byte item flags corresponding to the player's key items. A value of zero means the player doesn't have the item; non-zero means they do have it. The exact values that these flags can hold is unknown; however, the game does seem to cap them at 99, so it's possible that | From $04018 to $04117, there are one-byte item flags corresponding to the player's key items. A value of zero means the player doesn't have the item; non-zero means they do have it. The exact values that these flags can hold is unknown; however, the game does seem to cap them at 99, so it's possible that it indicates how many of that item are being held. | ||
Most of the values in this range do not correspond to key items and have no effect. Only items with an item type of 8 are considered. | Most of the values in this range do not correspond to key items and have no effect. Only items with an item type of 8 are considered. | ||
These values follow the standard | These values follow the standard internal [[Mother 3/Item names|item order]]. | ||
===Item Guy's inventory=== | |||
Item Guy is like an item bank. There are 256 bytes here, one for each item, again following the standard internal [[Mother 3/Item names|item order]]. Each byte represents the quantity of that item being carried by Item Guy. | |||
===Play time=== | |||
The play time is stored in ticks. Each tick is 1/60th of a second; hence, where we use integer division instead of real division, | |||
* Hours = total ticks / 216000 | |||
* Minutes = (total ticks / 3600) % 60 | |||
* Seconds = (total ticks / 60) % 60 | |||
* Tick remainder = total ticks % 60 | |||
===PSI flags=== | |||
Lucas and Kumatora each have 64 PSI flags, stored at $04728 and $04742, respectively. Each flag is one bit: 1 means the PSI has been learned, and 0 means it hasn't. It follows the game's internal [[Mother 3/PSI names|PSI order]]. | |||
It is important to note that the game '''will crash''' if more than 36 flags are set for either character, despite there being space for 64 flags. | |||
===Enemy-seen flags=== | ===Enemy-seen flags=== | ||
Whenever you encounter an enemy and see its front-side in-battle, the game sets a flag in the $04752 area. Likewise, if you see the enemy's back, it sets a flag in the $04772 area. There is one bit per enemy, and the in-game enemy ordering is used. These flags are used when accessing the Battle Memory item. | Whenever you encounter an enemy and see its front-side in-battle, the game sets a flag in the $04752 area. Likewise, if you see the enemy's back, it sets a flag in the $04772 area. There is one bit per enemy, and the in-game [[Mother 3/Enemy names|enemy ordering]] is used. These flags are used when accessing the Battle Memory item. | ||
===Character data=== | |||
Each block of character data uses 0x6C bytes and is mapped below. | |||
* <tt>00-00 (01)</tt> = Character number (follows the game's internal [[Mother 3/Party character names|party character naming order]]) | |||
* <tt>01-01 (01)</tt> = Sprite number (follows the game's internal [[Mother 3/Character names|sprite listing]]) | |||
* <tt>02-11 (10)</tt> = Name | |||
* <tt>12-12 (01)</tt> = Level | |||
* <tt>13-13 (01)</tt> = ''Unused'' | |||
* <tt>14-17 (04)</tt> = Experience | |||
* <tt>18-1B (04)</tt> = Current HP | |||
* <tt>1C-1D (02)</tt> = Current PP | |||
* <tt>1E-1F (02)</tt> = ''Unclassified data'' | |||
* <tt>20-23 (04)</tt> = Maximum HP | |||
* <tt>24-25 (02)</tt> = Maximum PP | |||
* <tt>26-27 (02)</tt> = ''Unclassified data'' | |||
* <tt>28-28 (01)</tt> = Offense | |||
* <tt>29-29 (01)</tt> = Defense | |||
* <tt>2A-2A (01)</tt> = IQ | |||
* <tt>2B-2B (01)</tt> = Speed | |||
* <tt>2C-2F (04)</tt> = ''Unclassified data'' | |||
* <tt>30-30 (01)</tt> = Status ailments | |||
* <tt>31-33 (03)</tt> = ''Unclassified data'' | |||
* <tt>34-34 (01)</tt> = Weapon (equipped) | |||
* <tt>35-35 (01)</tt> = Body (equipped) | |||
* <tt>36-36 (01)</tt> = Head (equipped) | |||
* <tt>37-37 (01)</tt> = Other (equipped) | |||
* <tt>38-3B (04)</tt> = Position in inventory of equipped items (bitfield) | |||
* <tt>3C-4B (10)</tt> = Inventory | |||
* <tt>4C-6B (20)</tt> = 16-bit Item timers (Fresh Egg and Fresh Milk, for example) or not-cleaned data from menus | |||
==Bank 5 (05000-05FFF)== | |||
Unclassified. | |||
==Bank 6 (06000-06FFF)== | |||
Unclassified. Contains some palette data starting at $06208. | |||
==Bank 7 (07000-07FFF)== | |||
Mirror of bank 4. | |||
==Bank 8 (08000-08FFF)== | |||
Mirror of bank 5. | |||
==Bank 9 (09000-09FFF)== | |||
Mirror of bank 6. | |||
==Bank 10 (0A000-0AFFF)== | |||
This bank contains the slot 2 data. It is mirrored at bank 13. It follows the exact same mapping as bank 4; just replace the $04xxx address prefix with $0Axxx. | |||
==Bank 11 (0B000-0BFFF)== | |||
Unclassified. Like bank 5, but not a mirror of it. | |||
==Bank 12 (0C000-0CFFF)== | |||
Unclassified. Like bank 6, but not a mirror of it. | |||
==Bank 13 (0D000-0DFFF)== | |||
Mirror of bank 10. | |||
==Bank 14 (0E000-0EFFF)== | |||
Mirror of bank 11. | |||
==Bank 15 (0F000-0FFFF)== | |||
Mirror of bank 12. | |||
[[Category:Mother 3|SRAM map]] |
Latest revision as of 04:37, 20 May 2024
A MOTHER 3 save file contains data for two file slots. This page will follow the convention of using $ as a prefix for addresses, and 0x as a prefix for values.
Overview
MOTHER 3 uses 512 kilobits (64 KB) of flash memory for storing save data, instead of actual "SRAM" like some other GBA games. This flash memory is divided into 16 banks of 0x1000 bytes each. All banks that are in use begin with the 4-byte header
02 00 4D 33
This is convenient, since we can seed the checksum with a value of 0x334F and begin summing at the spot after the checksum, rather than having to manually skip over the checksum bytes.
Checksums
Each bank that's in use has a 16-bit checksum complement at the 4th and 5th byte. There's an exception for bank 0: this checksum is located at $000F0 instead, and it only takes into account the data stored from $00000 to $000EF.
The checksum is calculated by summing each 16-bit value in the bank (not including the checksum itself), and the complementing it with 0xFFFF. For example, if the bank started with the bytes
02 00 4D 33 xx xx 91 B7 3F 02 7C 0C ...
Then the checksum would start off by summing
0002 + 334D + B791 + 023F + 0C7C + ...
If any checksum is incorrect, the game will delete the entire save data.
Bank 0 (00000-00FFF)
This bank contains some general overhead data. It is mirrored at bank 1.
- 00000-00003 (004) = Standard header
- 00004-00015 (012) = Unclassified data
- 00016-00019 (004) = Slot 1 current party. Must be in sync with the party bytes at $04008 in bank 4.
- 0001A-00067 (04E) = Unclassified data
- 00068-00068 (001) = Slot 1 flag. Zero if there is no save file in slot 1, non-zero otherwise
- 00069-00079 (011) = Unclassified data
- 0007A-0007D (004) = Slot 2 current party. Must be in sync with the party bytes at $0A008 in bank 10.
- 0007E-000CB (04E) = Unclassified data
- 000CC-000CC (001) = Slot 2 flag. Zero if there is no save file in slot 2, non-zero otherwise
- 000CD-000CF (003) = Unclassified data
- 000D0-000D7 (008) = "mother3 " in ASCII
- 000D8-000EF (018) = Unclassified data
- 000F0-000F1 (002) = Checksum complement
- 000F2-00FFF (F0E) = Unused
Bank 1 (01000-01FFF)
Mirror of bank 0.
Banks 2 and 3 (02000-03FFF)
Unclassified; most likely unused, as they are filled with 0xFF, and are missing the standard header and checksum.
Bank 4 (04000-04FFF)
This bank contains the slot 1 data. It is mirrored at bank 7.
- 04000-04003 (004) = Standard header
- 04004-04005 (002) = Checksum complement
- 04006-04007 (002) = Unclassified data
- 04008-0400B (004) = Current party. Mirrored at $00016 in bank 0
- 0400C-0400F (004) = Unclassified data
- 04010-04013 (004) = Money on hand
- 04014-04017 (004) = Money in bank
- 04018-04117 (100) = Key item flags
- 04118-04217 (100) = Item Guy's inventory
- 04218-0421B (004) = Play time
- 0421C-04247 (02C) = Unclassified data
- 04248-04347 (100) = Event flags
- 04348-04407 (0C0) = Unclassified data
- 04408-04487 (080) = Giftbox flags
- 04488-04689 (202) = Unclassified data
- 0468A-04699 (010) = Hinawa's name
- 0469A-046A9 (010) = Claus' name
- 046AA-046BB (012) = Favorite food
- 046BC-046CD (012) = Favorite thing
- 046CE-046DF (012) = Player's name (short)
- 046E0-046FF (020) = Player's name (long)
- 04700-04727 (028) = Unclassified data
- 04728-0472F (008) = Lucas PSI flags
- 04730-04741 (012) = Unclassified data
- 04742-04749 (008) = Kumatora PSI flags
- 0474A-04751 (008) = Unclassified data
- 04752-04771 (020) = Enemy-seen flags (front)
- 04772-04791 (020) = Enemy-seen flags (back)
- 04792-04833 (0A2) = Unclassified data
- 04834-0489F (06C) = Empty character data
- 048A0-0490B (06C) = Flint's character data
- 0490C-04977 (06C) = Lucas's character data
- 04978-049E3 (06C) = Duster's character data
- 049E4-04A4F (06C) = Kumatora's character data
- 04A50-04ABB (06C) = Boney's character data
- 04ABC-04B27 (06C) = Salsa's character data
- 04B28-04B93 (06C) = Wess' character data
- 04B94-04BFF (06C) = Thomas' character data
- 04C00-04C6B (06C) = Ionia's character data
- 04C6C-04CD7 (06C) = Fuel's character data
- 04CD8-04D43 (06C) = Alex's character data
- 04D44-04DAF (06C) = Fassad's character data
- 04DB0-04E1B (06C) = Claus' character data
- 04E1C-04FFF (1E4) = Unclassified data
Key item flags
From $04018 to $04117, there are one-byte item flags corresponding to the player's key items. A value of zero means the player doesn't have the item; non-zero means they do have it. The exact values that these flags can hold is unknown; however, the game does seem to cap them at 99, so it's possible that it indicates how many of that item are being held.
Most of the values in this range do not correspond to key items and have no effect. Only items with an item type of 8 are considered.
These values follow the standard internal item order.
Item Guy's inventory
Item Guy is like an item bank. There are 256 bytes here, one for each item, again following the standard internal item order. Each byte represents the quantity of that item being carried by Item Guy.
Play time
The play time is stored in ticks. Each tick is 1/60th of a second; hence, where we use integer division instead of real division,
- Hours = total ticks / 216000
- Minutes = (total ticks / 3600) % 60
- Seconds = (total ticks / 60) % 60
- Tick remainder = total ticks % 60
PSI flags
Lucas and Kumatora each have 64 PSI flags, stored at $04728 and $04742, respectively. Each flag is one bit: 1 means the PSI has been learned, and 0 means it hasn't. It follows the game's internal PSI order.
It is important to note that the game will crash if more than 36 flags are set for either character, despite there being space for 64 flags.
Enemy-seen flags
Whenever you encounter an enemy and see its front-side in-battle, the game sets a flag in the $04752 area. Likewise, if you see the enemy's back, it sets a flag in the $04772 area. There is one bit per enemy, and the in-game enemy ordering is used. These flags are used when accessing the Battle Memory item.
Character data
Each block of character data uses 0x6C bytes and is mapped below.
- 00-00 (01) = Character number (follows the game's internal party character naming order)
- 01-01 (01) = Sprite number (follows the game's internal sprite listing)
- 02-11 (10) = Name
- 12-12 (01) = Level
- 13-13 (01) = Unused
- 14-17 (04) = Experience
- 18-1B (04) = Current HP
- 1C-1D (02) = Current PP
- 1E-1F (02) = Unclassified data
- 20-23 (04) = Maximum HP
- 24-25 (02) = Maximum PP
- 26-27 (02) = Unclassified data
- 28-28 (01) = Offense
- 29-29 (01) = Defense
- 2A-2A (01) = IQ
- 2B-2B (01) = Speed
- 2C-2F (04) = Unclassified data
- 30-30 (01) = Status ailments
- 31-33 (03) = Unclassified data
- 34-34 (01) = Weapon (equipped)
- 35-35 (01) = Body (equipped)
- 36-36 (01) = Head (equipped)
- 37-37 (01) = Other (equipped)
- 38-3B (04) = Position in inventory of equipped items (bitfield)
- 3C-4B (10) = Inventory
- 4C-6B (20) = 16-bit Item timers (Fresh Egg and Fresh Milk, for example) or not-cleaned data from menus
Bank 5 (05000-05FFF)
Unclassified.
Bank 6 (06000-06FFF)
Unclassified. Contains some palette data starting at $06208.
Bank 7 (07000-07FFF)
Mirror of bank 4.
Bank 8 (08000-08FFF)
Mirror of bank 5.
Bank 9 (09000-09FFF)
Mirror of bank 6.
Bank 10 (0A000-0AFFF)
This bank contains the slot 2 data. It is mirrored at bank 13. It follows the exact same mapping as bank 4; just replace the $04xxx address prefix with $0Axxx.
Bank 11 (0B000-0BFFF)
Unclassified. Like bank 5, but not a mirror of it.
Bank 12 (0C000-0CFFF)
Unclassified. Like bank 6, but not a mirror of it.
Bank 13 (0D000-0DFFF)
Mirror of bank 10.
Bank 14 (0E000-0EFFF)
Mirror of bank 11.
Bank 15 (0F000-0FFFF)
Mirror of bank 12.