Main Menu
Main Page
New pages
Recent changes
Random page

Arbitrary code execution
Pokémon cloning
Pomeg glitch and Glitzer Popping
Tweaking and voiding
Glitches by generation
Other glitch categories

Disassembly projects
The Big HEX List
Interactive tools
Reference documents

Legendary Star Blob 2 (Hakuda) (日本語/Japanese)
Pokémon Speedruns wiki (English)
PRAMA Initiative (Français/French)
MissingNo. Glitch City (Italiano/Italian)
Become an affiliate!

Site source code

Search Wiki


Search Forums


Author Topic: Hunting a "Gift Pokemon" Script in Pokémon Crystal  (Read 251 times)

0 Members and 1 Guest are viewing this topic.


  • GCLF Member
  • Offline Offline
  • Gender: Male
  • Amateur Glitcher & Code Delver
    • View Profile
Hunting a "Gift Pokemon" Script in Pokémon Crystal
« on: March 12, 2018, 10:33:35 pm »
After tinkering with Pokémon Yellow ACE, I was able to build a Pokémon Dispenser, that used the gift pokémon script at $3E59 to give me whichever Pokémon I was after at whatever level I was after. ( for anyone interested)

Now I've moved on to Pokémon Crystal, and I've been analyzing the ROM/RAM contents in and around the Eevee and Dratini gifts, looking for a similar gift script. I've tracked down where in memory the species and level of the gifts are loaded from, but I'm struggling to find where the code actually gives you the Pokémon.

At the end of the conversations that give you the gift, (Eevee and Dratini at least, the Shuckle seem's to do things differently), the code somehow manoeuvers its way to $7932 (in Bank 25)
$7932 contains "call 26D4". $26D4 has a series of instructions I haven't entirely deduced the purpose of, apart from a few, which notably include:
  • $26D9 loads register a with the value at $D439, which is the ROM bank containing the gift pokemon infomation (Bank 15 for Eevee, Bank 63 for Dratini)
  • $26DD loads register hl with the value at $D43A, which is the address containing the species of the gift pokemon (15:4C06 for Eevee, 63:51D7 for Dratini)
  • $26E3 loads that species value into register a
After returning from the call 26D4, the code continues at $7935, by putting species value currently stored in register a into RAM at $D108.
This is followed by another call 26D4, but this time the value returned in register a is the gift Pokémon's level, which is put into RAM at $D143.
A third call 26D4 retrieves the held item of the gift pokemon, putting it into RAM at $D106.

After all this, the pc is at 7944, the Pokémon's species, level and held item are all in RAM at D108, D143 and D106 respectively, but I lose track of things from there, and can't follow the thread to actually getting the Pokémon. I've almost given up hope of finding a simple script as there was in gen 1, but does anyone have any ideas about how to progress forward? (Or in this case, backward?) It's easy enough work forward through the code (I'm using the debugger on BGB to step through it line by line), but I'm struggling to find how the code reaches $7932 in the first place.

My next step is probably going to be manually setting D108, D143 and D106 and jumping to $7944, just to see what happens, but I thought I'd bring it up here and see if anyone else has been tinkering in this area of the code :)