comparison org/rom.org @ 413:70e313aeaa91

merge.
author Robert McIntyre <rlm@mit.edu>
date Sat, 14 Apr 2012 01:32:49 -0500
parents 543a78679971
children 4901ba2d3860
comparison
equal deleted inserted replaced
409:55a45f67e4a4 413:70e313aeaa91
130 130
131 131
132 132
133 133
134 (defn hxc-pokedex-names 134 (defn hxc-pokedex-names
135 "The names of the pokemon in hardcoded pokedex order. List begins at 135 "The names of the pokemon in hardcoded pokedex order. List of the
136 pokedex numbers of each pokemon (in internal order) begins at
136 ROM@410B1. See also, hxc-pokenames." 137 ROM@410B1. See also, hxc-pokenames."
137 ([] (hxc-pokedex-names 138 ([] (hxc-pokedex-names
138 com.aurellem.gb.gb-driver/original-rom)) 139 com.aurellem.gb.gb-driver/original-rom))
139 ([rom] 140 ([rom]
140 (let [names (hxc-pokenames rom)] 141 (let [names (hxc-pokenames rom)]
480 pkmn-count 481 pkmn-count
481 {} 482 {}
482 (drop 0x40687 rom))) )) 483 (drop 0x40687 rom))) ))
483 #+end_src 484 #+end_src
484 485
486 #+results: dex-stats
487 : #'com.aurellem.gb.hxc/hxc-pokedex-stats
488
485 ** Species synopses 489 ** Species synopses
486 490
487 #+name: dex-text 491 #+name: dex-text
488 #+begin_src clojure 492 #+begin_src clojure
489 (def hxc-pokedex-text-raw 493 (def hxc-pokedex-text-raw
1066 1070
1067 1071
1068 1072
1069 ** Mapping the ROM 1073 ** Mapping the ROM
1070 1074
1071 | ROM address (hex) | Description | Format | Example | 1075 | ROM address (hex) | Description | Format | Example |
1072 |-------------------+-----------------+-----------------+-----------------| 1076 |-----------------------+-----------------+-----------------+-----------------|
1073 | | <15> | <15> | <15> | 1077 | | <15> | <15> | <15> |
1074 | 0233C- | Shop inventories. | | | 1078 | 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. | 1079 | 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#... | 1080 | 02F47- | (?) Move ids of some HM moves. | One byte per move id | 0x0F 0x13 0x39 0x46 0x94 0xFF, the move ids of CUT, FLY, SURF, STRENGTH, FLASH, then cancel. |
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). | 1081 | 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. |
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. | 1082 | 04524-04527 | (unconfirmed) possibly the bike price in Cerulean. | | |
1079 | 06698- | ? Background music. | | | 1083 | 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#... |
1080 | 0822E-082F? | Pointers to background music, part I. | | | 1084 | 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). |
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). | 1085 |-----------------------+-----------------+-----------------+-----------------|
1082 |-------------------+-----------------+-----------------+-----------------| 1086 | 05DD2-05DF2 | Menu text for player info. | | PLAYER [newline] BADGES [nelwine] POK\Eacute{}DEX [newline] TIME [0x50] |
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 | 1087 | 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. |
1084 | 0DAE0. | Amount of HP restored by Super Potion. | " | 50 | 1088 | 06698- | ? Background music. | | |
1085 | 0DAE3. | Amount of HP restored by Potion. | " | 20 | 1089 | 7550-7570 | Menu options for map directions[fn:unused:According to [[http://tcrf.net/Pok%C3%A9mon_Red_and_Blue#NORTH.2FWEST.2FSOUTH.2FEAST][The Cutting Room Floor]], this data is unused. ]. | Variable-length strings. | NORTH [newline] WEST [0x50] SOUTH [newline] EAST [0x50] NORTH [newline] EAST[0x50] |
1086 |-------------------+-----------------+-----------------+-----------------| 1090 | 7570-757D | Menu options for trading Pok\eacute{}mon | | TRADE [newline] CANCEL [0x50] |
1087 | 0DD4D-DD72 | Names of permanent stats. | Variable-length strings separated by 0x50. | #HEALTH#ATTACK#DEFENSE#SPEED#SPECIAL# | 1091 | 757D-758A | Menu options for healing Pok\eacute{}mon | | HEAL [newline] CANCEL [0x50] |
1088 | 1195C-1196A | The two terms for being able/unable to learn a TM/HM. | Variable-length strings separated by 0x50. | ABLE#NOT ABLE# | 1092 | 7635- | Menu options for selected Pok\eacute{}mon (Includes names of out-of-battle moves). | Variable-length strings separated by 0x50. | CUT [0x50] FLY [0x50] SURF [0x50] STRENGTH [0x50] FLASH [0x50] DIG [0x50] TELEPORT [0x50] SOFTBOILED [0x50] STATS [newline] SWITCH [newline] CANCEL [0x50] |
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# | 1093 | 7AF0-8000 | (empty space) | | 0 0 0 0 0 ... |
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), ... | 1094 | 0822E-082F? | Pointers to background music, part I. | | |
1091 |-------------------+-----------------+-----------------+-----------------| 1095 | 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). |
1092 | 27D56 & 27D57. | Pointer to the list of type pointers. | | | 1096 |-----------------------+-----------------+-----------------+-----------------|
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. | 1097 | 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 |
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#... | 1098 | 0DAE0. | Amount of HP restored by Super Potion. | " | 50 |
1095 | 27E77- | Trainer title names. | Variable-length names separated by 0x50. | YOUNGSTER#BUG CATCHER#LASS#... | 1099 | 0DAE3. | Amount of HP restored by Potion. | " | 20 |
1096 | 34000- | | | | 1100 |-----------------------+-----------------+-----------------+-----------------|
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. | 1101 | 0DD4D-DD72 | Names of permanent stats. | Variable-length strings separated by 0x50. | #HEALTH#ATTACK#DEFENSE#SPEED#SPECIAL# |
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. | | | 1102 | 1164B- | Terminology for the Pok\eacute{}mon menu. | Contiguous, variable-length strings. | TYPE1[newline]TYPE2[newline] *№*,[newline]OT,[newline][0x50]STATUS,[0x50]OK |
1099 | 39462- | The Pok\eacute{}mon cry data. | Fixed-length (3 byte) descriptions of cries. | | 1103 | 116DE- | Terminology for permanent stats in the Pok\eacute{}mon menu. | Contiguous, variable-length strings. | ATTACK[newline]DEFENSE[newline]SPEED[newline]SPECIAL[0x50] |
1100 | 3B1E5- | Pointers to evolution/learnset data. | | | 1104 | 11852- | Terminology for current stats in the Pok\eacute{}mon menu. | Contiguous, variable-length strings. | EXP POINTS[newline]LEVEL UP[0x50] |
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. | | 1105 | 1195C-1196A | The two terms for being able/unable to learn a TM/HM. | Variable-length strings separated by 0x50. | ABLE#NOT ABLE# |
1102 | 40687- | Species data from the Pok\eacute{}dex: species name, height, weight, etc. | Fixed-length sequences of bytes. See below for specifics. | | 1106 | 119C0-119CE | The two terms for being able/unable to evolve using the current stone. | Variable-length strings separated by 0x50. | ABLE#NOT ABLE# |
1103 | 410B1- | A conversion table between internal order and Pokedex order. | | | 1107 | 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), ... |
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]... | 1108 |-----------------------+-----------------+-----------------+-----------------|
1105 | 71500- | Names of places. | | | 1109 | 27D56 & 27D57. | Pointer to the pointers to type names. | A single low-byte, high-byte pair. | 0x63 0x7D, corresponding to location 27D63\mdash{} the start of the next entry. |
1106 | 7C249-7C2?? | Pointers to background music, pt II. | | | 1110 | 27D63-27D99 | Pointers to type names. | Each point is a low-byte, high-byte pair. The type names follows immediately after this section; see below. | The first pointer is [0x99 0x7D], corresponding to the location 27D99 ("NORMAL"). |
1107 | 98000- | Dialogue | | | 1111 | 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#... |
1108 | B8000- | The text of each Pokemon's Pok\eacute{}dex entry. | | | 1112 | 27DFF-27E77 | ? | 120 bytes of unknown data. | |
1109 | BC000-BC60E | Move names. | Variable-length move names, separated by 0x50. The moves are in internal order. | POUND#KARATE CHOP#DOUBLESLAP#COMET PUNCH#... | 1113 | 27E77- | Trainer title names. | Variable-length names separated by 0x50. | YOUNGSTER#BUG CATCHER#LASS#... |
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♂#... | 1114 | 34000- | | | |
1111 | | | | | 1115 | 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. |
1112 | | | | | 1116 | 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. | | |
1117 | 39462- | The Pok\eacute{}mon cry data. | Fixed-length (3 byte) descriptions of cries. | |
1118 |-----------------------+-----------------+-----------------+-----------------|
1119 | 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*.] | | |
1120 | 39B05-39DD0. | unknown | | |
1121 | 39DD1- | (?) Pointers to trainer Pok\eacute{}mon | | |
1122 | 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.].) |
1123 | 3B1E5-3B361 | Pointers to evolution/learnset data. | One high-low byte pair for each of the 190 Pok\eacute{}mon in internal order. | |
1124 |-----------------------+-----------------+-----------------+-----------------|
1125 | 3B361-3BBAA | 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. | |
1126 | 3BBAA-3C000 | (empty) | | 0 0 0 0 ... |
1127 |-----------------------+-----------------+-----------------+-----------------|
1128 | 3D131-3D133 | The inventory of both OLD MAN and PROF. OAK when they battle for you. | Pairs of [item-id quantity], terminated by 0xFF. | (0x04 0x01 0xFF) They only have one Pok\eacute{}ball [fn::If you give them any ball, OAK will catch the enemy Pok\eacute{}mon and OLD MAN will miss. (OLD MAN misses even if he throws a MASTER BALL, which is a sight to see!) If you give them some other item first in the list, you'll be able to use that item normally but then you'll trigger the Safari Zone message: Pa will claim you're out of SAFARI BALLs and the battle will end. If you engage in either an OLD MAN or OAK battle with a Gym Leader, you will [1] get reprimanded if you try to throw a ball [2] incur the Safari Zone message [3] automatically win no matter which item you use [4] earn whichever reward they give you as usual [5] permanently retain the name OLD MAN / PROF. OAK.]. |
1129 | 3D6C7-3D6D6 | Two miscellaneous strings. | Variable length, separated by 0x50 | Disabled!#TYPE |
1130 |-----------------------+-----------------+-----------------+-----------------|
1131 | 40252-4027B | Pok\eacute{}dex menu text | Variable-length strings separated by 0x50. | SEEN#OWN#CONTENTS#... |
1132 | 40370-40386 | Important constants for Pok\eacute{}dex entries | | HT _ _ *?′??″* [newline] WT _ _ _ *???* lb [0x50] *POK\Eacute{}* [0x50] |
1133 | 40687-41072 | Species data from the Pok\eacute{}dex: species name, height, weight, etc. | Variable-length species names, followed by 0x50, followed by fixed-length height/weight/etc. data. | The first entry is (*146 132 132 131*, 80, *2 4*, *150 0*, 23, 0 64 46, 80), which are the the stats of Bulbasaur: the first entry spells "SEED", then 0x80, then the height (2' 4"), then the weight (formatted as a low-high byte pair), then various Pokédex pointer data (see elsewhere). |
1134 | 41072- | Pok\eacute{} placeholder species, "???" | | |
1135 |-----------------------+-----------------+-----------------+-----------------|
1136 | 410B1-4116F | A conversion table between internal order and Pokedex order. | 190 bytes, corresponding to the Pok\eacute{}dex numbers of the 190 Pok\eacute{}mon listed in internal order. All =MISSINGNO.= are assigned a Pok\eacute{}dex number of 0. | The first few entries are (112 115 32 35 21 100 34 80 2 ...), which are the Pok\eacute{}dex numbers of Rhydon, Kangaskhan, Nidoran(m), Clefairy, Spearow, Voltorb, Nidoking, Slobrow, and Ivysaur. |
1137 | 527BA-527DB | The costs and kinds of prizes from Celadon Game Corner. | The following pattern repeats three times, once per window[fn::For the first two prize lists, ids are interpreted as Pok\eacute{}mon ids. For the last prize list, 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 |
1138 | 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]... |
1139 |-----------------------+-----------------+-----------------+-----------------|
1140 | 70295- | Hall of fame | The text "HALL OF FAME" | |
1141 | 70442- | Play time/money | The text "PLAY TIME [0x50] MONEY" | |
1142 | 71500-7174B | Names of places. | Variable-length place names (strings), separated by 0x50. | PALLET TOWN#VIRIDIAN CITY#PEWTER CITY#CERULEAN CITY#... |
1143 | 71C1E-71CAA (approx.) | Tradeable NPC Pok\eacute{}mon. | Internal ID, followed by nickname (11 chars; extra space padded by 0x50). Some of the Pokemon have unknown extra data around the id. | The first entry is [0x76] "GURIO######", corresponding to a Dugtrio named "GURIO". |
1144 | 7C249-7C2?? | Pointers to background music, pt II. | | |
1145 |-----------------------+-----------------+-----------------+-----------------|
1146 | 98000-B8000 | Dialogue and other messsages. | Variable-length strings. | |
1147 | 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]." |
1148 | BC000-BC60E | Move names. | Variable-length move names, separated by 0x50. The moves are in internal order. | POUND#KARATE CHOP#DOUBLESLAP#COMET PUNCH#... |
1149 | 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♂#... |
1150 |-----------------------+-----------------+-----------------+-----------------|
1151 | E9BD5- | The text PLAY TIME (see above, 70442) | | |
1152 #+TBLFM:
1113 1153
1114 1154
1115 1155
1116 ** Internal Pok\eacute{}mon IDs 1156 ** Internal Pok\eacute{}mon IDs
1117 ** Type IDs 1157 ** Type IDs
1572 ;; note: DD4D spells out pokemon vital stat names ("speed", etc.) 1612 ;; note: DD4D spells out pokemon vital stat names ("speed", etc.)
1573 1613
1574 ;; note: 1195C-6A says ABLE#NOT ABLE#, but so does 119C0-119CE. 1614 ;; note: 1195C-6A says ABLE#NOT ABLE#, but so does 119C0-119CE.
1575 ;; The first instance is for Machines; the second, for stones. 1615 ;; The first instance is for Machines; the second, for stones.
1576 1616
1577 ;; 0x251A (in indexable mem): image decompression routine seems to begin here. 1617 ;; note: according to
1618 ;; http://www.upokecenter.com/games/rby/guides/rgbtrainers.php
1619 ;; the amount of money given by a trainer is equal to the
1620 ;; base money times the level of the last Pokemon on that trainer's
1621 ;; list. Other sources say it's the the level of the last pokemon
1622 ;; /defeated/.
1623
1624 ;; todo: find base money.
1625
1626
1627 ;; note: 0xDFEA (in indexable mem) is the dex# of the currently-viewed Pokemon in
1628 ;; in the pokedex. It's used for other purposes if there is none.
1629
1630 ;; note: 0x9D35 (index.) switches from 0xFF to 0x00 temporarily when
1631 ;; you walk between areas.
1632
1633 ;; note: 0xD059 (index.) is the special battle type of your next battle:
1634 ;; - 00 is a usual battle
1635 ;; - 01 is a pre-scripted OLD MAN battle which always fails to catch the
1636 ;; target Pokemon.
1637 ;; - 02 is a safari zone battle
1638 ;; - 03 obligates you to run away. (unused)
1639 ;; - 04 is a pre-scripted OAK battle, which (temporarily) causes the
1640 ;; enemy Pokemon to cry PIKAAA, and which always catches the target
1641 ;; Pokemon. The target Pokemon is erased after the battle.
1642 ;; - 05+ are glitch states in which you are sort of the Pokemon.
1643
1644
1645 ;; note: 0x251A (in indexable mem): image decompression routine seems to begin here.
1578 1646
1579 1647
1580 ;; Note: There are two tile tables, one from 8000-8FFF, the other from 1648 ;; 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. 1649 ;; 8800-97FF. The latter contains symbols, possibly map tiles(?), with some japanese chars and stuff at the end.
1582 (defn print-pixel-letters! 1650 (defn print-pixel-letters!
1607 [(take 1000 pc-2) n]))) 1675 [(take 1000 pc-2) n])))
1608 1676
1609 1677
1610 1678
1611 1679
1612 1680 (defn test-3
1681 "Explore trainer data"
1682 []
1683 (let [pokenames (vec(hxc-pokenames-raw))]
1684 (println
1685 (reduce
1686 str
1687 (map
1688 (fn [[lvl pkmn]]
1689 (str (format "%-11s %4d %02X %02X"
1690 (cond
1691 (zero? lvl) "+"
1692 (nil? (get pokenames (dec pkmn)))
1693 "-"
1694 :else
1695 (get pokenames (dec pkmn)))
1696 lvl
1697 pkmn
1698 lvl
1699 ) "\n"))
1700
1701 (partition 2
1702 (take 100;;703
1703 (drop
1704 0x3A281
1705 ;; 0x3A75D
1706 (rom)))))))))
1707
1708 (defn search-memory* [mem codes k]
1709 (loop [index 0
1710 index-next 1
1711 start-match 0
1712 to-match codes
1713 matches []]
1714 (cond
1715 (>= index (count mem)) matches
1716
1717 (empty? to-match)
1718 (recur
1719 index-next
1720 (inc index-next)
1721 index-next
1722 codes
1723 (conj matches
1724 [(hex start-match) (take k (drop start-match mem))])
1725 )
1726
1727 (or (= (first to-match) \_) ;; wildcard
1728 (= (first to-match) (nth mem index)))
1729 (recur
1730 (inc index)
1731 index-next
1732 start-match
1733 (rest to-match)
1734 matches)
1735
1736 :else
1737 (recur
1738 index-next
1739 (inc index-next)
1740 index-next
1741 codes
1742 matches))))
1743
1744
1745
1746
1747
1748 ;; look for the rainbow badge in memory
1749 (println (reduce str (map #(str (first %) "\t" (vec(second %)) "\n") (search-memory (rom) [221] 10))))
1613 1750
1614 1751
1615 (comment 1752 (comment
1616 1753
1617 (def hxc-later 1754 (def hxc-later