From Bulbapedia, the community-driven Pokémon encyclopedia.
|| This article is incomplete.|
Please feel free to edit this article to add missing information and complete it.
|| This article does not yet meet the quality standards of Bulbapedia. Please feel free to edit this article to make it conform to Bulbapedia norms and conventions.
The save data structure for Generation I is stored in the cartridge's volatile battery-backed RAM chip (SRAM), or as a ".sav" file from most emulators. The structure consists of 32 KB of data, though not every byte is used. Emulators may append additional data for the purposes of maintaining real-time clock operations, despite the fact that Generation I games do not use any such functionality.
A region of the save data has its integrity validated via checksum. This region contains all of the information that directly pertains to the player and his or her Pokémon. Additional information pertinent to the save file is also present in the other regions of the data.
Unless otherwise noted, integer values occupy the specified number of bytes, and are big-endian and either unsigned or two's complement.
Text data is stored in a proprietary encoding. Fixed-length user-input strings are terminated with 0x50. If a fixed-length string is terminated before using its full capacity, the contents of the remaining space are not specified.
Lists of items in the save data follow a special format.
At minimum, a list is a count followed by a terminator.
|| Terminator (0xFF)
If a list has more than 0 items, however, count list entry structures will be located between the count and the terminator.
|| 2 * Count
| <0x01 + 2*Count>
|| Terminator (0xFF)
The Entry structure has the following format:
Index refers to the item's index number.
Count refers to the amount of the item that the player possesses and has valid values from 1 to 99.
Lists of Pokémon in the save data follow the same basic format, but there are two slightly different types of list that found in the save data. These two types differ in their maximum capacity and in the way they store the main Pokémon data. One type describes the player's party and has a capacity of 6 and uses the full Pokémon data structure (with a size of 44 bytes). The other type describes a PC Box and has a capacity of 20 and uses a truncated version of the Pokémon data structure (only the first 33 bytes).
| Party list
|| Box list
|| Entries used
|| Species list
|| Pokémon list
|| OT names
|| Pokémon names
- Entries used
This is the number of Pokémon entries actually being used in the list.
- Species list
This is a list of species indexes for each Pokémon in this list, 1 byte per index, with a
0xFF terminator following the last used entry in the list.
This list of species is used by the party screen and the PC's Box management interface.
- Pokémon list
This is a list of Pokémon data structures for each Pokémon in this list, 44 or 33 bytes per index depending on if the the whole list is for the party or a PC Box.
- OT names
This is a list of text strings for the Original Trainer of each Pokémon in this list, 11 bytes per name. Each name can contain from 1 to 10 characters, terminated by
- Pokémon names
This is a list of text strings for the name of each Pokémon in this list, 11 bytes per name. Each name can contain from 1 to 10 characters, terminated by
A Pokémon's name is a nickname if it does not perfectly match the default name for a Pokémon (typically all uppercase) with any unused bytes of the entry's 11-byte capacity filled with
Known data within the save file can be found at the following offsets within the data, such that offset 0 is the first byte of the emulator ".sav" file:
Note: These values apply to the North American Pokémon Red, Blue, and Yellow games. They could be different for other releases.
Player name, rival name
Represents text strings that can be from 1 to 7 characters in length.
Pokédex Owned, Pokédex Seen
Represents the specific Pokédex entries that have been either seen or owned during gameplay.
Pokémon are indexed by their usual Pokédex order, meaning the order is the same as in the National Pokédex. However, indexes begin counting at 0, rather than 1.
1 bit is used to represent whether a given Pokémon has been seen/owned. Bits are ordered within bytes from lowest to highest, starting with the first byte. Therefore, the exact bit can be extracted from the list using the following formula:
Bit = ( Data[ RoundDown(PokeNum / 8) ] / 2 ^ (PokeNum Mod 8) ) AND 1
Or in C-style code (shift occurs before other bitwise operations):
Bit = Data[PokeNum >> 3] >> (PokeNum & 7) & 1;
Let us say that we want to know whether #120 Staryu has been seen/owned:
- PokeNum becomes 119, since it is 0-based.
- The byte of the list in which bit 119 is located is = 119 / 8 = 14
- The bit within that byte is = 119 Mod 8 = 7
- Dividing the byte value by 2 ^ Bit, or shifting right by Bit, moves the bit to the least-significant position
- Performing a bitwise AND with 1 will remove all but the least-significant bit
As the bit lists are packed into 19 bytes, there is actually space for 152 entries. The last entry, bit 7 of byte 18, does in fact represent an entry #152 in the Pokédex. However, it is simply a copy of Kangaskhan.
Pocket item list
The items that the player has in his or her pocket inventory.
Stored as an Item list with a capacity of 20.
Represents how much money the character has. The figure is a 6-digit number, 2 digits per byte, encoded as binary-coded decimal, where each digit is allocated a full 4 bits.
This figure is still big-endian.
Represents how much coins the character has. The figure is a 4-digit number, 2 digits per byte, encoded as binary-coded decimal, where each digit is allocated a full 4 bits.
This figure is still big-endian.
Options are stored in one byte:
* bit 7 (MSB): battle effects ('1' for No, '0' for Yes)
* bit 6: battle style ('1' for Set, '0' for Switch)
* bit 4: sound ('0' for Mono, '1' for Stereo)
* bit 2-0: text speed ('001' for Fast, '011' for Normal, '101' for Slow)
In Pokémon Yellow:
* bit 5-4: sound ('00' for Mono, '01' for Earphone1, '10' for Earphone2, '11' for Earphone3)
Print options are stored somewhere else.
The eight badges are stored on eight bits, one bit for each badge, being '1' is the badge is acquired, '0' otherwise.
From MSB to LSB, badges are in this order: Boulder, Cascade, Thunder, Rainbow, Soul, Marsh, Volcano, Earth.
Represents the friendship level of the starter Pikachu. For Red and Blue, this value is fixed at zero.
PC Item list
The items that the player has stored in the PC.
Stored as an Item list with a capacity of 50.
Current PC Box
Indicates which PC box is currently selected, minus 1. That is to say, box 1 is represented as 0, and box 12 is represented as 11.
The highest bit of this value is not part of the box index. Its purpose is not yet known for certain, but it appears to be set when PC box data has been initialized.
The lowest 4 bits of this value are the box index.
Specifies how much time has elapsed during gameplay.
The first 2 bytes store the number of hours played in little-endian. The next 2 bytes store minutes and seconds in this order.
This timer is not halted when the game is paused, and also counts up on the main menu before selecting to continue a saved game.
Team Pokémon list
The Pokémon that the player has in his or her team.
Stored as a Pokemon list with a capacity of 6 and an entry size of 44 bytes.
PC Box Pokémon lists
The Pokémon that the player has stored in PC boxes.
This is stored as Pokemon lists with a capacity of 20 and an entry size of 33 bytes.
Normally, Pokémon are deposited and withdrawn from the Current Box list, which is within the checksum-validated region of the save data. When switching boxes, the data from the Current Box is copied to the corresponding PC Box data, then the data from the switched-to PC Box is transferred into the Current Box data.
Used to validate the integrity of saved data.
The checksum in Generation I is only 8 bits, and there is only one copy of the data protected by it. If this value is incorrect, the player will be forced to start a new game.
The algorithm used to calculate the checksum is as follows:
- Initialize the checksum to 0
- For every byte from 0x2598 to 0x3522, inclusive, add its value to the checksum
- Invert the bits of the result
An equivalent way to achieve the same result is:
- Initialize the checksum to 255
- For every byte from 0x2598 to 0x3522, inclusive, subtract its value from the checksum
The checksum neatly validates all of the data starting at player name through the end of Current Box Pokémon list.