Main Menu
Main Page
Recent changes
Random page


Major Glitches
Trainer escape glitch
Old man trick
Celebi trick
Select glitches (Japan)
SRAM glitch
CoolTrainer♀ corruption
LOL glitch
Rival LOL glitch
Super Glitch
ZZAZZ glitch
Pomeg corruption glitch (Glitzer Popping)
Elite Four door glitch (Japan)
Pokémon merge glitch
Pokémon cloning
Time Capsule exploit
Arbitrary code execution
Coin Case glitch

Other Glitch Categories
Glitches by generation
Glitches between two generations
Japan-only/language specific glitches
Music glitches
Natural glitches
Non-core series glitches
Non-Pokémon glitches
Officially acknowledged glitches
Recurring glitches
Dead glitches

Pokémon GameShark codes
The Big HEX List
GB programming
Debugging features
Easter eggs
Error traps
Glitch areas
Glitch myths
Non-glitch exploits
Placeholder texts
Pokémon glitch terminology
Unused content and prerelease information

Useful Tools
8F Helper
GBz80 to Items
Old man trick name generator
PATH (Prama's Advanced Tweaking Heaven)
Save file editors
Special stat/Pokémon converter
Trainer escape Trainer Pokémon finder

Legendary Star Blob 2 (Hakuda)
Pokémon Speedruns wiki
PRAMA Initiative
Become an affiliate!

Search Wiki


Search Forums


Author Topic: PKMN R/B - ACE: How to Exec code from ram?  (Read 148 times)

0 Members and 1 Guest are viewing this topic.


  • GCLF Member
  • Offline Offline
  • CHARIZRAD 'M ROXORX or is it.
    • View Profile
PKMN R/B - ACE: How to Exec code from ram?
« on: April 12, 2017, 09:37:04 am »
Hi, I am new to the pokemon glitching scene, I have been playing pkm r/b since it first came out, and started glitching for the past few years. I am familiar with the item underflow, trainer fly, and other glitches. What really interests me is arbitrary code execution. My plan is to, using 8F to bootstrap my game on console, and be able to write a code similar to the one where TheZZAZZGlitch used pokemon r/b/y to load super mario, pokemon crystal, etc, but have it execute things back into the same cartridge, for example: code it to reset the game, then I can start a new game in pokemon r/b with that code running so when I start the new game, I will have a certain setup right off the bat. For instance: having item 8F right from pallet town, having items, badges, 151 pokemon, being able to item underflow, or even possibly creating some sort of GUI or entry into the start menu that can be accessed to edit memory addresses that are out of reach of the item underflow glitch, all from the get go. I haven't seen anyone do this yet so I'm hoping there is someone out there who could direct me on how to accomplish this. I get the gyst of how to bootstrap, but I am not familiar with the ASM code so I have no idea how to start this project? Any and all help will be super appreciated  ;D


  • ACE trainer
  • GCLF Member
  • Offline Offline
    • View Profile
Re: PKMN R/B - ACE: How to Exec code from ram?
« Reply #1 on: April 12, 2017, 12:02:12 pm »
If this is your first time using ACE, I'd recommend first try out some of the small scripts in the main thread, such as getting any item or any pokémon, and try to understand how they work. The dissasembly might help with understanding too.

Then you could start trying to make your own scripts, whenever you think of something that might be useful, using the Big Hex List and ISSOtm's compiler to help.

If you're unsure of anything, try it in an emulator first - especially for things that might have a chance to crash and corrupt the save file and/or things that take a long time to set up.

If your main goal is cartswapping, you can try a basic cartswap script at this point, that would soft reset into the swapped cart without any additional custom code.

Once you feel you have enough experience with ACE, you can start something more ambitious, like Offgao's memory editor, which I  programmed into my game using a slightly modified version of ZZAZZ's route 1 bike method - It's a GUI memory editor.

Then, it should be possible to write a program that allows a cartswap into another game, then copy the memory editor + any other set up you want (like putting an 8F in the bag, bootstrap in your party, etc) into the save file before jumping into the initialisation routine. 

In theory it should be possible to patch up the initialisation script, like ZZAZZ for super mario, and skip over the part that clears HRAM, allowing custom code to be injected into the title screen, which would also give you control over starting a new save file as well as just continuing - which would allow you to do the stuff you want such as having access to 8F and the GUI memeditor from the start.
« Last Edit: April 12, 2017, 12:03:07 pm by jfb1337 »


  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Wiki Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: PKMN R/B - ACE: How to Exec code from ram?
« Reply #2 on: April 13, 2017, 03:45:52 am »
What you need first, and it is essential, is solid knowledge of assembly.
The Game Boy's processor is similar to the z80, so I recommend reading ASM in 28 Days (a Day in this tutorial is simply a lesson, not a full day :P) to learn the z80 assembly. The tutorial is for TI 8X+ calculators, so there are some things there that don't matter for Game Boy stuff, but read it all, it'll make you practice.

Once you have good knowledge of z80 assembly, read the Pan Docs to get the basics of the GB's internals.

And then get familiar with Gen I's engine, and you can start coding !
"THOU SHALL NOT PASS !!"  RIVAL's effect, Gandalf.

Proudly glitching Pokémon Red and Yellow on a Black & White GB, Pocket GB, GB Color, GBA SP and new 3DS.

My Twitter (beware, I'm French)
My YouTube (same warning)

Here is an online tool to build 8F setups : GBz80 to Items !

They see me layzin', they ha-tin'...
Heavy contributor of the global augmentation of entropy (my room's is too damn high !)