comparison org/rom.org @ 410:a2319e29205b

Added several new things: NPC Pokemon names, Celadon prize data, NPC Trainers' Pokemon.
author Dylan Holmes <ocsenave@gmail.com>
date Fri, 13 Apr 2012 02:38:10 -0500
parents 03ade2a04458
children 0406867ead8a
comparison
equal deleted inserted replaced
408:7116b3f51ba8 410:a2319e29205b
1066 1066
1067 1067
1068 1068
1069 ** Mapping the ROM 1069 ** Mapping the ROM
1070 1070
1071 | ROM address (hex) | Description | Format | Example | 1071 | ROM address (hex) | Description | Format | Example |
1072 |-------------------+-----------------+-----------------+-----------------| 1072 |----------------------+-----------------+-----------------+-----------------|
1073 | | <15> | <15> | <15> | 1073 | | <15> | <15> | <15> |
1074 | 0233C- | Shop inventories. | | | 1074 | 01823-0184A | Important prefix strings. | Variable-length strings, separated by 0x50. | TM#TRAINER#PC#ROCKET#POK\eacute{}#... |
1075 | 04495- | Prices of items. | Each price is two bytes of binary-coded decimal. Prices are separated by zeroes. Priceless items[fn::Like the Pok\eacute{}dex and other unsellable items.] are given a price of zero. | The cost of lemonade is 0x03 0x50, which translates to a price of ₱350. | 1075 | 0233C- | Shop inventories. | | |
1076 | 045B7-0491E | Names of the items in memory. | Variable-length item names (strings of character codes). Names are separated by a single 0x50 character. | MASTER BALL#ULTRA BALL#... | 1076 | 04495- | Prices of items. | Each price is two bytes of binary-coded decimal. Prices are separated by zeroes. Priceless items[fn::Like the Pok\eacute{}dex and other unsellable items.] are given a price of zero. | The cost of lemonade is 0x03 0x50, which translates to a price of ₱350. |
1077 | 04D89- | Lists of wild Pok\eacute{}mon to encounter in each region. | Each list contains ten Pokemon (ids) and their levels; twenty bytes in total. First, the level of the first Pokemon. Then the internal id of the first Pokemon. Next, the level of the second Pokemon, and so on. Since Pokemon cannot have level 0, the lists are separated by a pair 0 /X/, where /X/ is an apparently random Pokemon id. | The first list is (3 36 4 36 2 165 3 165 2 36 3 36 5 36 4 165 6 36 7 36 0 25), i.e. level 3 pidgey, level 4 pidgey, level 2 rattata, level 3 rattata, level 2 pidgey, level 3 pidgey, level 5 pidgey, level 4 rattata, level 6 pidgey, level 7 pidgey, \ldquo{}level 0 gastly\rdquo{} (i.e., end-of-list). | 1077 | 045B7-0491E | Names of the items in memory. | Variable-length item names (strings of character codes). Names are separated by a single 0x50 character. | MASTER BALL#ULTRA BALL#... |
1078 | 05EDB. | Which Pok\eacute{}mon to show during Prof. Oak's introduction. | A single byte, the Pok\eacute{}mon's internal id. | In Pok\eacute{}mon Yellow, it shows Pikachu during the introduction; Pikachu's internal id is 0x54. | 1078 | 04D89- | Lists of wild Pok\eacute{}mon to encounter in each region. | Each list contains ten Pokemon (ids) and their levels; twenty bytes in total. First, the level of the first Pokemon. Then the internal id of the first Pokemon. Next, the level of the second Pokemon, and so on. Since Pokemon cannot have level 0, the lists are separated by a pair 0 /X/, where /X/ is an apparently random Pokemon id. | The first list is (3 36 4 36 2 165 3 165 2 36 3 36 5 36 4 165 6 36 7 36 0 25), i.e. level 3 pidgey, level 4 pidgey, level 2 rattata, level 3 rattata, level 2 pidgey, level 3 pidgey, level 5 pidgey, level 4 rattata, level 6 pidgey, level 7 pidgey, \ldquo{}level 0 gastly\rdquo{} (i.e., end-of-list). |
1079 | 06698- | ? Background music. | | | 1079 | 05EDB. | Which Pok\eacute{}mon to show during Prof. Oak's introduction. | A single byte, the Pok\eacute{}mon's internal id. | In Pok\eacute{}mon Yellow, it shows Pikachu during the introduction; Pikachu's internal id is 0x54. |
1080 | 0822E-082F? | Pointers to background music, part I. | | | 1080 | 06698- | ? Background music. | | |
1081 | 0CB95- | Pointers to lists of wild pokemon to encounter in each region. These lists begin at 04D89, see above. | Each pointer is a low-byte, high-byte pair. | The first entry is 0x89 0x4D, corresponding to the address 0x4D89, the location of the first list of wild Pok\eacute{}mon (see 04D89, above). | 1081 | 0822E-082F? | Pointers to background music, part I. | | |
1082 |-------------------+-----------------+-----------------+-----------------| 1082 | 0CB95- | Pointers to lists of wild pokemon to encounter in each region. These lists begin at 04D89, see above. | Each pointer is a low-byte, high-byte pair. | The first entry is 0x89 0x4D, corresponding to the address 0x4D89, the location of the first list of wild Pok\eacute{}mon (see 04D89, above). |
1083 | 0DADB. | Amount of HP restored by Hyper Potion. | The HP consists of a single byte. TODO: Discover what the surrounding data does, and find the data for the amount of HP restored by other items: Fresh Water (50HP), Soda (60HP), Lemonade(80HP). | 200 | 1083 |----------------------+-----------------+-----------------+-----------------|
1084 | 0DAE0. | Amount of HP restored by Super Potion. | " | 50 | 1084 | 0DADB. | Amount of HP restored by Hyper Potion. | The HP consists of a single byte. TODO: Discover what the surrounding data does, and find the data for the amount of HP restored by other items: Fresh Water (50HP), Soda (60HP), Lemonade(80HP). | 200 |
1085 | 0DAE3. | Amount of HP restored by Potion. | " | 20 | 1085 | 0DAE0. | Amount of HP restored by Super Potion. | " | 50 |
1086 |-------------------+-----------------+-----------------+-----------------| 1086 | 0DAE3. | Amount of HP restored by Potion. | " | 20 |
1087 | 0DD4D-DD72 | Names of permanent stats. | Variable-length strings separated by 0x50. | #HEALTH#ATTACK#DEFENSE#SPEED#SPECIAL# | 1087 |----------------------+-----------------+-----------------+-----------------|
1088 | 1195C-1196A | The two terms for being able/unable to learn a TM/HM. | Variable-length strings separated by 0x50. | ABLE#NOT ABLE# | 1088 | 0DD4D-DD72 | Names of permanent stats. | Variable-length strings separated by 0x50. | #HEALTH#ATTACK#DEFENSE#SPEED#SPECIAL# |
1089 | 119C0-119CE | The two terms for being able/unable to evolve using the current stone. | Variable-length strings separated by 0x50. | ABLE#NOT ABLE# | 1089 | 1195C-1196A | The two terms for being able/unable to learn a TM/HM. | Variable-length strings separated by 0x50. | ABLE#NOT ABLE# |
1090 | 1232D-12364 | Which moves are taught by the TMs and HMs | A list of 55 move ids (50 TMs, plus 5 HMs). First, the move that will be taught by TM01; second, the move that will be taught by TM02; and so on. The last five entries are the moves taught by HMs 1-5. (See also, BC000 below) | The first few entries are (5 13 14 18 ...) corresponding to Mega Punch (TM01), Razor Wind (TM02), Swords Dance (TM03), Whirlwind (TM04), ... | 1090 | 119C0-119CE | The two terms for being able/unable to evolve using the current stone. | Variable-length strings separated by 0x50. | ABLE#NOT ABLE# |
1091 |-------------------+-----------------+-----------------+-----------------| 1091 | 1232D-12364 | Which moves are taught by the TMs and HMs | A list of 55 move ids (50 TMs, plus 5 HMs). First, the move that will be taught by TM01; second, the move that will be taught by TM02; and so on. The last five entries are the moves taught by HMs 1-5. (See also, BC000 below) | The first few entries are (5 13 14 18 ...) corresponding to Mega Punch (TM01), Razor Wind (TM02), Swords Dance (TM03), Whirlwind (TM04), ... |
1092 | 27D56 & 27D57. | Pointer to the list of type pointers. | | | 1092 |----------------------+-----------------+-----------------+-----------------|
1093 | 27D63-27D99 | Pointers to type names. | Each point is a low-byte, high-byte pair. The names of types follows immediately after this section; see below. | The first pointer is [0x99 0x7D], corresponding to the location 0x2.7D.99, the NORMAL type. | 1093 | 27D56 & 27D57. | Pointer to the pointers to type names. | A single low-byte, high-byte pair. | 0x63 0x7D, corresponding to location 0x27D63; see next entry. |
1094 | 27D99-27DFF | Names of the Pok\eacute{}mon types. | Variable-length type names (strings of character codes). Names are separated by a single 0x50 character. | NORMAL#FIGHTING#... | 1094 | 27D63-27D99 | Pointers to type names. | Each point is a low-byte, high-byte pair. The names of types follows immediately after this section; see below. | The first pointer is [0x99 0x7D], corresponding to the location 0x2.7D.99, the NORMAL type. |
1095 | 27E77- | Trainer title names. | Variable-length names separated by 0x50. | YOUNGSTER#BUG CATCHER#LASS#... | 1095 | 27D99-27DFF | Names of the Pok\eacute{}mon types. | Variable-length type names (strings of character codes). Names are separated by a single 0x50 character. | NORMAL#FIGHTING#... |
1096 | 34000- | | | | 1096 | 27E77- | Trainer title names. | Variable-length names separated by 0x50. | YOUNGSTER#BUG CATCHER#LASS#... |
1097 | 38000-383DE | The basic properties and effects of moves. (165 moves total) | Fixed-length (6 byte) continguous descriptions (no separating character): move-index, move-effect, power, move-type, accuracy, pp. | The entry for Pound, the first attack in the list, is (1 0 40 0 255 35). See below for more explanation. | 1097 | 34000- | | | |
1098 | 383DE- | Species data for the Pokemon, listed in Pokedex order: Pokedex number; base moves; types; learnable TMs and HMs; base HP, attack, defense, speed, special; sprite data. | | | 1098 | 38000-383DE | The basic properties and effects of moves. (165 moves total) | Fixed-length (6 byte) continguous descriptions (no separating character): move-index, move-effect, power, move-type, accuracy, pp. | The entry for Pound, the first attack in the list, is (1 0 40 0 255 35). See below for more explanation. |
1099 | 39462- | The Pok\eacute{}mon cry data. | Fixed-length (3 byte) descriptions of cries. | | 1099 | 383DE- | Species data for the Pokemon, listed in Pokedex order: Pokedex number; base moves; types; learnable TMs and HMs; base HP, attack, defense, speed, special; sprite data. | | |
1100 | 3B1E5- | Pointers to evolution/learnset data. | | | 1100 | 39462- | The Pok\eacute{}mon cry data. | Fixed-length (3 byte) descriptions of cries. | |
1101 | 3B361- | Evolution and learnset data. [fn::Evolution data consists of how to make Pok\eacute{}mon evolve, and what they evolve into. Learnset data consists of the moves that Pok\eacute{}mon learn as they level up.] | Variable-length evolution information (see below), followed by a list of level/move-id learnset pairs. | | 1101 | 3997D-39B05 | Trainer titles (extended; see 27E77). This list includes strictly more trainers, seemingly at random inserted into the list from 27E77.[fn::The names added are in bold: YOUNGSTER, BUG CATCHER, LASS, *SAILOR*, JR TRAINER(m), JR TRAINER(f), POK\eacute{}MANIAC, SUPER NERD, *HIKER*, *BIKER*, BURGLAR, ENGINEER, JUGGLER, *FISHERMAN*, SWIMMER, *CUE BALL*, *GAMBLER*, BEAUTY, *PSYCHIC*, ROCKER, JUGGLER (again), *TAMER*, *BIRDKEEPER*, BLACKBELT, *RIVAL1*, PROF OAK, CHIEF, SCIENTIST, *GIOVANNI*, ROCKET, COOLTRAINER(m), COOLTRAINER(f), *BRUNO*, *BROCK*, *MISTY*, *LT. SURGE*, *ERIKA*, *KOGA*, *BLAINE*, *SABRINA*, *GENTLEMAN*, *RIVAL2*, *RIVAL3*, *LORELEI*, *CHANNELER*, *AGATHA*, *LANCE*.] | | |
1102 | 40687- | Species data from the Pok\eacute{}dex: species name, height, weight, etc. | Fixed-length sequences of bytes. See below for specifics. | | 1102 | 3A289-3A540 (approx) | Trainer Pok\eacute{}mon | Consecutive level/internal-id pairs (as with wild Pok\eacute{}mon; see 04D89) with irregular spacing \mdash{} the separators seem to have some metadata purpose. | The first entry is 0x05 0x66, representing level 5 Eevee (from your first battle in the game[fn::Incidentally, to change your rival's starter Pok\eacute{}mon, it's enough just to change its species in all of your battles with him.].) |
1103 | 410B1- | A conversion table between internal order and Pokedex order. | | | 1103 | 3B1E5- | Pointers to evolution/learnset data. | | |
1104 | 5DE10-5DE30 | Abbreviations for status ailments. | Fixed-length strings, probably[fn::Here's something strange: all of the status messages start with 0x7F and end with 0x4F \mdash{}except PAR, which ends with 0x50.]. The last entry is QUIT##. | [0x7F] *SLP* [0x4E][0x7F] *PSN* [0x4E][0x7F] *PAR* [0x50][0x7F]... | 1104 | 3B361- | Evolution and learnset data. [fn::Evolution data consists of how to make Pok\eacute{}mon evolve, and what they evolve into. Learnset data consists of the moves that Pok\eacute{}mon learn as they level up.] | Variable-length evolution information (see below), followed by a list of level/move-id learnset pairs. | |
1105 | 71500- | Names of places. | | | 1105 | 40687- | Species data from the Pok\eacute{}dex: species name, height, weight, etc. | Fixed-length sequences of bytes. See below for specifics. | |
1106 | 7C249-7C2?? | Pointers to background music, pt II. | | | 1106 | 410B1- | A conversion table between internal order and Pokedex order. | | |
1107 | 98000- | Dialogue | | | 1107 | 527BA-527DB | The costs and species of prizes from Celadon Game Corner. | The following pattern repeats three times, once per window[fn::For the first two groups, ids are interpreted as Pok\eacute{}mon ids. For the last group, ids are (somehow) interpreted as item ids.]: Internal ids / 0x50 / Prices (two bytes of BCD)/ 0x50. | (0x94 0x52 0x65 0x50) Abra Vulpix Wigglytuff (0x02 0x30 0x10 0x00 0x26 0x80) 230C, 1000C, 2680C |
1108 | B8000- | The text of each Pokemon's Pok\eacute{}dex entry. | | | 1108 | 5DE10-5DE30 | Abbreviations for status ailments. | Fixed-length strings, probably[fn::Here's something strange: all of the status messages start with 0x7F and end with 0x4F \mdash{}except PAR, which ends with 0x50.]. The last entry is QUIT##. | [0x7F] *SLP* [0x4E][0x7F] *PSN* [0x4E][0x7F] *PAR* [0x50][0x7F]... |
1109 | BC000-BC60E | Move names. | Variable-length move names, separated by 0x50. The moves are in internal order. | POUND#KARATE CHOP#DOUBLESLAP#COMET PUNCH#... | 1109 | 71500- | Names of places. | | |
1110 | E8000-E876C | Names of the \ldquo{}190\rdquo{} species of Pok\eacute{}mon in memory. | Fixed length (10-letter) Pok\eacute{}mon names. Any extra space is padded with the character 0x80. The names are in \ldquo{}internal order\rdquo{}. | RHYDON####KANGASKHANNIDORAN♂#... | 1110 | 71C1?- | NPC Pok\eacute{}mon. | Internal ID, followed by nickname (11 chars; extra space padded by 0x50). | |
1111 | | | | | 1111 | 7C249-7C2?? | Pointers to background music, pt II. | | |
1112 | | | | | 1112 | 98000-B8000 | Dialogue and other messsages. | Variable-length strings. | |
1113 | B8000-BC000 | The text of each Pok\eacute{}mon's Pok\eacute{}dex entry. | Variable-length descriptions (strings) in Pok\eacute{}dex order, separated by 0x50. These entries use the special characters *0x49* (new page), *0x4E* (new line), and *0x5F* (end entry). | The first entry (Bulbasaur's) is: "It can go for days [0x4E] without eating a [0x4E] single morsel. [0x49] In the bulb on [0x4E] its back, it [0x4E] stores energy [0x5F] [0x50]." |
1114 | BC000-BC60E | Move names. | Variable-length move names, separated by 0x50. The moves are in internal order. | POUND#KARATE CHOP#DOUBLESLAP#COMET PUNCH#... |
1115 | E8000-E876C | Names of the \ldquo{}190\rdquo{} species of Pok\eacute{}mon in memory. | Fixed length (10-letter) Pok\eacute{}mon names. Any extra space is padded with the character 0x50. The names are in \ldquo{}internal order\rdquo{}. | RHYDON####KANGASKHANNIDORAN♂#... |
1116 | | | | |
1117 | | | | |
1118 #+TBLFM:
1113 1119
1114 1120
1115 1121
1116 ** Internal Pok\eacute{}mon IDs 1122 ** Internal Pok\eacute{}mon IDs
1117 ** Type IDs 1123 ** Type IDs
1572 ;; note: DD4D spells out pokemon vital stat names ("speed", etc.) 1578 ;; note: DD4D spells out pokemon vital stat names ("speed", etc.)
1573 1579
1574 ;; note: 1195C-6A says ABLE#NOT ABLE#, but so does 119C0-119CE. 1580 ;; note: 1195C-6A says ABLE#NOT ABLE#, but so does 119C0-119CE.
1575 ;; The first instance is for Machines; the second, for stones. 1581 ;; The first instance is for Machines; the second, for stones.
1576 1582
1583 ;; note: according to
1584 ;; http://www.upokecenter.com/games/rby/guides/rgbtrainers.php
1585 ;; the amount of money given by a trainer is equal to the
1586 ;; base money times the level of the last Pokemon on that trainer's
1587 ;; list. Other sources say it's the the level of the last pokemon
1588 ;; /defeated/.
1589
1590 ;; todo: find base money.
1591
1592
1577 ;; 0x251A (in indexable mem): image decompression routine seems to begin here. 1593 ;; 0x251A (in indexable mem): image decompression routine seems to begin here.
1578 1594
1579 1595
1580 ;; Note: There are two tile tables, one from 8000-8FFF, the other from 1596 ;; Note: There are two tile tables, one from 8000-8FFF, the other from
1581 ;; 8800-97FF. The latter contains symbols, possibly map tiles(?), with some japanese chars and stuff at the end. 1597 ;; 8800-97FF. The latter contains symbols, possibly map tiles(?), with some japanese chars and stuff at the end.
1607 [(take 1000 pc-2) n]))) 1623 [(take 1000 pc-2) n])))
1608 1624
1609 1625
1610 1626
1611 1627
1612 1628 (defn test-3
1629 "Explore trainer data"
1630 []
1631 (let [pokenames (vec(hxc-pokenames-raw))]
1632 (println
1633 (reduce
1634 str
1635 (map
1636 (fn [[lvl pkmn]]
1637 (str (format "%-11s %4d %02X %02X"
1638 (cond
1639 (zero? lvl) "+"
1640 (nil? (get pokenames (dec pkmn)))
1641 "-"
1642 :else
1643 (get pokenames (dec pkmn)))
1644 lvl
1645 pkmn
1646 lvl
1647 ) "\n"))
1648
1649 (partition 2
1650 (take 100;;703
1651 (drop 0x3A281 (rom)))))))))
1652
1653
1654
1655 ;; look for the rainbow badge in memory
1656 (println (reduce str (map #(str (first %) "\t" (vec(second %)) "\n") (search-memory (rom) [221] 10))))
1613 1657
1614 1658
1615 (comment 1659 (comment
1616 1660
1617 (def hxc-later 1661 (def hxc-later