Guides:Coin Case ACE

From Glitch City Wiki
Revision as of 12:08, 29 October 2023 by TimoVM (talk | contribs)
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 Coin Case glitch.

This page serves as a repository for a Coin Case ACE setup for the English 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 Glitch City Research Institute Discord.

General overview

When using the Coin Case while a Bellsprout/Machop's cry and specific newly loaded tiles are buffered in memory, the game will execute code in various places before finally ending up in the $FA98-$FA9B range, which is echo ram containing the stat exp data of party pokémon #3.

Using specific stat exp values, we can form a jump to $CF00, which is located in the latter half of last read mail. This gives us barely enough space to fix the side effects of using the Coin Case and jump to the start of box names.

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

  1. Train a pokémon by exclusively defeating a set of specific encounters within Union Cave and route 33
  2. Obtain the Coin Case
  3. Give the trained pokémon a mail with specific content

Step 1: preparing a pokémon that can be used with the Coin Case

  1. Either on route 32 or route 33, catch a pokémon that is (preferably) at least lvl 6 and not a Hoppip. Give it a specific nickname, such as "BOXCODES" to remember that it will be used as part of a Coin Case ACE setup that executes box name codes.
  2. Have it fight the following pokémon and defeat them solo (order doesn't matter, the pokémon must be the only pokémon to gain experience from the battle)
    • Rattata - Route 32 or Route 33
    • Hoppip - Route 32 or Route 33, higher spawn rate on route 33 compared to route 32
    • Hoppip - Route 32 or Route 33, higher spawn rate on route 33 compared to route 32
  3. Have it fight the following pokémon with the help of exactly one other pokémon (the experience must be shared between exactly two party pokémon)
    • Onix - Union Cave
  4. The "BOXCODES" nicknamed pokémon must never gain experience from any other battle

Step 2: Obtaining the items needed for the setup

  1. Buy a Flower Mail, can be bought in Goldenrod Dept. Store or the Violet City pokémart.
  2. Obtain the Coin Case by picking it up in the Goldenrod Underground.

Step 3: How to execute ACE using the Coin Case

Now that we have the Coin Case, we'll need to set up everything needed to actually safely use it. Using a specific setup, we can force the Coin Case to execute code starting from party pokémon #3's stat experience data. What we'd like to do is to redirect it such that box names get executed instead:

  • Prepare the party to ensure that code gets safely redirected to box names.
  • Prepare specific box names to run a simple test code.

Finishing the setup

  1. Arrange your party like the following:
    1. Any
    2. Any
    3. "BOXCODES" nicknamed Pokémon that has defeated a specific set of pokémon
    4. Any
    5. Any
    6. Any
  2. Finally, give the "BOXCODES" nicknamed pokémon a flower mail with the following language-specific content:

Preparing a test box name code

Rename the first box name to the following name. This box name code will be replaced later and is solely intended to verify if the setup is working correctly. Their only function is to safely exit ACE and return the game to normal:

Step 4: Using Coin Case ACE

In order to use ACE, always perform the following steps:

  • Ensure the "BOXCODES" nicknamed pokémon holding the mail is in party slot #3.
  • Go to any pokémon center and take the stairs up to the second floor. Save the game while you're still standing on the stairs and reset the game.
  • From the stair tile, take exactly 4 steps to the right1.
  • Open the start menu, open the pokédex, then listen to the cry of Bellsprout.
  • Go to the Pokémon menu and read the previously mentioned mail.
  • Open the item bag, switch item pockets at least once, then use the Coin Case. This will execute ACE.

Make sure to test the setup by going through this process once. With the current box name setups, you can verify that the setup is working by checking the TM/HM pocket. The quantity of TM03 should now be 255. You can now continue to the next guide.


If the test code crashes, check the following:

  • Did you correctly follow the previous steps?
  • Is the box name code correctly entered?
  • Is the content of the mail correct?
  • Did you ensure that the nicknamed pokémon only received experiences from the four specific encounters? Were both Hoppip and Rattata defeated using only the nicknamed pokémon? Was Onix defeated such that experience was shared between the nicknamed pokémon and only one other pokémon?
  • If you are sure you performed the above correctly, try to make sure you have 0 coins in total.

Anytime you wish to execute wrong pocket Coin Case ACE, you'll need to repeat the steps outlined at the beginning of this section. Always make sure the "BOXCODES" nicknamed pokémon is in party slot #3 and the held mail was read before using the Coin Case.

What to do with a Coin Case ACE setup

Now that the ACE setup has been succesfully tested, we can start expanding the setup to more easily write arbitrary data. This will be done by installing the Mail writer, a small program installed using a set of box name codes.

Use the following link to continue to the next guide: Mail writer GS

Appendix: in-depth explanation of the setup

Effect of the Coin Case

The effects of the Coin Case are described in more detail on the following wiki page. Relevant to this setup is that the setup will redirect execution to address $FA98 (echo ram copy of $DA98), which is in the middle of party pokémon #3's stat experience data. During this redirection, the stack pointer gets incremented once and an address gets popped from the stack. The global effect is that the stack pointer is decremented once compared to when the Coin Case was used.

Effect of party pokémon #3

Defeating the provided list of pokémon will result in the following values at the following addresses, assuming the pokémon is in party slot #3:

DA95	00	nop
DA96	75	ld [hl], l
DA97	00	nop
DA98	94	sub a, h
DA99	00	nop
DA9A	C3
DA9B	00
DA9C	CF	jp $CF00
DA9D	00	nop
DA9E	6E	ld l, [hl]

Executing Coin Case at the location described in the setup will cause execution to jump to $DA98. It will then harmlessly slide through the sub a, h and nop instructions, after which execution will jump to $CF00, which is in the middle of the last buffered mail.

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:

80		add a, b
80		add a, b
80		add a, b
80		add a, b
80		add a, b
80		add a, b
80		add a, b
80		add a, b
80		add a, b
80		add a, b
80		add a, b
80		add a, b
80		add a, b
80		add a, b
80		add a, b
80		add a, b
4E		ld c, (hl)	; Newline control character.
80		add a, b
80		add a, b
AF		xor a		; Located at $CF00, all values before this address are filler and will not be executed.
D6 FD		sub $FD		; Set a to $03.
E0 9F		ld (hRomBank), a; Set current ROM bank to bank 3. This ROM bank contains item and pack data and ensures safe return.
E8 FF		add sp, $FF	; $FF is interpreted as a singed integer, stack pointer gets decremented and the stack is now properly aligned again.
D1		pop de
D1		pop de
D1		pop de		; Pop text command related addresses so that returning from ACE execution will resume normal game operation.
AF		xor a		; Set a to $00, set carry flag to 0.
D2 B9 F8	jp nc, $F8B9	; Jump to echo ram copy of $D8B9, which lies a few bytes before box data.

Effect of the box name

Box name data starts from $D8BF onward. Converting the provided mail code to assembly results in the following:

F6 FF		or $FF		; Set a to $FF, set carry flag to 0.
EA 80 F5	ld (F580), a	; $F580 is an echo ram copy of $D580, which corresponds to TM03's quantity.
D0		ret nc		; Thanks to the preparatory work done by the mail, allow safe return to normal game operation.

Plain text transcripts of codes

  • Mail
A A A A A A A A A A A A A A A A
A A p 'v 7 ' ] . 9 'l 'l 'l p 'm z 2
  • Test box name
0 9 é A ♀ h 'd [SPACE]