Save data structure (Generation I): Difference between revisions

(Terrible table for Pokemon lists... Since there's only two options, let's just list them both explicitly)
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 I|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.
Text data for Generation I is stored in proprietary encodings. These encodings are shown below.
 
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.
 
Note that 0x7F is a space (" "), not empty. All characters that are not control characters print in one character.
 
In some contexts, some characters may display differently than suggested below. For example, in the character input table, <sup>E</sup><sub>D</sub> is 0xF0, and in the Pokédex (in English), the feet (') and inches (") marks are 0x60 and 0x61.
 
===English===
Those bytes with a dark gray background are not used in the English games and may contain junk data that may cause unexpected behavior. Characters with a light gray background are holdovers from the Japanese game that still print but that are not used in the English game.
:{| 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-
| <small>NULL</small> || colspan=15 style="background: #bbb" |
|-
! 1-
| colspan=16 rowspan=3 style="background: #bbb" | ''Junk''
|-
! 2-
|-
! 3-
|-
! 4-
| colspan=8 style="background: #bbb" | || colspan=8 | ''Control characters''
|-
! 5-
| colspan=16 | ''Control characters''
|- style="background: #ddd"
! style="background: #fff" | 6-
| A || B || C || D || E || F || G || H || I || V || S || L || M || style="background: #fff" | : || ぃ || ぅ
|- style="background: #ddd"
! style="background: #fff" | 7-
| ‘ || ’ || “ || ” || ・ || … || ぁ || ぇ || ぉ || [[File:Character 0x79 i.png]] || = || [[File:Character 0x7B i.png]] || <nowiki>||</nowiki> || [[File:Character 0x7D i.png]] || [[File:Character 0x7E i.png]] || style="background: #fff" | 
|-
! 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  || é || 'd || 'l || 's || 't || 'v
|-
! C-
| colspan=16 rowspan=2 style="background: #bbb" | ''Junk''
|-
! D-
|-
! E-
| ' || <sup>P</sup><sub>K</sub> || <sup>M</sup><sub>N</sub> || -  || 'r || 'm || ? || ! || .  || style="background: #ddd" | ァ || style="background: #ddd" | ゥ || style="background: #ddd" | ェ || ▷ || ▶ || ▼ || ♂
|-
! F-
| {{PDollar}} || ×  || . || / || ,  || ♀ || 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9
|}
 
In the Japanese games (as can be seen below), 0xF2 is distinguishable from 0xE8, with the former meant as a decimal point while the latter is punctuation. Presumably this intention was largely inherited when the English games were made, as most of the game's script uses 0xE8 exclusively; however, 0xF2 appears in the character table for user input, meaning it may appear in user-input names (and, conversely, 0xE8 never should).
 
The full list of characters that are available for user input are: A-Z and a-z, space, and the following: <code>×():;[]<sup>P</sup><sub>K</sub><sup>M</sup><sub>N</sub>-?!♂♀/.,</code>.
 
===Japanese===
Technically all characters under 0x60 are control characters, the majority of which have the behavior of causing a specific character from the main font (0x80-0xFF) to be printed with a diacritic in the space above it. Those characters that have different, more complicated functions are detailed below.
 
:{| 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-
| <small>NULL</small> || イ゛ || ヴ || エ゛ || オ゛ || ガ || ギ || グ || ゲ || ゴ || ザ || ジ || ズ || ゼ || ゾ || ダ
|-
! 1-
| ヂ || ヅ || デ || ド || ナ゛ || ニ゛ || ヌ゛ || ネ゛ || ノ゛ || バ || ビ || ブ || ボ || マ゛ || ミ゛ || ム゛
|-
! 2-
| ィ゛ || あ゛ || い゛ || ゔ || え゛ || お゛ || が || ぎ || ぐ || げ || ご || ざ || じ || ず || ぜ || ぞ
|-
! 3-
| だ || ぢ || づ || で || ど || な゛ || に゛ || ぬ゛ || ね゛ || の゛ || ば || び || ぶ || べ || ぼ || ま゛
|-
! 4-
| パ || ピ || プ || ポ || ぱ || ぴ || ぷ || ぺ || ぽ || ま゜ || colspan=3 | ''Control'' || も゜ || colspan=2 | ''Control''
|-
! 5-
| colspan=16 | ''Control characters''
|-
! 6-
| A || B || C || D || E || F || G || H || I || V || S || L || M || : || ぃ || ぅ
|-
! 7-
| 「 || 」 || 『 || 』 || ・ || … || ぁ || ぇ || ぉ || [[File:Character 0x79 i.png]] || = || [[File:Character 0x7B i.png]] || <nowiki>||</nowiki> || [[File:Character 0x7D i.png]] || [[File:Character 0x7E i.png]] ||  
|-
! 8-
| ア || イ || ウ || エ || オ || カ || キ || ク || ケ || コ || サ || シ || ス || セ || ソ || タ
|-
! 9-
| チ || ツ || テ || ト || ナ || ニ || ヌ || ネ || ノ || ハ || ヒ || フ || ホ || マ || ミ || ム
|-
! A-
| メ || モ || ヤ || ユ || ヨ || ラ || ル || レ || ロ || ワ || ヲ || ン || ッ || ャ || ュ || ョ
|-
! B-
| ィ || あ || い || う || え || お || か || き || く || け || こ || さ || し || す || せ || そ
|-
! C-
| た || ち || つ || て || と || な || に || ぬ || ね || の || は || ひ || ふ || へ || ほ || ま
|-
! D-
| み || む || め || も || や || ゆ || よ || ら || り || る || れ || ろ || わ || を || ん || っ
|-
! E-
| ゃ || ゅ || ょ || ー || ゜ || ゛ || ? || ! || 。 || ァ || ゥ || ェ || ▷ || ▶ || ▼ || ♂
|-
! F-
| 円 || × || . || / || ォ || ♀ || 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9
|}
 
0xE4 and 0xE5 cause the following character to be printed with that diacritic above it.
 
===Control characters===
{{incomplete|section|Incomplete or missing functions for control bytes. Alternate defaults in different games/other languages}}
* 0x49: Used in Pokédex entries to prompt the player to press a button, after which the screen is cleared to make way for the following text.
* 0x4A: Prints <code><sup>P</sup><sub>K</sub><sup>M</sup><sub>N</sub></code> in English games and <code>が </code> in Japanese games.
* 0x4B: ?
* 0x4C: ?
* 0x4E: Used as a line break in Pokédex entries.
* 0x4F: Line break (print position moves to the bottom of the text window).
* 0x50: A string terminator.
* 0x51: Prompts the player to press a button, after which the text window is cleared to make way for the following text.
* 0x52: Prints the player's name.
** In {{game|Yellow}}, the default value is <code><sc>NINTEN</sc></code> in English games and <code>ゲーフリ1</code> in Japanese games.
* 0x53: Prints the  rival's name.
** In {{game|Yellow}}, the default value is <code><sc>SONY</sc></code> in English games and <code>クリチャ</code> in Japanese games.
* 0x54: Prints <code>POKé</code> in English games and <code>ポケモン</code> in Japanese games.
* 0x55: 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: Prints <code>……</code>.
* 0x57: Marks the end of dialogue, without a visual prompt to the player.
* 0x58: Marks the end of dialogue, with a visual prompt to the player.
* 0x59: Prints the inactive Pokémon's name in battle. (In specific circumstances<!--E.g., Rage-->, the game may "pretend" that the inactive Pokémon is actually active and vice versa.)
** The default value is <code>Enemy </code> in English games and <code>てきの </code> in Japanese games.
* 0x5A: Prints the active Pokémon's name in battle. The default value is empty. (In specific circumstances, the game may "pretend" that the active Pokémon is actually inactive and vice versa.)
* 0x5B: Prints <code>PC</code> in English games and <code>パソコン</code> in Japanese games.
* 0x5C: Prints <code>TM</code> in English games and <code>わざマシン</code> in Japanese games.
* 0x5D: Prints <code>TRAINER</code> in English games and <code>トレーナー</code> in Japanese games.
* 0x5E: Prints <code>ROCKET</code> in English games and <code>ロケットだん</code> in Japanese games.
* 0x5F: Used in Pokédex entries to mark the end of the entry, without a visual prompt to the player.


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