Save data structure (Generation II): Difference between revisions

Line 10: Line 10:
Unless otherwise noted, integer values occupy the specified number of bytes, and are {{wp|Endianness|big-endian}} and either unsigned or {{wp|two's complement}}.
Unless otherwise noted, integer values occupy the specified number of bytes, and are {{wp|Endianness|big-endian}} and either unsigned or {{wp|two's complement}}.


==Text data==
Text data is stored in a [[Character encoding in Generation II|proprietary encoding]].
Technically, all characters before 0x60 function as control characters. An asterisk (*) denotes a character that is explained in the control characters section below.
 
===English===
Only a few control characters below 0x50 are actually used in the English games, all of which are ones marked below with an asterisk (for more, see the control characters section further down where they are explained). The sub-0x50 characters that are not marked with an asterisk are artifacts of the Japanese control characters that print other characters with a diacritic.
:{| style="text-align: center; border-collapse: collapse" cellpadding="2px" width="375px"
|-
! || -0 || -1 || -2 || -3 || -4 || -5 || -6 || -7 || -8 || -9 || -A || -B || -C || -D || -E || -F
|-
! 0-
|? || B || C || D || E || F || G || H || I || J || K || L || M || N || O || P
|-
! 1-
| Q || R || S || T || * || * || * || X || Y || Z || ( || ) ||: ||; || [ || *
|-
! 2-
| q || r || * || * || * || * || w || x || y || z ||   ||   ||   ||   ||   ||  
|-
! 3-
| Ä || Ö || Ü || ä || ö || * || * || * || * || * ||   ||   ||   ||   ||   || *
|-
! 4-
| Z || ( || ) || ":" ||   ||   ||   ||   ||   || * || * || * || * || 'r || * || *
|-
! 5-
| * || * || * || * || * || * || * || * || * || * || * || * || * || * || * || *
|-
! 6-
| style="background: #000" | || ▲ || [[File:Character 0x62 ii.png|16px]] || D || E || F || G || H || I || V || S || L || M ||: || ぃ || ぅ
|-
! 7-
| <sup>P</sup><sub>O</sub> || <sup>K</sup><sub>é</sub> || “ || ” || ・ || … || ぁ || ぇ || ぉ || colspan=6 | ''text box borders'' || &nbsp;
|-
! 8-
| A || B || C || D || E || F || G || H || I || J || K || L || M || N || O || P
|-
! 9-
| Q || R || S || T || U || V || W || X || Y || Z || ( || ) ||: ||; || [ || ]
|-
! A-
| a || b || c || d || e || f || g || h || i || j || k || l || m || n || o || p
|-
! B-
| q || r || s || t || u || v || w || x || y || z || &nbsp; || &nbsp; || &nbsp; || &nbsp; || &nbsp; || &nbsp;
|-
! C-
| &Auml;
| &Ouml;
| &Uuml;
| &auml;
| &ouml;
| &uuml;
| &nbsp; || &nbsp; || &nbsp; || &nbsp; || &nbsp; || &nbsp; || &nbsp; || &nbsp; || &nbsp; || &nbsp;
|-
! D-
| 'd || 'l || 'm || 'r || 's || 't || 'v || &nbsp; || &nbsp; || &nbsp; || &nbsp; || &nbsp; || &nbsp; || &nbsp; || &nbsp; || &larr;
|-
! E-
| ' || <sup>P</sup><sub>K</sub> || <sup>M</sup><sub>N</sub> || - || &nbsp; || &nbsp; ||? ||! || . || & || é || &rarr; || ▷ || ▶ || ▼ || ♂
|-
! F-
| {{PDollar}} || × || . || / || , || ♀ || 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9
|}
 
===Japanese===
:{| style="text-align: center; border-collapse: collapse" cellpadding="2px" width="375px"
|-
! || -0 || -1 || -2 || -3 || -4 || -5 || -6 || -7 || -8 || -9 || -A || -B || -C || -D || -E || -F
|-
! 0-
|? || イ゛ || ヴ || エ゛ || オ゛ || ガ || ギ || グ || ゲ || ゴ || ザ || ジ || ズ || ゼ || ゾ || ダ
|-
! 1-
| ヂ || ヅ || デ || ド || * || * || * || ネ゛ || ノ゛ || バ || ビ || ブ || ボ || * || * || *
|-
! 2-
| ィ゛ || あ゛ || * || * || * || * || が || ぎ || ぐ || げ || ご || ざ || じ || ず || ぜ || ぞ
|-
! 3-
| だ || ぢ || づ || で || ど || * || * || * || * || * || ば || び || ぶ || べ || ぼ || *
|-
! 4-
| パ || ピ || プ || ポ || ぱ || ぴ || ぷ || ぺ || ぽ || * || * || * || * || も゜ || * || *
|-
! 5-
| * || * || * || * || * || * || * || * || * || * || * || * || * || * || * || *
|-
! 6-
| style="background: #000" | || ▲ || [[File:Character 0x62 ii.png|16px]] || D || E || F || G || H || I || V || S || L || M ||: || ぃ || ぅ
|-
! 7-
| 「 || 」 || 『 || 』 || ・ || ・・・ || ぁ || ぇ || ぉ || colspan=6 | ''text box borders'' || &nbsp;
|-
! 8-
| ア || イ || ウ || エ || オ || カ || キ || ク || ケ || コ || サ || シ || ス || セ || ソ || タ
|-
! 9-
| チ || ツ || テ || ト || ナ || ニ || ヌ || ネ || ノ || ハ || ヒ || フ || ホ || マ || ミ || ム
|-
! A-
| メ || モ || ヤ || ユ || ヨ || ラ || ル || レ || ロ || ワ || ヲ || ン || ッ || ャ || ュ || ョ
|-
! B-
| ィ || あ || い || う || え || お || か || き || く || け || こ || さ || し || す || せ || そ
|-
! C-
| た || ち || つ || て || と || な || に || ぬ || ね || の || は || ひ || ふ || へ || ほ || ま
|-
! D-
| み || む || め || も || や || ゆ || よ || ら || り || る || れ || ろ || わ || を || ん || っ
|-
! E-
| ゃ || ゅ || ょ || ー || ゜ || ゛ ||? ||! || 。 || ァ || ゥ || ェ || ▷ || ▶ || ▼ || ♂
|-
! F-
| 円 || × || . || / || ォ || ♀ || 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9
|}
 
===Control characters===
{{incomplete|section|Any alternate defaults or functions in Gold and Silver or in other languages}}
The characters on a gray background below are not naturally used in the games.
 
{| border=1 style="border: 1px solid #000; border-collapse: collapse"
|- style="background: #ccf;"
! Character || Japanese || English
|-
| 0x14 || colspan=2 | Prints the player's name, including a gendered honorific in Japanese (adds <code>くん</code> for male, <code>ちゃん</code> for female).
|- style="background: #ddd"
| 0x15 || ''Nothing.'' || May break.
|- style="background: #ddd"
| 0x16 || ''Nothing.'' || May break.
|-
| 0x1D || Prints <code>に </code>. || style="background: #ddd" | Prints <code>;</code>.
|-
| 0x1E || Prints <code>って</code>. || style="background: #ddd" | Prints <code>[</code>.
|-
| 0x1F || Prints <code>を </code>. || style="background: #ddd" | Prints <code>&nbsp;</code>.
|-
| 0x22 || Prints <code>た!</code>. || style="background: #ddd" | A "half" line break (moves the print position to the place one tile below the start of the current line).
|-
| 0x23 || Prints <code>こうげき</code>. || style="background: #ddd" | ''Prints <code> tzx</code>, but this appears to be junk data.''
|-
| 0x24 || Prints <code>は </code>. || Prints <code><sup>P</sup><sub>O</sub><sup>K</sup><sub>é</sub></code>.
|-
| 0x25 || Prints <code>の </code>. || style="background: #ddd" | ''Nothing.''
|-
| 0x35 || Prints <code>ばん どうろ</code>. || style="background: #ddd" | ''Nothing.''
|-
| 0x36 || Prints <code>わたし</code>. || style="background: #ddd" | ''Nothing.''
|-
| 0x37 || Prints <code>ここは </code>. || style="background: #ddd" | ''Nothing.''
|- style="background: #ddd"
| 0x38 || Prints <code>レッド</code>. || Prints <code>RED</code>.
|- style="background: #ddd"
| 0x39 || Prints <code>グリーン</code>. || Prints <code>GREEN</code>.
|-
| 0x3F || colspan=2 | Prints the opposing Trainer's name (including their Trainer class). ''(Outside of battle, this may not terminate properly.)''
|- style="background: #ddd"
| 0x49 || Prints <code>おかあさん</code>. || Prints <code>MOM</code>.
|-
| 0x4A || Prints <code>が </code>. || Prints <code><sup>P</sup><sub>K</sub><sup>M</sup><sub>N</sub></code>.
|-
| 0x4B || colspan=2 style="background: #ddd" | Appears to be the same as 0x55
|-
| 0x4C || colspan=2 style="background: #ddd" | Appears to be the same as 0x55 except without any prompt or pause (immediately shifting the dialogue box's lines upwards)
|-
| 0x4E || colspan=2 | Line break (moves the print position to the space two tiles below the start of the current line (as defined by explicit placements of the print position); mostly used in move descriptions and Pokédex entries).
|-
| 0x4F || colspan=2 | Dialogue line break (moves the print position to the expected start of the second line in a standard dialogue box).
|-
| 0x50 || colspan=2 | String terminator.
|-
| 0x51 || colspan=2 | Prompts the player to press a button, after which the text window is cleared to make way for the following text.
|-
| 0x52 || colspan=2 | Prints the player's name without an honorific.
|-
| 0x53 || colspan=2 | Prints the rival's name.
|-
| 0x54 || Prints <code>ポケモン</code>. || Prints <code>POKé</code>.
|-
| 0x55 || colspan=2 | Prompts the player to press a button, after which the top line of the text window is replaced by the bottom, the bottom line is cleared, and the print position moves to the start of the bottom line.
|-
| 0x56 || colspan=2 | Prints <code>......</code> (in the middle of the line in Japanese).
|-
| 0x57 || colspan=2 | Marks the end of dialogue, without a visual prompt to the player.
|-
| 0x58 || colspan=2 | Marks the end of dialogue, with a visual prompt to the player.
|-
| 0x59 || colspan=2 | Prints the inactive{{tt|*|In specific circumstances<!--E.g., Rage-->, the game may 'pretend' that the inactive Pokémon is actually active and vice versa.}} Pokémon's name in battle. ''(Outside of battle, this may not terminate properly.)''
|-
| 0x5A || colspan=2 | Prints the active{{tt|*|In specific circumstances, the game may 'pretend' that the active Pokémon is actually inactive and vice versa.}} Pokémon's name in battle.
|-
| 0x5B || Prints <code>パソコン</code>. || Prints <code>PC</code>.
|-
| 0x5C || Prints <code>わざマシン</code>. || Prints <code>TM</code>.
|-
| 0x5D || Prints <code>トレーナー</code>. || Prints <code>TRAINER</code>.
|-
| 0x5E || Prints <code>ロケットだん</code> || Prints <code>ROCKET</code>.
|-
| 0x5F || colspan=2 | Prints a period (0xE8) and simultaneously functions as a string terminator. ''(Only used in Japanese Pokédex entries.)''
|}


==Item lists==
==Item lists==