Guides:Glitch Pokédex Mode ACE setup

From Glitch City Wiki
Jump to navigation Jump to search
This is a guide on how to execute and/or exploit a glitch. For a more technical overview of the glitch involved, see Glitch Pokédex Mode ACE.

This page serves as a repository for a Glitch Pokédex Mode ACE setup for the English, Italian and Spanish versions of Pokémon Gold & Silver. It is part of the TimoVM's Gen 2 ACE setups set of guides.

Please make sure to fully read every step of the guide before executing them.

If you encounter any issues when going through this guide or would like to provide feedback, please contact TimoVM on the Glitch City Research Institute Discord.

Setting up initial ACE

In the generation 2 games, the pokédex has three different modes that change the order of displayed pokémon within the pokédex. When selecting a certain mode, the game stores the value of the last selected mode in RAM, so that it will keep using this mode when you next use the pokédex. This valueis then used as part of a jump table, which returns the addresses of the functions used to determine the pokédex order.

By setting this value to an invalid pokédex mode value, the game will index this jumptable out of bounds. Some of these invalid values result in addresses that point to wram, resulting in arbitrary code execution. Since this value is in reach of the extended ball pocket, we can abuse an item swap to set such an invalid value.

By using the special properties of a $00 species pokémon, we are able to obtain duplicate key items which can then allow us to set up the extended ball pocket. One of the major components of previous ACE setups was the requirement of having to use the day care in order to obtain a $00 species pokémon. This guide introduces a setup that does not require the day care and can be set up in Violet City, once the player obtains the Togepi Egg.

In practice, the initial ACE setup will be created using the following general process:

  1. Obtain the necessary items and pokémon for the setup.
  2. Obtain a bad clone.
  3. Increase the happiness of the bad clone by 1, then create a hybrid between the Togepi egg and the bad clone.
  4. Hatch the bad clone egg to obtain a $00 species pokémon.
  5. Use the $00 species pokémon to obtain two mystery eggs and one fast ball, then use duplicate key items glitch to activate the extended ball pocket and set up glitch pokédex mode ACE.

Things you should know prior to starting the guide

This guide allows players to set up ACE from Violet City onward, right after obtaining the Togepi Egg. As a drawback, the player needs to perform two separate save corruptions, both of which have around between 1 frame of leeway. Alternative guides that are easier to perform are provided on the TimoVM's Gen 2 ACE setups page that can be executed once you reach Goldenrod City.

Requirements for this guide

When playing on original cartridge or on emulator, it is absolutely required to have used the Clear Save Data feature (press SELECT + UP + B on the title screen) or have replaced the battery at least once since owning the game.

  • Completing the setup requires having reached Violet City and obtaining the first gym badge.
  • Due to technical reasons, please ensure that the following is true for your trainer ID:
    • Your trainer ID must not be equal or higher than 65280.
    • The remainder after dividing your trainer ID by 256 must not be equal to 255.
  • If your trainer ID does not fulfill both requirements, you will not be able to finish this guide. If you do not wish to reset your save please use the alternative guide, provided on the TimoVM's Gen 2 ACE setup page, that can be executed once you reach Goldenrod City.

A note on the side effects of the method described below

The method described on this page requires fairly heavy abuse of glitches that will produce a number of side effects. All these side effects can be fixed with later applications of ACE and are never permanently harmful for the game in any way:

  • Obtaining duplicate key items requires obtaining a glitch pokémon that cannot be manually released.
  • Hatching a $00 species pokémon sets the seen/caught flags for an pokémon species that should not exist.
  • Duplicate key item swap glitch removes the CANCEL button from the key item pocket.
  • Buying or obtaining additional poké balls causes issues when done with an extended ball pocket.
  • Setting up glitch pokédex mode ACE disables the use of the PokéGear.

A code will be provided at the end of the guide that fixes all these issues in a single execution.

Step 1: Initial setup

When playing on original cartridge or on emulator, it is absolutely required to have used the Clear Save Data feature (press SELECT + UP + B on the title screen) at least once since owning the game.

Preparing the save

First, we're going to make sure to set up the save and collect all the requirements to perform the setup.

  • (optional) Hold SELECT + UP + B on the title screen to reset your save. After the save is cleared, start a new game.
  • Due to technical reasons, this guide can only be performed if the following are both true for your trainer ID:
    • Your trainer ID must not be equal or higher than 65280.
    • The remainder after dividing your trainer ID by 256 must not be equal to 255.
  • Any starter works, but Totodile is the fastest option and can be used to obtain a Flower Mail without needing a separate visit to the PokéMart.
  • Make sure to start the in-game clock during morning or midday.

Collecting the requirements

Next, we'll gather the required items and pokémon for the setup.

  • Do the following before reaching Violet City:
    • Catch one Sentret (Route 29, 40% to encounter only during morning and midday)
    • Catch one Bellsprout (route 31, 20% chance to encounter throughout the day)
  • Do the following after reaching Violet City:
    • Defeat the gym leader and obtain TM31 (mud-slap)
    • Obtain the Togepi egg
    • Within the ball pocket, make sure you only have two poké ball left.
    • (optional) Set the current pokédex mode to "OLD POKéDEX MODE". This adds a visual marker for a later item swap.

Step 2: Obtaining a $00 species pokémon

Using two instances of save corruption, we'll turn the starter into a $00 glitch pokémon.

Preparing the box

Before we can use save corruption with any degree of consistency, it is a good idea to fill up a box first. This will give us around 1 frame of leeway to perform save corruption.

  • Using normal cloning, put 15 pokémon in a box that has never been completely full at any point in the past.
    • Make sure you end up with at least 5 copies of Bellsprout.
    • For safety reasons, it is recommended you make additional clones of the starter pokémon, the Togepi egg and the Sentret.

Performing the first save corruption

Using save corruption, we're going to turn the starter into a bad clone of the starter using the following process:

  1. Deposit the starter to the current active box.
  2. Go to "Move pokémon w/o mail", you will get a prompt to save the game.
  3. Reset the game shortly after the "saving...” text is fully printed.
  4. If successful, upon restarting the game you will find a level 0 female version of the deposited pokémon with a blank name.

Please note that the timing of this is very strict (around 1 frame to obtain a bad clone).

  • If nothing was saved, the reset was too early. Next time, wait a little bit longer to reset.
  • If the pokémon was successfully cloned, the reset was too late. next time, reset a little bit earlier.
  • If the box ever gets to 19 pokémon in total, release pokémon from the box until there are only 15 pokémon present. Make sure to save normally after releasing them.

Use these guidelines and keep retrying until you've obtained a bad clone.

Preparing the bad clone for the second save corruption

Our aim is to hatch a $00 species. The bad clone gets us halfway there, but we need to adjust its happiness value so that it can hatch as soon as possible after hybridizing it to a bad clone egg.

  • Withdraw the bad clone, use TM31 to teach it mud-slap. This will increase its happiness value by exactly 1.
  • Deposit the bad clone back into the active box.
  • Deposit enough pokémon to completely fill the box, ensure that the bad clone is at the last position inside the box.
  • Withdraw the Togepi egg to your party.
  • Withdraw/release pokémon other than the bad clone from the box until 15 pokémon are left in the box. Ensure that the bad clone is always in the last position.

Performing the second save corruption

Using save corruption, we're going to obtain a bad clone of the Togepi egg. Thanks to filling the box entirely and putting the bad clone in the last position within the box, all the empty slots are now filled with leftover data of the bad clone. This allows us to create an egg containing the data of the bad clone.

  1. Deposit the Togepi Egg to the current active box.
  2. Go to "Move pokémon w/o mail", you will get a prompt to save the game.
  3. Reset the game shortly after the "saving...” text is fully printed.
  4. If successful, upon restarting the game you will find an egg with a blank name. In the summary, it will report that it is making sounds and is close to hatching.
  5. Withdraw the bad clone egg, then walk around until it hatches into a $00 species.

Please note that the timing of this is very strict (around 1 frame to obtain a bad clone egg).

  • If nothing was saved, the reset was too early. Next time, wait a little bit longer to reset.
  • If the pokémon was successfully cloned, the reset was too late. next time, reset a little bit earlier.
  • If the box ever gets to 20 pokémon in total, move the bad clone to the last slot, then release/move pokémon from the box (while keeping the bad clone in the last slot) until there are only 15 pokémon present. Make sure to save normally after releasing/moving them.

Step 3: Obtaining duplicate key items and setting up glitch pokédex mode ACE

Reminder: this method will only work if your trainer ID fulfills both of the following requirements:

  • Your trainer ID must not be equal or higher than 65280.
  • The remainder after dividing your trainer ID by 256 must not be equal to 255.

Collecting the required items and party

Have the following items in the ball pocket:

  • Slot 1: Poké Ball x2
  • Slot 2 and beyond: empty

Have the following items in the key item pocket:

  • All key items you've obtained in your save thus far (withdraw all key items, if any, that you previously stored from the PC)

Have the following pokémon in the party:

  1. $00 Species that was hatched from the bad clone egg
  2. Sentret
  3. Starter pokémon
  4. Bellsprout
  5. Bellsprout
  6. Bellsprout

Have the following pokémon in the box:

  1. Two Bellsprout
  2. Ine normal Pokémon.

Keep in mind that all these pokémon, with the exception of the normal pokémon, will be corrupted during this process. Please make sure to obtain copies of these pokémon using normal cloning if you wish to keep any of them.

Performing a party overload

Next, we're going to abuse the special properties of the $00 species pokémon to get over 6 pokémon simultaneously in the party.

  1. Using "move pokémon w/o mail", add a Bellsprout to the first party slot. This will push the glitch pokémon down to the second slot.
  2. Exit the PC, open the start menu and switch the glitch pokémon in the second slot with the Bellsprout in the fifth slot. Your party should be arranged as such:
    1. Bellsprout
    2. Bellsprout
    3. Sentret
    4. Starter pokémon
    5. $00 Species that was hatched from the bad clone egg
    6. Bellsprout
    7. Bellsprout
  3. Using "move pokémon w/o mail", add a second Bellsprout to last available party slot. This will result in a total of 8 party pokémon, both Bellsprouts and the Sentret now have a held item.
  4. Exit the PC, open the start menu. Retrieve the Mystery Eggs from the Bellsprouts, retrieve the Fast Ball from the Sentret.
  5. (optional) If you picked Totodile as a starter, it will now be holding a flower mail. Retrieve it and put it in the bag.
  6. Select "Deposit pokémon" from the PC and release the top three pokémon in your party.
  7. Withdraw the normal pokémon from your box using "Withdraw pokémon". This will restore the normal functionality of the party.

Setting up glitch pokédex mode ACE

  1. Arrange the Ball pocket as follows:
    1. Slot 1: Fast Ball x1
    2. Slot 2: Poké Ball x2
  2. Go to the KEY ITEM pocket. Swap the first MYSTERY EGG with the second MYSTERY EGG.
  3. Go to the BALL pocket, the FAST BALL has now changed into a MASTER BALL. THE POKé BALL has now changed into an ULTRA BALL. The game now believes you have a total of 161 item slots in the ball pocket, allowing you to scroll past the CANCEL button.
  4. Toss 96 Ultra Balls until you have only 159 Ultra Balls remaining. Swap the Ultra Ball with the item in the 65th item slot (this item slot can be easily recognized due to having a quantity of 1 if you've previously set "OLD POKéDEX MODE" in the POKéDEX).
  5. Go back to the start menu. Check if the PokéGear option has disappeared from the start list. If it has, you can now save the game.

This swap removes the PokéGear from the start list and will activate Glitch Pokédex Mode ACE. From this point onward, using the pokédex will trigger ACE from $EEEB onward, an address that is located two bytes before the last read mail.

Do NOT open the pokédex yet. Opening the pokédex right now will likely crash the game. We first need to set up a way to properly execute ACE in a controlled manner.

Setting up an ACE environment

We have successfully set up Glitch Pokédex Mode ACE, what now?

Using Glitch Pokédex Mode ACE works great for an initial setup, but there are a few drawbacks:

  • At this moment, we are not able to change the Pokédex Mode. This renders the Pokédex unusable for any other purpose than ACE.
  • While $EEEB is a very convenient entrance point, we still need to actually read a mail every time we want to execute ACE

Due to this, we're going to focus on building the setup in three ways:

  • Our aim is to switch from Glitch Pokédex Mode ACE to Wrong Pocket TM ACE. By putting a TM25 in a pocket other than the TM/HM pocket, we can simply use TM25 to execute ACE. TM25 will trigger ACE from address $DA6A onward, which corresponds to stat experience data of the 2nd party pokémon.
  • To help with making TM25 usable, we'll also modify the data of two pokémon so that they can be used with TM25. One pokémon will redirect execution to box names, while the other will redirect execution to the TM/HM pocket.
  • Finally, we're going to install a program, written using TM quantities, that allows us to easily write and execute any code we want. To do that, we're going to use ACE to obtain 255 copies of all TMs, then sell them in specific quantities to write out a program.

In summary, we will proceed as follows:

  • Prepare a mail and box name code that will add TM25, modify two pokémon so that they can be used with TM25 and set all TM quantities to 255.
  • Sell TMs in specific quantities in order to be able to run the Mail Writer
  • Use Wrong Pocket TM25 to run the Mail Writer and clean up the side-effects of the setup.

Step 4: Setting up the Mail Writer

For this part, it is recommended to catch any two pokémon and nickname them, you can use the Master Balls that are in the Ball pocket for this purpose. Give them the following nicknames:

  • "MAILWRITER"
  • "BOXCODES"
  • Arrange your party like this:
    1. Any
    2. Any
    3. MAILWRITER
    4. Any
    5. BOXCODES
    6. Glitch pokémon used in step 3
  • Finally, give any party pokémon a mail with the following language-dependent content to hold:
English Italian & Spanish


Setting up box names to set up TM25 and give 255 of every TM

For the English, Italian and Spanish versions of Gold & Silver, we'll set up TM25 and obtain 255 copies of every TM using a single execution. Write the following box name codes:

English Italian Spanish



Once this is done, make sure to save the game.

Step 5: Using Glitch Pokédex Mode ACE

Now that we have everything set up, we are going to use Glitch Pokédex Mode ACE to execute the box name code that we previously set up.

Executing the box name code

You can use Glitch Pokédex Mode ACE using the following process:

  • In case you have more than one Key Item, make sure that the Mystery Egg is located at the top of the key item pocket.
  • Read the held mail that was previously given to a party pokémon.
  • Open the start menu and open the pokédex. If the mail and box name codes were written correctly, this will immediately open and automatically close the pokédex.

If the code crashes, check the following:

  • Are the box name codes (or mail) correct?
  • In the 65th slot of the Ball pocket, is the item quantity equal to 159?

Effect of the mail and box name code

The code that we used was fairly complicated and has a couple of separate effects.

  • A TM25 was added to the Key Item pocket and has replaced the Mystery Egg that was previously there.
  • The MAILWRITER nicknamed pokémon has had its stat experience data changed. When put in the 2nd party slot, using TM25 will redirect execution to the TM/HM pocket.
  • The BOXCODES nicknamed pokémon has had its stat experience data changed. When put in the 2nd party slot, using TM25 will redirect execution to box names.
  • The TM/HM pocket has now been filled with 255 copies of every kind of TM.

Note: From this point onward, the MAILWRITER and BOXNAMES nicknamed pokémon must never gain experience in battle, or else they will no longer function correctly. They can, however, be safely deposited and withdrawn from the PC.

Step 6: Selling TMs to set up the Mail Writer

Now that we have obtained x255 of every TM, we'll be selling specific amounts of these in order to form a program. This program differs slightly depending on the specific language you're using.

The image belows displays the intended final quantities of all TMs, while the table in the next section displays how many TMs of each kind you need to end up with, along with the amount of money you gain by selling them.

Graphical overview

English Italian Spanish



Language-independent TMs

TM Final Quantity Sell value
TM01 DYNAMICPUNCH x17 357000
TM02 HEADBUTT x85 170000
TM03 CURSE x221 51000
TM04 ROLLOUT x213 42000
TM05 ROAR x213 21000
TM06 TOXIC x213 63000
TM07 ZAP CANNON x33 222000
TM08 ROCK SMASH SEE NEXT TABLE
TM09 PSYCH UP x98 78500
TM10 HIDDEN POWER x207 72000
TM11 SUNNY DAY x225 30000
TM12 SWEET SCENT x209 23000
TM13 SNORE x42 106500
TM14 BLIZZARD x254 1500
TM15 HYPER BEAM x80 262500
TM16 ICY WIND x56 298500
TM17 PROTECT x251 6000
TM18 RAIN DANCE x40 215000
TM19 GIGA DRAIN x10 367500
TM20 ENDURE x135 180000
TM21 FRUSTRATION x134 60500
TM22 SOLARBEAM x18 355500
TM23 IRON TAIL x19 354000
TM24 DRAGONBREATH x35 330000
TM25 THUNDER x129 126000
TM26 EARTHQUAKE x79 264000
TM27 RETURN x18 118500
TM28 DIG x24 231000
TM29 PSYCHIC x239 16000
TM30 SHADOW BALL x33 333000
TM31 MUD-SLAP x1 381000
TM32 DOUBLE TEAM x196 59000
TM33 ICE PUNCH x77 267000
TM34 SWAGGER x205 25000
TM35 SLEEP TALK SEE NEXT TABLE
TM36 SLUDGE BOMB x58 98500
TM37 SANDSTORM x27 228000
TM38 FIRE BLAST x205 50000
TM39 SWIFT SEE NEXT TABLE
TM40 DEFENSE CURL x55 100000
TM41 THUNDERPUNCH x189 99000
TM42 DREAM EATER x40 322500
TM43 DETECT x217 19000
TM44 REST x56 298500
TM45 ATTRACT x240 22500
TM46 THIEF x254 1500
TM47 STEEL WING x08 370500
TM48 FIRE PUNCH x200 82500
TM49 FURY CUTTER x24 346500
TM50 NIGHTMARE x242 13000

Language-dependent TMs

TM English Italian Spanish
Final amount Amount sold for Final amount Amount sold for Final amount Amount sold for
TM08 ROCK SMASH x66 94500 x118 68500 x153 51000
TM35 SLEEP TALK x239 8000 x222 16500 x162 46500
TM39 SWIFT x144 111000 x127 128000 x77 178000

Running the newly written program

  1. It is recommended to save before continuing.
  2. Put the pokémon that was nicknamed "MAILWRITER" into the 2nd party slot.
  3. Use TM25. If everything went correctly, this will start the mail writer and open a screen asking you to input text for a mail.
  4. From now on, you can repeat this process at any time to start the mail writer.
  5. The next section will elaborate on the usage of the Mail Writer. Please read these instructions carefully before proceeding.

If the game crashes, first recheck if all TM quantities are correct. If all quantities are correct, you may need to redo the setup for the "MAILWRITER" pokémon. This can be done using the box codes included a bit further below.

How the mail writer works

Upon execution, the Mail writer will open the mail character entry screen where the player can write up to 32 different characters. After the player has confirmed the mail, the following actions take place:

  • The Mail writer will take pairs of characters and convert them into a single combined value. These values are then sequentially written, converting the 32 letter mail into a 16 byte long line of code.
  • Next, the Mail writer will display a checksum calculated from the combined value of all written bytes for the player to verify. Then the program enters a waiting state where they can either choose to write another mail, go back and correct previously written values or stop the mail writer and execute the newly written payload.
  • If the player has chosen to write a new mail, the Mail writer will open a new mail entry screen. The new mail is then also converted into a 16 byte long line of code and placed right after the code written by the previous mail(s), allowing the player to write arbitrarily long payloads.
  • Assembly can easily be converted to mail codes using TimoVM's MailConverter. Simply paste the assembly of the code you wish to enter here, press "run" and the converter will automatically generate mail codes requiring the least amount of button presses to write.

Mail Writer Controls

Between entering mail codes, the mail writer will ask for user input.

  • Press A to open a new mail and continue writing data.
  • Press B to immediately jump to and start executing the newly written program. Only use this when you've finished every mail.
  • Press any other button to go back one byte at a time to correct errors. If the printed checksum doesn't match the expected checksum, press DOWN 16 times to retry the last mail. This will also overwrite the printed checksum with the value at the currently selected address, giving you a method to check how far back you're going.

Step 7: Using the Mail Writer to fix the side effects of the setup

Finally, we can both test the Mail Writer and fix the side effects of the setup. Please note that, for safety reasons, this cleanup code will not disable Glitch Pokédex Mode ACE. A second code will be provided that allows you to alter the current Pokédex Mode directly.

Simply copy the assembly code that is applicable for your setup, then click the link at the top of the table to go to the MailConverter tool. Make sure to select the current language and "Gold/Silver" as version.

Codes to be used with TimoVM's MailConverter
All languages
21 7A D6 2A 23 F6 84 22 AF 21 E1 D5 47 4E 09 23 
36 FF 2E FC 36 01 21 03 DC CB BE 2E 23 CB BE 21 
22 DA 4E 35 09 36 FF C9

The cleanup code has the following effects:

  1. Restore the previous PokéGear flags.
  2. Add a CANCEL button at the end of the key item list.
  3. Set the amount of items in the ball pocket to 1.
  4. Remove the seen/caught flags of the hatched $00 species.
  5. Remove the glitch pokémon at the end of the party.

Optional: Altering the current Pokédex Mode

This code will alter the current active Pokédex Mode. By default, it sets the Pokédex Mode to zero, making it possible to use the Pokédex normally again. By changing the value marked in bold, you can change the value that the Pokédex Mode will be set to. You can reactivate Mode 159, the Mode that executes from $EEEB onward, by changing the value in bold to $9F.

Code to be used with TimoVM's MailConverter
3E 00 EA 7E D6 C9

What to do with the Mail writer

The Mail writer allows you to easily write and execute arbitrary payloads. Aside from writing your own codes, we recommend the following:

  • Mail codes: this page contains a collection of assembly for mail codes that can be used for a variety of common purposes such as editing pokémon, obtaining items, etc..
  • RAM writer: (recommended for more experienced users) this page contains the assembly for a large one-size-fits all program that allows you to edit any value in RAM with a user-friendly GUI. It will also fix the side effects of the ACE setup when you first run it.

Addendum: repairing the "MAILWRITER" pokémon

In case something happens with the "MAILWRITER" nicknamed pokémon that causes it to no longer function, you can repair the pokémon without having to reset TM quantities using the following procedure:

  • Arrange the party as follows:
    1. Any
    2. "BOXCODES" pokémon
    3. "MAILWRITER" pokémon
    4. Any
    5. Any
    6. Any
  • Enter the following language-specific box name. Please mind the differences between uppercase X (), lowercase x () and multiplication symbol ().
English Italian & Spanish


  • Only if you'll execute this code using Glitch Pokédex Mode ACE, make sure to read the language-dependent mail that we previously wrote:
English Italian & Spanish


  • For the Italian and Spanish versions of these codes: as a side effect of using this set of codes, the first item in the Key item pocket will be mutated to a TM25. Make sure to put TM25 in the first slot to prevent accidentally losing important Key items.
  • Use TM25/open the pokédex to execute the code. If the game crashes, doublecheck the box name code and ensure you've performed every step of the process correctly
  • If the code executes succesfully, the "MAILWRITER" nicknamed pokémon has now been repaired.

Appendix

Plain text transcripts of codes

  • Glitch Pokédex mail
Language Mail Language Mail
English
T 'v N é 5 4 'v 7 é 4 4 'v é é 6 4
'v W ♀ h 's z 2 Pk p 0 - 1
Italian & Spanish
T ° N é 5 4 ° 7 é 4 4 ° é é 6 4
é Mn ♀ ° W ♀ Ù Á 2 Pk p 0 - 1
  • Setup box name code
Language Box names Language Box names Language Box names
English
Box 1: A p é 3 2 'v 9 5
Box 2: é 1 2 'v 'd é 6 2
Box 3: ? b é , 2 'v ♂ 5
Box 4: é 2 2 'v ? é 5 2
Box 5: ? E é 5 4 'v G 5
Box 6: é ♀ 2 é 7 4 0 9
Box 7: ♀ ♀ ♀ ♀ ♀ 's ♀ ♀
Box 8: ? 'm é 6 4 'v 4 5
Box 9: é Mn ♀ 'v - é 8 4
Box 10: 'v x é 4 4 'd
Italian
Box 1: A p é 3 2 ° 9 5
Box 2: é 1 2 ° 7 é ) 2
Box 3: ° G é ♀ 2 é ; 4
Box 4: È d é , 2 ° ♂ 5
Box 5: é 2 2 È 9 é 6 2 
Box 6: p ° P é 5 2 0 9 
Box 7: A ♀ ♀ ♀ ♀ ó 5 5
Box 8: p 0 ♀ é [ 4 ° x
Box 9: é ( 4 È F é : 4
Box 10: ì
Spanish
Box 1: A p é 3 2 ° 9 5
Box 2: é 1 2 ° 7 é ) 2
Box 3: ° G é ♀ 2 é ; 4
Box 4: È d é , 2 ° ♂ 5
Box 5: é 2 2 È 9 é 6 2 
Box 6: p ° Q é 5 2 0 9 
Box 7: A ♀ ♀ ♀ ♀ ó 5 5
Box 8: p 0 ♀ é [ 4 ° x
Box 9: é ( 4 È F é : 4
Box 10: ì
  • Reset box name code
Language Box names Language Box names
English
Box 1: A p 'v 6 é ) 4 5
Box 2: 'v G é ; 4 'v J 5
Box 3: é [ 4 'v x é ( 4 
Box 4: H 'v z é : 4 h 'd
Italian & Spanish
Box 1: p ° 6 é ) 4 ° G
Box 2: é ; 4 ° J é [ 4
Box 3: ° x é ( 4 H ° z
Box 4: é : 4 Í

In-depth explanation of the setup

Effect of the glitch pokédex mode

In the 2nd generation of Pokémon games, the Pokédex offers three different modes of sorting pokémon species (New, Old, A-Z). When the Pokédex is opened, the game checks which mode was last active, then launches a function to sort all species. Since the game needs to know which mode was last active, the last used Pokédex mode is stored in RAM at address $D67E.

By swapping an item stack using the extended Ball Pocket, we can directly overwrite the value for the last used mode. When the Pokédex is next opened, the game will read this value and attempt to launch an invalid sorting function depending on the value used, some of which will trigger ACE.

For the English, Italian and Spanish versions of Gold & Silver, mode 159 ($9F) will trigger ACE from $EEEB onward. This address is echo ram for $CEEB and lies two bytes in front of the last read mail. While these two bytes do have some use, their values will start out as empty after resetting the game.

When species $00 is registered to the Pokédex, opening the Pokédex after safely returning from ACE can result in regions of data (including map data) being overwritten with $D1 values. To prevent this issue from occuring, the codes included will ensure that we will be immediately forced to exit the pokédex once the code is executed.

Effect of the mail

The last read mail is buffered from $CEED onward. Converting the characters from the mail to assembly results in the following:

English

Mail

93		sub e		; a starts out as $EB, e starts out as $9F. a = $4C
D6 8D		sub $8D		; a = $BF
EA FB FA	ld ($FAFB), a
D6 FD		sub $FD		; a = $C2
EA FA FA	ld ($FAFA), a
D6 EA		sub $EA		; a = $D8
EA FC FA	ld ($FAFC), a
4E		ld c, (hl)
D6 96		sub $96		; a = $42
F5 		push af
A7 		and a		; Reset carry flag
D4 B9 F8	call nc, wBoxNames - 6h
E1 		pop hl		; h = $42
AF 		xor a		; a = $00
F6 E3 		or $E3		; a = $E3
F7		rst30h		; Jump to $10:42E3, final bytes of Pokedex_ReinitDexEntryScreen. This will set $CE63 to $FF, causing immediate exit of Pokédex after return

Bootstrap ($FAFA, 5th party pokémon's stat experience)

C2 BF D8	jr nz, wBoxNames

Italian & Spanish

Mail

93		sub e		; a starts out as $EB, e starts out as $9F. a = $4C
D6 8D		sub $8D		; a = $BF
EA FB FA	ld ($FAFB), a
D6 FD		sub $FD		; a = $C2
EA FA FA	ld ($FAFA), a
D6 EA		sub $EA		; a = $D8
EA FC FA	ld ($FAFC), a
4E		ld c, (hl)
EA E2 D5	ld (wKeyItems), a	; Change first item in key item pocket to TM25
D6 96		sub $96		; a = $42
F5 		push af
CD BF F8	call wBoxNames
E1 		pop hl		; h = $42
AF 		xor a		; a = $00
F6 E3 		or $E3		; a = $E3
F7		rst30h		; Jump to $10:42E3, final bytes of Pokedex_ReinitDexEntryScreen. This will set $CE63 to $FF, causing immediate exit of Pokédex after return

Bootstrap ($FAFA, 5th party pokémon's stat experience)

C2 BF D8	jr nz, wBoxNames

Effect of the setup box name code

Converting the characters from box names to assembly results in the following code. Please note that the box name code overwrites part of itself, the translated assembly assumes the code was already used once.

The code overwrites part of itself to call the byteFill function. This will fill the area between $D57E and $D5AF with $FF values, setting all 50 TM quantities to 255. Separately, this code overwrites the latter half of party pokémon #5's stat experience data, allowing it to function as a TM25 bootstrap that redirects execution to the Mail Writer.

English

Box 1: $D8BF
80		add a, b
AF		xor a		; a = $00
EA F9 F8	ld ($F8F9), a
D6 FF		sub $FF		; a = $01
FB		ei
50		ld d, b

Box 2: $D8C8
EA F7 F8	ld ($F8F7), a
D6 D0		sub $D0		; a = $31
EA FC F8	ld ($F8FC), a
50		ld d; b

Box 3: $D8D1
E6 A1		and $A1		; a = $21
EA F4 F8	ld ($F8F4), a
D6 EF		sub $EF		; a = $32
FB		ei
50		ld d, b

Box 4: D8DA
EA F8 F8	ld ($F8F8), a
D6 E6		sub $E6		; a = $4C
EA FB F8	ld ($F8FB), a
50		ld d, b

Box 5: $D8E3
E6 84		and $84		; a = $04
EA FB FA	ld ($FAFB), a
D6 86		sub $86		; a = $7E
FB		ei
50		ld d, b

Box 6: $D8EC
EA F5 F8	ld ($F8F5), a
EA FD FA	ld ($FAFD), a
F6 FF		or $FF		; a = $FF, reset carry flag
21

Box 7: $D8F5
   7E F5	ld hl, wTMsHMs
01 32 00	ld bc, $0032
D4 4C 31	call nc, byteFill
50		ld d, b

Box 8: $D8FE
E6 D2		and $D2		; a = $D2
EA FC FA	ld ($FAFC), a
D6 FA		sub $FA 	; a = $D8, TM25's item ID
FB		ei
50		ld d, b

Box 9: $D907
EA E2 F5	ld (wKeyItems), a	; Key item pocket, first item ID
D6 E3		sub $E3		; a = $F5
EA FE FA	ld ($FAFE), a
50		ld d, b

Box 10: $D910
D6 B7		sub $B7		; a = 3E, reset carry flag
EA FA FA	ld ($FAFA), a
D0		ret nc
50		ld d, b

Party pokémon #5's stat experience, starting from $DAFA
3E 04		ld a, $04
D2 7E F5	jp nc, wTMsHMS	; Carry and zero flag are both reset when using TM25

Italian

Box 1: $D8BF
80		add a, b
AF		xor a		; a = $00
EA F9 F8	ld ($F8F9), a
D6 FF		sub $FF		; a = $01
FB		ei
50		ld d, b

Box 2: $D8C8
EA F7 F8	ld ($F8F7), a
D6 FD		sub $FD		; a = $04
EA 9B FA	ld ($FA 9B), a
50		ld d; b

Box 3: $D8D1
D6 86		sub $86		; a = $7E
EA F5 F8	ld ($F8F5), a
EA 9D FA	ld ($FA9D), a
50		ld d, b

Box 4: $D8DA
C6 A3		add $A3		; a = $21
EA F4 F8	ld ($F8F4), a
D6 EF		sub $EF		; a = $32
FB		ei
50		ld d, b

Box 5: $D8E3
EA F8 F8	ld ($F8F8), a
C6 FF		add $FF		; a = $31
EA FC F8	ld ($F8FC), a
50		ld d, b

Box 6: $D8EC
AF		xor a		; a = $00
D6 8F		suc $8F		; a = $71
EA FB F8	ld ($F8FB), a
F6 FF		or $FF		; a = $FF
21

Box 7: $D8F5
   7E F5	ld hl, wTMsHMs
01 32 00	ld bc, $0032
D4 71 31	call nc, byteFill
50		ld d, b

Box 8: $D8FE
AF		xor a		; a = $00
F6 F5		or $F5		; a = $F5
EA 9E FA	ld ($FA9E)
D6 B7		sub $B7		; a = $3E
50		ld d, b

Box 9: $D907
EA 9A FA	ld ($FA9A), a
C6 85		add $85		; a = $C3, reset carry flag
EA 9A FA	ld ($FA9C), a
50		ld d, b

Box 10: $D910
D0		ret c
50		ld d, b

Party pokémon #3's stat experience, starting from $DA9A
3E 04		ld a, $04
C3 7E F5	jp wTMsHMs

Spanish

Box 1: $D8BF
80		add a, b
AF		xor a		; a = $00
EA F9 F8	ld ($F8F9), a
D6 FF		sub $FF		; a = $01
FB		ei
50		ld d, b

Box 2: $D8C8
EA F7 F8	ld ($F8F7), a
D6 FD		sub $FD		; a = $04
EA 9B FA	ld ($FA9B), a
50		ld d; b

Box 3: $D8D1
D6 86		sub $86		; a = $7E
EA F5 F8	ld ($F8F5), a
EA 9D FA	ld ($FA9D), a
50		ld d, b

Box 4: $D8DA
C6 A3		add $A3		; a = $21
EA F4 F8	ld ($F8F4), a
D6 EF		sub $EF		; a = $32
FB		ei
50		ld d, b

Box 5: $D8E3
EA F8 F8	ld ($F8F8), a
C6 FF		add $FF		; a = $31
EA FC F8	ld ($F8FC), a
50		ld d, b

Box 6: $D8EC
AF		xor a		; a = $00
D6 90		suc $90		; a = $70
EA FB F8	ld ($F8FB), a
F6 FF		or $FF		; a = $FF
21

Box 7: $D8F5
   7E F5	ld hl, wTMsHms
01 32 00	ld bc, $0032
D4 70 31	call nc, byteFill
50		ld d, b

Box 8: $D8FE
AF		xor a		; a = $00
F6 F5		or $F5		; a = $F5
EA 9E FA	ld ($FA9E)
D6 B7		sub $B7		; a = $3E
50		ld d, b

Box 9: $D907
EA 9A FA	ld ($FA9A), a
C6 85		add $85		; a = $C3, reset carry flag
EA 9A FA	ld ($FA9C), a
50		ld d, b

Box 10: $D910
D0		ret c
50		ld d, b

Party pokémon #3's stat experience, starting from $DA9A
3E 04		ld a, $04
C3 7E F5	jp wTMsHMs

Effect of the TM code

Converting the TM quantities to assembly results in the following code. Please note that this code requires a value of $04 in register a in order to properly work.

English

11 55 DD	ld de, $DD55
D5		push de
D5		push de		; .nextMail
D5		push de
21 42 62	ld hl, _ComposeMailMessage
CF		rst08h, FarCall a:hl
E1		pop hl
D1		pop de
2A		ldi a, (hl)	; .continue
FE 50		cp $50
38 FB		jr c, .continue
28 0A		jr z, .terminator
87		add a, a
86		add a, (hl)
12		ld (de), a
13		inc de
23		inc hl
81		add a, c
4F		ld c, a
12		ld (de), a
18 EF		jr .continue
21 01 C4	ld hl, $C401	; .screenLoop
4D		ld c, l
CD EF 3A	call PrintBCDNumber.loop - 1
1B		dec de		; .goBack
CD 90 37	call JoyTextDelay_ForcehJoyDown
BD		cp a, l		; l = $04
28 D9		jr z, .nextMail
38 F0		jr c, .displayLoop
FE 08		cp $08
C8		ret z
18 F2		jr .goBack

Italian

11 55 DD	ld de, $DD55
D5		push de
D5		push de		; .nextMail
D5		push de
21 76 62	ld hl, _ComposeMailMessage
CF		rst08h, FarCall a:hl
E1		pop hl
D1		pop de
2A		ldi a, (hl)	; .continue
FE 50		cp $50
38 FB		jr c, .continue
28 0A		jr z, .terminator
87		add a, a
86		add a, (hl)
12		ld (de), a
13		inc de
23		inc hl
81		add a, c
4F		ld c, a
12		ld (de), a
18 EF		jr .continue
21 01 C4	ld hl, $C401	; .screenLoop
4D		ld c, l
CD DE 3A	call PrintBCDNumber.loop
1B		dec de		; .goBack
CD 7F 37	call JoyTextDelay_ForcehJoyDown
BD		cp a, l		; l = $04
28 D9		jr z, .nextMail
38 F0		jr c, .displayLoop
FE 08		cp $08
C8		ret z
18 F2		jr .goBack

Spanish

11 55 DD	ld de, $DD55
D5		push de
D5		push de		; .nextMail
D5		push de
21 99 62	ld hl, _ComposeMailMessage
CF		rst08h, FarCall a:hl
E1		pop hl
D1		pop de
2A		ldi a, (hl)	; .continue
FE 50		cp $50
38 FB		jr c, .continue
28 0A		jr z, .terminator
87		add a, a
86		add a, (hl)
12		ld (de), a
13		inc de
23		inc hl
81		add a, c
4F		ld c, a
12		ld (de), a
18 EF		jr .continue
21 01 C4	ld hl, $C401	; .screenLoop
4D		ld c, l
CD A2 3A	call PrintBCDNumber.loop - 1
1B		dec de		; .goBack
CD 4D 37	call JoyTextDelay_ForcehJoyDown
BD		cp a, l		; l = $04
28 D9		jr z, .nextMail
38 F0		jr c, .displayLoop
FE 08		cp $08
C8		ret z
18 F2		jr .goBack

Effect of the side effect-fixing code

When using the Mail Writer, the assembly from this code is directly written and executed as follows:

21 7A D6	ld hl, $D67A	; Address where the original pokégear flags have been displaced to
2A		ldi a, (hl)
23		inc hl
F6 84		or $84		; Ensures that minimal pokégears are restored if $D67A is empty
22		ldi (hl), a
AF		xor a		; a = $00
21 E1 D5	ld wNumKeyItems	; Current amount of key items in key item pocket
47		ld b, a		; b = $00
4E		ld c, (hl)	; Set c to amount of key items
09		add hl, bc
23 		inc hl
36 FF		ld (hl), $FF	; Restore cancel button to key item pocket
2E FC		ld l, $FC	; hl targets wNumBalls
36 01		ld (hl), $01	; Set current amount of balls in ball pocket to 1
21 03 DC	ld hl, $DC03	; Address containing $00's caught flag
CB BE		res 7, (hl)	; Remove $00's caught flag
2E 23		ld l, $23	; hl targets address containing $00's seen flag
CB BE		res 7, (hl)	; Remove $00's seen flag
21 22 DA	ld hl, wPartyCount
4E		ld a, (hl)
35		dec (hl)	; Remove last party pokémon
09		add hl, bc
36 FF		ld (hl), $FF	; Re-add proper terminator to party list
C9		ret

Effect of the pokédex mode-altering code

When using the Mail Writer, the assembly from this code is directly written and executed as follows:

3E XX		ld a, $XX
EA 7E D6	ld (wLastDexMode), a
C9		ret

Effect of the reset box name code

Converting the characters from box names to assembly results in the following code. This code overwrites the latter half of party pokémon #3's stat experience data, allowing it to function as a TM25 bootstrap that redirects execution to the Mail Writer.

English

Box 1: $D8BF
80		add a, b
AF		xor a		; a = $00
D6 FC		sub $FC		; a = $04
EA 9B FA	ld ($FA9B), a
FB		ei
50		ld d, b

Box 2: $D8C8
D6 86		sub $86		; a = $7E
EA 9D FA	ld ($FA9B), a
D6 89		sub $89		; a = $F5
FB		ei
50		ld d; b

Box 3: $D8D1
EA 9E FA	ld ($FA9E), a
D6 B7		sub $D7		; a = $3E
EA 9A FA	ld ($FA9A), a
50		ld d, b

Box 4: D8DA
87		add a, a
D6 B9		sub $B9		; a = $C3
EA 9C FA	ld ($FA9C), a
A7		and a		; Reset carry flag
D0		ret nc
50		ld d, b

Party pokémon #3's stat experience, starting from $DA9A
3E 04		ld a, $04
C3 7E F5	jp wTMsHMs	; Carry and zero flag are both reset when using TM25

Italian & Spanish

Box 1: $D8BF
AF		xor a		; a = $00
D6 FC		sub $FC		; a = $04
EA 9B FA	ld ($FA9B), a
D6 86		sub $86		; a = $7E
50		ld d, b

Box 2: $D8C8
EA 9D FA	ld ($FA9B), a
D6 89		sub $89		; a = $F5
EA 9E FA	ld ($FA9E), a
50		ld d; b

Box 3: $D8D1
D6 B7		sub $D7		; a = $3E
EA 9A FA	ld ($FA9A), a
87		add a, a	; a = $7C
D6 B9		sub $B9		; a = $C3
50		ld d, b

Box 4: $D8DA

EA 9C FA	ld ($FA9C), a
C9		ret
50		ld d, b

Party pokémon #3's stat experience, starting from $DA9A
3E 04		ld a, $04
C3 7E F5	jp wTMsHMs