comparison org/rom.org @ 474:9a20581477c2

merge dylan's changes.
author Robert McIntyre <rlm@mit.edu>
date Fri, 04 May 2012 06:18:48 -0500
parents 9a7fae5afd8f
children
comparison
equal deleted inserted replaced
469:396065930208 474:9a20581477c2
4 #+description: A detailed explication of Pok\eacute{}mon Yellow, helped by Clojure. 4 #+description: A detailed explication of Pok\eacute{}mon Yellow, helped by Clojure.
5 #+keywords: pokemon, pokemon yellow, rom, gameboy, assembly, hex, pointers, clojure 5 #+keywords: pokemon, pokemon yellow, rom, gameboy, assembly, hex, pointers, clojure
6 #+SETUPFILE: ../../aurellem/org/setup.org 6 #+SETUPFILE: ../../aurellem/org/setup.org
7 #+INCLUDE: ../../aurellem/org/level-0.org 7 #+INCLUDE: ../../aurellem/org/level-0.org
8 #+BABEL: :exports both :noweb yes :cache no :mkdirp yes 8 #+BABEL: :exports both :noweb yes :cache no :mkdirp yes
9 #+OPTIONS: num:2
10
9 11
10 # about map headers http://datacrystal.romhacking.net/wiki/Pokemon_Red/Blue:Notes 12 # about map headers http://datacrystal.romhacking.net/wiki/Pokemon_Red/Blue:Notes
11 # map headers Yellow http://www.pokecommunity.com/archive/index.php/t-235311.html 13 # map headers Yellow http://www.pokecommunity.com/archive/index.php/t-235311.html
12 # pokedollar: U+20B1 14 # pokedollar: U+20B1
13 * Introduction 15 * Introduction
16 This article contains the results of my investigations with
17 Pok\eacute{}mon Yellow as I searched for interesting
18 data in the ROM. By using the Clojure language interface
19 written by Robert[fn::This Clojure interface will be published to aurellem.org soon.], I
20 was able to interact with the game in real-time, sending commands and
21 gathering data. The result is a manifestly accurate map of
22 Pok\eacute{}mon Yellow; every result
23 comes with runnable code that /works/. You can see the code and the output of
24 every function and confirm for yourself that they are all correct. I
25 hope you like the result!
26
27 To orient yourself, you can look for a specific topic in the table of contents
28 above, or browse the [[#sec-9-1][map of the ROM]], below.
29
30
31 If you have any questions or comments, please e-mail =rlm@mit.edu=.
32
14 33
15 ** COMMENT Getting linguistic data: names, words, etc. 34 ** COMMENT Getting linguistic data: names, words, etc.
16 35
17 Some of the simplest data 36 Some of the simplest data
18 37
181 rating-def 200 rating-def
182 rating-speed 201 rating-speed
183 rating-special 202 rating-special
184 type-1 203 type-1
185 type-2 204 type-2
186 rarity 205 rarity ;; catch rate
187 rating-xp 206 rating-xp ;; base exp yield
188 pic-dimensions ;; tile_width|tile_height (8px/tile) 207 pic-dimensions ;; tile_width|tile_height (8px/tile)
189 ptr-pic-obverse-1 208 ptr-pic-obverse-1
190 ptr-pic-obverse-2 209 ptr-pic-obverse-2
191 ptr-pic-reverse-1 210 ptr-pic-reverse-1
192 ptr-pic-reverse-2 211 ptr-pic-reverse-2
193 move-1 212 move-1 ;; attacks known at level 0 [i.e. by default]
194 move-2 213 move-2 ;; (0 for none)
195 move-3 214 move-3
196 move-4 215 move-4
197 growth-rate 216 growth-rate
198 & 217 &
199 TMs|HMs]] 218 TMs|HMs]]
508 (hxc-pokedex-text-raw rom))))) 527 (hxc-pokedex-text-raw rom)))))
509 #+end_src 528 #+end_src
510 529
511 530
512 ** Pok\eacute{}mon cries 531 ** Pok\eacute{}mon cries
532 *** See the data
533
534 Here, you can see that each Pok\eacute{}mon's cry data consists of
535 three bytes: the =cry-id=, which is the basic sound byte to use, the
536 =pitch=, which determines how high or low to make the sound byte, and
537 the =length=, which is the amount of the sound byte to play.
538
539 Even though there are only a few different basic sound bytes (cry
540 ids) to build from, by varying the pitch and length,
541 you can create a wide variety of different Pok\eacute{}mon cries.
542
543 #+begin_src clojure :exports both :cache no :results output
544 (ns com.aurellem.gb.hxc
545 (:use (com.aurellem.gb assembly characters gb-driver util mem-util
546 constants))
547 (:import [com.aurellem.gb.gb_driver SaveState]))
548
549 (->>
550 (rom)
551 (drop 0x39462)
552 (take 12)
553 (println))
554
555 (->>
556 (rom)
557 (drop 0x39462)
558 (take 12)
559 (partition 3)
560 (map vec)
561 (println))
562
563 (->>
564 (rom)
565 (drop 0x39462)
566 (take 12)
567 (partition 3)
568 (map
569 (fn [[id pitch length]]
570 {:cry-id id :pitch pitch :length length}))
571 (println))
572
573 #+end_src
574
575 #+results:
576 : (17 0 128 3 0 128 0 0 128 25 204 1)
577 : ([17 0 128] [3 0 128] [0 0 128] [25 204 1])
578 : ({:cry-id 17, :pitch 0, :length 128} {:cry-id 3, :pitch 0, :length 128} {:cry-id 0, :pitch 0, :length 128} {:cry-id 25, :pitch 204, :length 1})
579
580
581 It is interesting to note which Pok\eacute{}mon use the same basic
582 =cry-id= --- I call these /cry groups/. Here, you can see which
583 Pok\eacute{}mon belong to the same cry group.
584
585 #+begin_src clojure :exports both :cache no :results output
586 (ns com.aurellem.gb.hxc
587 (:use (com.aurellem.gb assembly characters gb-driver util mem-util
588 constants))
589 (:import [com.aurellem.gb.gb_driver SaveState]))
590
591 (println "POKEMON CRY GROUPS")
592 (doall
593 (map println
594 (let [cry-id
595 (->>
596 (rom)
597 (drop 0x39462) ;; get the cry data
598 (partition 3) ;; partition it into groups of three
599 (map first) ;; keep only the first item, the cry-id
600 (zipmap (hxc-pokenames)) ;; associate each pokemon with its cry-id
601 )]
602
603 (->> (hxc-pokenames) ;; start with the list of pokemon
604 (remove (partial = :missingno.)) ;; remove missingnos
605 (sort-by cry-id)
606 (partition-by cry-id)
607 (map vec)))))
608
609 #+end_src
610
611 #+results:
612 #+begin_example
613 POKEMON CRY GROUPS
614 [:nidoran♂ :sandshrew :sandslash :nidorino]
615 [:nidoran♀ :nidorina]
616 [:slowpoke]
617 [:kangaskhan]
618 [:rhyhorn :magmar :charmander :charmeleon :charizard]
619 [:grimer :snorlax]
620 [:voltorb :electabuzz :electrode]
621 [:gengar :muk]
622 [:marowak :oddish :gloom]
623 [:nidoking :moltres :articuno :raichu]
624 [:nidoqueen :mankey :primeape]
625 [:exeggcute :diglett :doduo :dodrio :dugtrio]
626 [:lickitung :hitmonchan :seel :dewgong]
627 [:exeggutor :drowzee :jynx :hypno]
628 [:pidgey :poliwag :ditto :jigglypuff :wigglytuff :poliwhirl :poliwrath]
629 [:ivysaur :dragonite :pikachu :dratini :dragonair :bulbasaur :venusaur]
630 [:spearow :farfetch'd]
631 [:rhydon]
632 [:tangela :hitmonlee :golem :koffing :weezing]
633 [:blastoise :kakuna :beedrill]
634 [:pinsir :chansey :pidgeotto :pidgeot]
635 [:arcanine :weedle]
636 [:scyther :kabuto :caterpie :butterfree :goldeen :seaking]
637 [:gyarados :onix :arbok :ekans :magikarp]
638 [:shellder :fearow :zapdos :kabutops :cloyster]
639 [:clefairy :cubone :meowth :horsea :seadra :clefable :persian]
640 [:tentacool :venonat :eevee :flareon :jolteon :vaporeon :venomoth :tentacruel]
641 [:lapras]
642 [:gastly :kadabra :magneton :metapod :haunter :abra :alakazam :magnemite]
643 [:tauros :zubat :golbat :squirtle :wartortle]
644 [:mew :staryu :parasect :paras :mewtwo :starmie]
645 [:slowbro :growlithe :machoke :omanyte :omastar :machop :machamp]
646 [:mr.mime :krabby :kingler]
647 [:psyduck :golduck :bellsprout]
648 [:rattata :raticate]
649 [:aerodactyl :vileplume]
650 [:graveler :vulpix :ninetales :geodude]
651 [:ponyta :rapidash :porygon :weepinbell :victreebel]
652 #+end_example
653
654
655
656
657
658
659 *** Automatically grab the data
513 #+name: pokecry 660 #+name: pokecry
514 #+begin_src clojure 661 #+begin_src clojure
515 (defn hxc-cry 662 (defn hxc-cry
516 "The pokemon cry data in internal order. List begins at ROM@39462" 663 "The pokemon cry data in internal order. List begins at ROM@39462"
517 ([](hxc-cry com.aurellem.gb.gb-driver/original-rom)) 664 ([](hxc-cry com.aurellem.gb.gb-driver/original-rom))
781 928
782 929
783 930
784 ;;; TYPE EFFECTIVENESS 931 ;;; TYPE EFFECTIVENESS
785 932
786 (println (take 15 (drop 0x3E62D (rom)))) 933 (println (take 15 (drop 0x3E5FA (rom))))
787 (println (partition 3 (take 15 (drop 0x3E62D (rom))))) 934 (println (partition 3 (take 15 (drop 0x3E5FA (rom)))))
788 935
789 (println 936 (println
790 (map 937 (map
791 (fn [[atk-type def-type multiplier]] 938 (fn [[atk-type def-type multiplier]]
792 (list atk-type def-type (/ multiplier 10.))) 939 (list atk-type def-type (/ multiplier 10.)))
793 940
794 (partition 3 941 (partition 3
795 (take 15 (drop 0x3E62D (rom)))))) 942 (take 15 (drop 0x3E5FA (rom))))))
796 943
797 944
798 (println 945 (println
799 (map 946 (map
800 (fn [[atk-type def-type multiplier]] 947 (fn [[atk-type def-type multiplier]]
803 (get pkmn-types def-type) 950 (get pkmn-types def-type)
804 (/ multiplier 10.) 951 (/ multiplier 10.)
805 ]) 952 ])
806 953
807 (partition 3 954 (partition 3
808 (take 15 (drop 0x3E62D (rom)))))) 955 (take 15 (drop 0x3E5FA (rom))))))
809 956
810 #+end_src 957 #+end_src
811 958
812 #+results: 959 #+results:
813 : [:normal :fighting :flying :poison :ground :rock :bird :bug :ghost :A :B :C :D :E :F :G :H :I :J :K :fire :water :grass :electric :psychic :ice :dragon] 960 : [:normal :fighting :flying :poison :ground :rock :bird :bug :ghost :A :B :C :D :E :F :G :H :I :J :K :fire :water :grass :electric :psychic :ice :dragon]
814 : ([0 :normal] [1 :fighting] [2 :flying] [3 :poison] [4 :ground] [5 :rock] [6 :bird] [7 :bug] [8 :ghost] [9 :A] [10 :B] [11 :C] [12 :D] [13 :E] [14 :F] [15 :G] [16 :H] [17 :I] [18 :J] [19 :K] [20 :fire] [21 :water] [22 :grass] [23 :electric] [24 :psychic] [25 :ice] [26 :dragon]) 961 : ([0 :normal] [1 :fighting] [2 :flying] [3 :poison] [4 :ground] [5 :rock] [6 :bird] [7 :bug] [8 :ghost] [9 :A] [10 :B] [11 :C] [12 :D] [13 :E] [14 :F] [15 :G] [16 :H] [17 :I] [18 :J] [19 :K] [20 :fire] [21 :water] [22 :grass] [23 :electric] [24 :psychic] [25 :ice] [26 :dragon])
815 : 962 :
816 : (0 5 5 0 8 0 8 8 20 20 7 20 20 5 5) 963 : (21 20 20 20 22 20 20 25 20 22 21 20 23 21 20)
817 : ((0 5 5) (0 8 0) (8 8 20) (20 7 20) (20 5 5)) 964 : ((21 20 20) (20 22 20) (20 25 20) (22 21 20) (23 21 20))
818 : ((0 5 0.5) (0 8 0.0) (8 8 2.0) (20 7 2.0) (20 5 0.5)) 965 : ((21 20 2.0) (20 22 2.0) (20 25 2.0) (22 21 2.0) (23 21 2.0))
819 : ([:normal :rock 0.5] [:normal :ghost 0.0] [:ghost :ghost 2.0] [:fire :bug 2.0] [:fire :rock 0.5]) 966 : ([:water :fire 2.0] [:fire :grass 2.0] [:fire :ice 2.0] [:grass :water 2.0] [:electric :water 2.0])
820 967
821 968
822 *** 969 ***
823 970
824 #+name: type-advantage 971 #+name: type-advantage
836 (fn [[atk def mult]] [(get pkmn-types atk (hex atk)) 983 (fn [[atk def mult]] [(get pkmn-types atk (hex atk))
837 (get pkmn-types def (hex def)) 984 (get pkmn-types def (hex def))
838 (/ mult 10)]) 985 (/ mult 10)])
839 (partition 3 986 (partition 3
840 (take-while (partial not= 0xFF) 987 (take-while (partial not= 0xFF)
841 (drop 0x3E62D rom)))))) 988 (drop 0x3E5FA rom))))))
842 #+end_src 989 #+end_src
990
843 991
844 992
845 993
846 * Moves 994 * Moves
847 ** Names of moves 995 ** Names of moves
1108 1256
1109 ** Wild Pok\eacute{}mon demographics 1257 ** Wild Pok\eacute{}mon demographics
1110 #+name: wilds 1258 #+name: wilds
1111 #+begin_src clojure 1259 #+begin_src clojure
1112 1260
1113 1261 ;; 0x0489, relative to 0xCB95, points to 0xCD89.
1114
1115 (defn hxc-ptrs-wild 1262 (defn hxc-ptrs-wild
1116 "A list of the hardcoded wild encounter data in memory. Pointers 1263 "A list of the hardcoded wild encounter data in memory. Pointers
1117 begin at ROM@0CB95; data begins at ROM@0x04D89" 1264 begin at ROM@0CB95; data begins at ROM@0x0CD89"
1118 ([] (hxc-ptrs-wild com.aurellem.gb.gb-driver/original-rom)) 1265 ([] (hxc-ptrs-wild com.aurellem.gb.gb-driver/original-rom))
1119 ([rom] 1266 ([rom]
1120 (let [ptrs 1267 (let [ptrs
1121 (map (fn [[a b]] (+ a (* 0x100 b))) 1268 (map (fn [[a b]] (+ a (* 0x100 b)))
1122 (take-while (partial not= (list 0xFF 0xFF)) 1269 (take-while (partial not= (list 0xFF 0xFF))
1125 1272
1126 1273
1127 1274
1128 (defn hxc-wilds 1275 (defn hxc-wilds
1129 "A list of the hardcoded wild encounter data in memory. Pointers 1276 "A list of the hardcoded wild encounter data in memory. Pointers
1130 begin at ROM@0CB95; data begins at ROM@0x04D89" 1277 begin at ROM@0CB95; data begins at ROM@0x0CD89"
1131 ([] (hxc-wilds com.aurellem.gb.gb-driver/original-rom)) 1278 ([] (hxc-wilds com.aurellem.gb.gb-driver/original-rom))
1132 ([rom] 1279 ([rom]
1133 (let [pokenames (zipmap (range) (hxc-pokenames rom))] 1280 (let [pokenames (zipmap (range) (hxc-pokenames rom))]
1134 (map 1281 (map
1135 (partial map (fn [[a b]] {:species (pokenames (dec b)) :level 1282 (partial map
1136 a})) 1283 (fn [[a b]]
1137 (partition 10 1284 {:species (pokenames (dec b))
1138 1285 :level a}))
1139 (take-while (comp (partial not= 1) 1286 (partition 10
1140 first) 1287 (take-while
1141 (partition 2 1288 (comp (partial not= 1) first)
1142 (drop 0xCD8C rom)) 1289 (partition 2
1290 (drop 0xCD8C rom))
1143 1291
1144 )))))) 1292 ))))))
1145 1293
1146 #+end_src 1294 #+end_src
1147 1295
1263 | 03E59- | Start of the Give-Pok\eacute{}mon script. | Assembly. When called, converts the contents of register BC into a Pok\eacute{}mon: (B) is the level; (C) is the species. | | 1411 | 03E59- | Start of the Give-Pok\eacute{}mon script. | Assembly. When called, converts the contents of register BC into a Pok\eacute{}mon: (B) is the level; (C) is the species. | |
1264 | 03E3F- | Start of the give-item script. | Assembly. When called, converts the contents of register BC into an item: (B) is the item type; (C) is the quantity. | | 1412 | 03E3F- | Start of the give-item script. | Assembly. When called, converts the contents of register BC into an item: (B) is the item type; (C) is the quantity. | |
1265 | 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. | 1413 | 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. |
1266 | 04524-04527 | (unconfirmed) possibly the bike price in Cerulean. | | | 1414 | 04524-04527 | (unconfirmed) possibly the bike price in Cerulean. | | |
1267 | 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#... | 1415 | 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#... |
1268 | 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). |
1269 |-----------------------+-----------------+-----------------+-----------------| 1416 |-----------------------+-----------------+-----------------+-----------------|
1270 | 05DD2-05DF2 | Menu text for player info. | | PLAYER [newline] BADGES [nelwine] POK\Eacute{}DEX [newline] TIME [0x50] | 1417 | 05DD2-05DF2 | Menu text for player info. | | PLAYER [newline] BADGES [nelwine] POK\Eacute{}DEX [newline] TIME [0x50] |
1271 | 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. | 1418 | 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. |
1272 | 06698- | ? Background music. | | | 1419 | 06698- | ? Background music. | | |
1273 |-----------------------+-----------------+-----------------+-----------------| 1420 |-----------------------+-----------------+-----------------+-----------------|
1275 | 7570-757D | Menu options for trading Pok\eacute{}mon | | TRADE [newline] CANCEL [0x50] | 1422 | 7570-757D | Menu options for trading Pok\eacute{}mon | | TRADE [newline] CANCEL [0x50] |
1276 | 757D-758A | Menu options for healing Pok\eacute{}mon | | HEAL [newline] CANCEL [0x50] | 1423 | 757D-758A | Menu options for healing Pok\eacute{}mon | | HEAL [newline] CANCEL [0x50] |
1277 | 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] | 1424 | 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] |
1278 | 7AF0-8000 | (empty space) | | 0 0 0 0 0 ... | 1425 | 7AF0-8000 | (empty space) | | 0 0 0 0 0 ... |
1279 | 0822E-082F? | Pointers to background music, part I. | | | 1426 | 0822E-082F? | Pointers to background music, part I. | | |
1280 | 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). | 1427 | 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 relative to this memory bank, i.e. absolute address 0xCD89, the location of the first list of wild Pok\eacute{}mon. (For details on pointer addresses, see the relevant appendix.) |
1428 | 0CD89- | Lists of wild Pok\eacute{}mon to encounter in each region. | Lists of 12 bytes. First, an encounter rate[fn::I suspect this is an amount out of 256.]. Next, ten alternating Pok\eacute{}mon/level pairs. Each list ends with 0x00. If the encounter rate is zero, the list ends immediately. | The first nonempty list (located at ROM@0CD8B) is (25; 3 36 4 36 2 165 3 165 2 36 3 36 5 36 4 165 6 36 7 36; 0), i.e. 25 encounter rate; 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, 0 (i.e., end-of-list). |
1281 |-----------------------+-----------------+-----------------+-----------------| 1429 |-----------------------+-----------------+-----------------+-----------------|
1282 | 0DACB. | Amount of HP restored by Soda Pop | The HP consists of a single numerical byte. | 60 | 1430 | 0DACB. | Amount of HP restored by Soda Pop | The HP consists of a single numerical byte. | 60 |
1283 | 0DACF. | Amount of HP restored by Lemonade | " | 80 | 1431 | 0DACF. | Amount of HP restored by Lemonade | " | 80 |
1284 | 0DAD5. | Amount of HP restored by Fresh Water | " | 50 | 1432 | 0DAD5. | Amount of HP restored by Fresh Water | " | 50 |
1285 | 0DADB. | Amount of HP restored by Hyper Potion. | " | 200 | 1433 | 0DADB. | Amount of HP restored by Hyper Potion. | " | 200 |
1321 | 39B05-39DD0. | unknown | | | 1469 | 39B05-39DD0. | unknown | | |
1322 | 39DD1-39E2E | Pointers to trainer Pok\eacute{}mon | Pairs of low-high bits. | The first pair is 0x2F 0x5E, which corresponds to memory location 5E2F relative to this 38000-3C000 bank, i.e.[fn::For details about how relative bank pointers work, see the relevant Appendix.] position 39E2F overall. | 1470 | 39DD1-39E2E | Pointers to trainer Pok\eacute{}mon | Pairs of low-high bits. | The first pair is 0x2F 0x5E, which corresponds to memory location 5E2F relative to this 38000-3C000 bank, i.e.[fn::For details about how relative bank pointers work, see the relevant Appendix.] position 39E2F overall. |
1323 | 39E2F-3A5B2 | Trainer Pok\eacute{}mon | Specially-formatted lists of various length, separated by 0x00. If the list starts with 0xFF, the rest of the list will alternate between levels and internal-ids. Otherwise, start of the list is the level of the whole team, and the rest of the list is internal-ids. | The first entry is (11 165 108 0), which means a level 11 team consisting of Rattata and Ekans. The entry for MISTY is (255 18 27 21 152 0), which means a team of various levels consisting of level 18 Staryu and level 21 Starmie. [fn::Incidentally, if you want to change your rival's starter Pok\eacute{}mon, it's enough just to change its species in all of your battles with him.].) | 1471 | 39E2F-3A5B2 | Trainer Pok\eacute{}mon | Specially-formatted lists of various length, separated by 0x00. If the list starts with 0xFF, the rest of the list will alternate between levels and internal-ids. Otherwise, start of the list is the level of the whole team, and the rest of the list is internal-ids. | The first entry is (11 165 108 0), which means a level 11 team consisting of Rattata and Ekans. The entry for MISTY is (255 18 27 21 152 0), which means a team of various levels consisting of level 18 Staryu and level 21 Starmie. [fn::Incidentally, if you want to change your rival's starter Pok\eacute{}mon, it's enough just to change its species in all of your battles with him.].) |
1324 | 3B1E5-3B361 | Pointers to evolution/learnset data. | One high-low byte pair for each of the 190 Pok\eacute{}mon in internal order. | | 1472 | 3B1E5-3B361 | Pointers to evolution/learnset data. | One high-low byte pair for each of the 190 Pok\eacute{}mon in internal order. | |
1325 |-----------------------+-----------------+-----------------+-----------------| 1473 |-----------------------+-----------------+-----------------+-----------------|
1326 | 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. | | 1474 | 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. | |
1327 | 3BBAA-3C000 | (empty) | | 0 0 0 0 ... | 1475 | 3BBAA-3C000 | (empty) | | 0 0 0 0 ... |
1328 |-----------------------+-----------------+-----------------+-----------------| 1476 |-----------------------+-----------------+-----------------+-----------------|
1329 | 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.]. | 1477 | 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.]. |
1330 | 3D6C7-3D6D6 | Two miscellaneous strings. | Variable length, separated by 0x50 | Disabled!#TYPE | 1478 | 3D6C7-3D6D6 | Two miscellaneous strings. | Variable length, separated by 0x50 | Disabled!#TYPE |
1331 | 3E190-3E194 | Which moves have an increased critical-hit ratio? | List of move ids, terminated by 0xFF. | (0x02 0x4B 0x98 0xA3 0xFF) corresponding to karate-chop, razor-leaf, crabhammer, slash, end-of-list. | 1479 | 3E190-3E194 | Which moves have an increased critical-hit ratio? | List of move ids, terminated by 0xFF. | (0x02 0x4B 0x98 0xA3 0xFF) corresponding to karate-chop, razor-leaf, crabhammer, slash, end-of-list. |
1332 | 3E200-3E204 | " (???) | " | " | 1480 | 3E200-3E204 | " (???) | " | " |
1333 | 3E231. | Besides normal-type, which type of move can COUNTER counter? | A single byte representing a type id. | This is set to 1, the id of the FIGHTING type. | 1481 | 3E231. | Besides normal-type, which type of move can COUNTER counter? | A single byte representing a type id. | This is set to 1, the id of the FIGHTING type. |
1482 | 3E5FA-3E6F0. | *Type effectiveness* | Triples of bytes: =atk-type=, =def-type=, =multiplier=. The multiplier is stored as 10x its actual value to allow for fractions; so, 20 means 2.0x effective, 5 means 0.5x effective. Unlisted type combinations have 1.0x effectiveness by default. | The first few entries are (21 20 20) (20 22 20) (20 25 20) (22 21 20) (23 21 20), corresponding to [:water :fire 2.0] [:fire :grass 2.0] [:fire :ice 2.0] |
1334 |-----------------------+-----------------+-----------------+-----------------| 1483 |-----------------------+-----------------+-----------------+-----------------|
1335 | 40252-4027B | Pok\eacute{}dex menu text | Variable-length strings separated by 0x50. | SEEN#OWN#CONTENTS#... | 1484 | 40252-4027B | Pok\eacute{}dex menu text | Variable-length strings separated by 0x50. | SEEN#OWN#CONTENTS#... |
1336 | 40370-40386 | Important constants for Pok\eacute{}dex entries | | HT _ _ *?′??″* [newline] WT _ _ _ *???* lb [0x50] *POK\Eacute{}* [0x50] | 1485 | 40370-40386 | Important constants for Pok\eacute{}dex entries | | HT _ _ *?′??″* [newline] WT _ _ _ *???* lb [0x50] *POK\Eacute{}* [0x50] |
1337 | 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). | 1486 | 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). |
1338 | 41072- | Pok\eacute{} placeholder species, "???" | | | 1487 | 41072- | Pok\eacute{} placeholder species, "???" | | |
1370 Locations where Give Pokemon is used in a nonstraightforward way 1519 Locations where Give Pokemon is used in a nonstraightforward way
1371 0x5287C 1520 0x5287C
1372 0x5CE23 1521 0x5CE23
1373 0x5C36B 1522 0x5C36B
1374 0x7562E 1523 0x7562E
1524
1525 Find GivePokemon
1526 (search-memory* (vec(rom)) [120 234 \_ \_ 121 234 \_ \_ 175 234 \_ \_ 6] 10)
1527
1528 F4011 : ASM script for asking if it's oak battle
1375 1529
1376 1530
1377 ** Understanding memory banks and pointers 1531 ** Understanding memory banks and pointers
1378 #+begin_src clojure 1532 #+begin_src clojure
1379 1533