’Cause all games were better on the GBC

You are not logged in.

#1 2017-10-12 03:18:32

New member
Registered: 2017-10-11
Post 1/2

Questions re: Crystal Hack


I'm new to rom hacking and want to give it a go by (slowly) working on editing Crystal. I've gotten started with the pokecrystal disassembly and have begun tinkering around in Crowdmap. I plan on digging through forums and trying to read/watch as many tutorials as I can to learn my way around the game, but I have a few questions I hope someone can answer initially. I noticed there's another thread from today asking some initial hacking questions, but I didn't one to hijack it - sorry if this is considered a re-post, and apologies if any of my questions are naive.

Is there a way to tell the limit on memory? Particularly in regards to maps - if I'm editing/creating maps, am I going to break the rom by going over on tiles?

What's a good way to test the game? If I compile it every time and have to start from the beginning of the game with a new save, testing later in the game will take forever.

Is it possible to make the pokedex longer, or do you stick with 251 and replace if you want different pokemon? If so, is there an efficient methods for editing all the calls to each pokemon in the game to the new name?

Are there any things in the game I *shouldn't* try to change?

Are there any useful tools for working with the disassembly? Or will it be primarily hex editing in Notepad? I've seen there are a lot of tools for editing the ROM itself, though I'm under the impression that you can't edit the ROM and then export the portions you need into the source code.

Thanks for the time anyone takes to answer.


#2 2017-10-12 04:56:34

Registered: 2016-05-09
Post 819/823

Re: Questions re: Crystal Hack

Welcome! Nice to see more people using the disassembly.

So, one of its advantages is that hex editing is almost entirely unnecessary. So are specialized tools. All the asm files are text files, you can edit them with Notepad++, Notepad2-mod, or your preferred editor. Graphics are png files, editable in, GraphicsGale, etc.

(There are a few binary files—notably the maps/*_collision.bin files, which specify how different tiles interact with sprites, and tilemaps like gfx/misc/johto.bin and gfx/misc/kanto.bin for the Town Maps. You'll need to hex edit them.)

The only special tools you really need are map editors. You've found crowdmap; I recently made Polished Map, which has its pros and cons to crowdmap. No reason you can't use both. ;)

Anyway, I'll assume you've gotten pokecrystal working and can build the unmodified gbc ROM with "make" in Cygwin. Might want to try editing some text, like in the text/stdtext.asm or maps/*.asm files, just to see that your changes really do show up in the game. If so, great!

My own testing method is to edit the script in maps/KrissHouse1F.asm where your Mom gives you the Pokégear. You can add all sorts of useful commands:

givepoke MEWTWO, 100
giveitem BICYCLE
givemoney $0, 999999 get the idea. You can study the other map scripts to see what the commands do, comparing the script's lines to what you see happening as you play the game. Or to learn the lower-level assembly instead of just the script commands, look at engine/scripting.asm to see how each command is implemented.

Regarding memory limits, you have a 2 MB ROM, and it's about 80% full. When you're more experienced, you can safely delete whole subsystems of the game—no need to keep the Mobile Adapter or GB Printer code, for instance. For now, you'll at least have to deal with banks. That 2 MB is divided into 128 banks, each with 16,384 bytes. The RAM can only store two banks at a time: bank 0 is always in RAM (that's why general-purpose often-used routines go in home.asm, which is located in bank 0), and then one other bank fits. Code that interacts with stuff outside its own bank has to do so in different ways than inter-bank stuff. (You'll notice that some places say "call SomeRoutine", others "callab SomeRoutine"—that callab is for is SomeRoutine is not in the current bank.)

The other problem with ROM banks is overflowing them. If you add too much in one bank, "make" will give an error about overflowing that bank. Then you have to make a new section for your extra content:

SECTION "New Section", ROMX
; content goes here...

Another major limitation of Gen 2: maximum 253 Pokémon. IDs are stored as one byte, which has 256 possible values, and three of them are special (Egg, end-of-list, and empty slot). Same goes for items and moves. I would recommend changing things manually: you could try and use a script to replace every instance of, say, "MARILL" with "PIKABLU", but it might replace more than you want ("AZUPIKABLU").

It might be hard to find broad tutorials for the disassembly, but if you run into any particular problems, check out the Help forum here. There might already be a topic that answers your question, or if not, go ahead and post it.

Edit: there's really nothing you "shouldn't" try to change. It just depends on how safe you feel changing things. If you really understand how the text-rendering system works, you could even replace that and get something like Prism's proportional text. (Prism has a lot of low-level improvements like that. The devs changed the sprite animation system to allow larger animations; they added if/else/endif scripting commands instead of jumping to labels spaghetti code-style; they optimized graphics-loading routines so you can do things like scroll through the Pokédex faster... it's all a matter of how much you're prepared to rewrite and debug.)

Last edited by Rangi (2017-10-12 05:00:20)

ROM hack: Pokémon Polished Crystal (GitHub) — version 2.2.0 released!


#3 2017-10-16 02:18:30

New member
Registered: 2017-10-11
Post 2/2

Re: Questions re: Crystal Hack

Thanks for this! I'm not sure I completely understand everything you're saying but commands in the map text file seem intuitive enough, as I can understand what they do just from reading them. Getting used to them so I can write them from my own memory will take some time.. It's a bit overwhelming but I think if I start with small things and learn how it all works I can work up to bigger things, and I'll poke around the forums as you suggest.


Board footer

Powered by FluxBB