changeset 421:13165fb5852b

Found assembly scripts for GiveItem and GivePokemon.
author Dylan Holmes <ocsenave@gmail.com>
date Sat, 14 Apr 2012 12:24:00 -0500
parents acc3d1ad24e8
children b58a356f7cc2
files org/rom.org
diffstat 1 files changed, 50 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/org/rom.org	Sat Apr 14 09:27:49 2012 -0500
     1.2 +++ b/org/rom.org	Sat Apr 14 12:24:00 2012 -0500
     1.3 @@ -1260,6 +1260,8 @@
     1.4  | 01823-0184A           | Important prefix strings. | Variable-length strings, separated by 0x50. | TM#TRAINER#PC#ROCKET#POK\eacute{}#... |
     1.5  | 0233C-                | Shop inventories. |                 |                 |
     1.6  | 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. |
     1.7 +| 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. |                 |
     1.8 +| 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. |                 |
     1.9  | 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. |
    1.10  | 04524-04527           | (unconfirmed) possibly the bike price in Cerulean. |                 |                 |
    1.11  | 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#... |
    1.12 @@ -1268,6 +1270,7 @@
    1.13  | 05DD2-05DF2           | Menu text for player info. |                 | PLAYER [newline] BADGES [nelwine] POK\Eacute{}DEX [newline] TIME [0x50] |
    1.14  | 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. |
    1.15  | 06698-                | ? Background music. |                 |                 |
    1.16 +|-----------------------+-----------------+-----------------+-----------------|
    1.17  | 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] |
    1.18  | 7570-757D             | Menu options for trading Pok\eacute{}mon |                 | TRADE [newline] CANCEL [0x50] |
    1.19  | 757D-758A             | Menu options for healing Pok\eacute{}mon |                 | HEAL [newline] CANCEL [0x50] |
    1.20 @@ -1285,7 +1288,7 @@
    1.21  |-----------------------+-----------------+-----------------+-----------------|
    1.22  | 0DD4D-DD72            | Names of permanent stats. | Variable-length strings separated by 0x50. | #HEALTH#ATTACK#DEFENSE#SPEED#SPECIAL# |
    1.23  |-----------------------+-----------------+-----------------+-----------------|
    1.24 -| 0DE2F.                | Duration of Repel. | A single byte, representing the number of steps you can take before Super Repel wears off. | 100             |
    1.25 +| 0DE2F.                | Duration of Repel. | A single byte, representing the number of steps you can take before the effect wears off. | 100             |
    1.26  | 0DF39.                | Duration of Super Repel. | "               | 200             |
    1.27  | 0DF3E.                | Duration of Max Repel. | "               | 250             |
    1.28  |-----------------------+-----------------+-----------------+-----------------|
    1.29 @@ -1294,8 +1297,16 @@
    1.30  | 11852-                | Terminology for current stats in the Pok\eacute{}mon menu. | Contiguous, variable-length strings. | EXP POINTS[newline]LEVEL UP[0x50] |
    1.31  | 1195C-1196A           | The two terms for being able/unable to learn a TM/HM. | Variable-length strings separated by 0x50. | ABLE#NOT ABLE#  |
    1.32  | 119C0-119CE           | The two terms for being able/unable to evolve using the current stone. | Variable-length strings separated by 0x50. | ABLE#NOT ABLE#  |
    1.33 +|-----------------------+-----------------+-----------------+-----------------|
    1.34 +| 11D53.                | Which badge is a prerequisite for CUT? | op code: which bit of A to test? | When this script is called, the bits of A contain your badges, and this op code will check a certain bit of A. The op codes for the badges are, in order, [0x47 0x4F 0x57 0x5F 0x67 0x6F 0x77 0x7F]. |
    1.35 +| 11D67.                | Which badge is a prerequisite for SURF? | "               | 0x67 (test for Soul Badge) |
    1.36 +| 11DAC.                | Which badge is a prerequisite for STRENGTH? | "               | 0x5F (test for Rainbow Badge) |
    1.37 +|-----------------------+-----------------+-----------------+-----------------|
    1.38  | 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), ... |
    1.39  |-----------------------+-----------------+-----------------+-----------------|
    1.40 +| 1CF8B-1CF8C           | Which Pok\eacute{}mon does Melanie give you in Cerulean City? | A level/internal-id pair. | (10 153), corresponding to a level 10 Bulbasaur. |
    1.41 +| 1D651-1D652           | Which Pok\eacute{}mon do you find at the top of Celadon Mansion? | A level/internal-id pair. | (25 102), corresponding to a level 25 Eevee. |
    1.42 +|-----------------------+-----------------+-----------------+-----------------|
    1.43  | 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. |
    1.44  | 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"). |
    1.45  | 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#... |
    1.46 @@ -1317,6 +1328,9 @@
    1.47  |-----------------------+-----------------+-----------------+-----------------|
    1.48  | 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.]. |
    1.49  | 3D6C7-3D6D6           | Two miscellaneous strings. | Variable length, separated by 0x50 | Disabled!#TYPE  |
    1.50 +| 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. |
    1.51 +| 3E200-3E204           | " (???)         | "               | "               |
    1.52 +| 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. |
    1.53  |-----------------------+-----------------+-----------------+-----------------|
    1.54  | 40252-4027B           | Pok\eacute{}dex menu text | Variable-length strings separated by 0x50. | SEEN#OWN#CONTENTS#... |
    1.55  | 40370-40386           | Important constants for Pok\eacute{}dex entries |                 | HT _ _ *?′??″* [newline] WT _ _ _ *???* lb [0x50] *POK\Eacute{}* [0x50] |
    1.56 @@ -1327,6 +1341,9 @@
    1.57  |-----------------------+-----------------+-----------------+-----------------|
    1.58  | 509B4-509E0           | Saffron City's adjacency info. | Four adjacency lists, each 11 bytes long. (For more info on adjacency lists a.k.a. connection data, see [[http://datacrystal.romhacking.net/wiki/Pokemon_Red/Blue:Notes][here]]) | The first adjacency list is (0x10 0x70 0x46 0xF0 0xC6 0x0A 0x0A 0x23 0xF6 0x09 0xC8) |
    1.59  |-----------------------+-----------------+-----------------+-----------------|
    1.60 +| 515AE-515AF           | Which Pok\eacute{}mon does the trainer near Route 25 give you? | A level/internal-id pair. | (10 176) corresponding to a level 10 Charmander. |
    1.61 +| 51DD5-51DD6           | Which Pok\eacute{}mon does the Silph Co. trainer give you? | A level/internal-id pair. | (15 19) corresponding to a level 15 Lapras. |
    1.62 +|-----------------------+-----------------+-----------------+-----------------|
    1.63  | 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 |
    1.64  | 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]... |
    1.65  |-----------------------+-----------------+-----------------+-----------------|
    1.66 @@ -1344,8 +1361,18 @@
    1.67  | 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♂#... |
    1.68  |-----------------------+-----------------+-----------------+-----------------|
    1.69  | E9BD5-                | The text PLAY TIME (see above, 70442) |                 |                 |
    1.70 +| F1A44-F1A45           | Which Pok\eacute{}mon does Officer Jenny give you? | A level/internal-id pair. | (10 177), corresponding to a level 10 Squirtle. |
    1.71 +| F21BF-F21C0           | Which Pok\eacute{}mon does the salesman at the Mt. Moon Pok\eacute{}mon center give you? | A level/internal-id pair | (5 133), corresponding to a level 5 Magikarp. |
    1.72 +|                       |                 |                 |                 |
    1.73     #+TBLFM: 
    1.74  
    1.75 +** COMMENT
    1.76 +Locations where Give Pokemon is used in a nonstraightforward way
    1.77 +0x5287C
    1.78 +0x5CE23
    1.79 +0x5C36B
    1.80 +0x7562E
    1.81 +
    1.82  
    1.83  ** Understanding  memory banks and pointers
    1.84  #+begin_src clojure
    1.85 @@ -2209,7 +2236,28 @@
    1.86                 index-next
    1.87                 start-match
    1.88                 (rest to-match)
    1.89 -               matches))))))))
    1.90 +               matches)))
    1.91 +
    1.92 +          :else
    1.93 +          (if (= k v)
    1.94 +            (recur
    1.95 +             binds
    1.96 +             (inc index)
    1.97 +             index-next
    1.98 +             start-match
    1.99 +             (rest to-match)
   1.100 +             matches)
   1.101 +            (recur
   1.102 +             {}
   1.103 +             index-next
   1.104 +             (inc index-next)
   1.105 +             index-next
   1.106 +             ptn
   1.107 +             matches))
   1.108 +
   1.109 +
   1.110 +
   1.111 +)))))
   1.112               
   1.113  
   1.114