Disassembling the code is easy, and computers are very good at it. What is difficult is to _label_ the original code, finding the meaning behind of function calls and memory manipulations.
Of course we can just read the disassembled sources in a text editor, understand what the assembly does, and label it accordingly. However this is a slow and difficult process–and, fortunately, there are tools to help us.
### Using BGB (for dynamic analysis)
The [BGB emulator](http://bgb.bircd.org/) is a really nice GameBoy emulator, with a nice and complete debugger. It can set breakpoints on code and on memory access, and help you track the execution of the code.
BGB is originally written for Windows, but it works also well on macOS and Linux using Wine.
Here is how to use BGB for reverse-engineering the game:
2. Open `game.gbc` in the [BGB emulator](http://bgb.bircd.org/).
3. Open the debugger, and jump to the `0000:0150` address. You'll see a function named `Start`. Notice how BGB knows the name of this function from the debug symbols.
4. You can now trace the execution of the code, set breakpoints, watchers, edit the memory, etc.
From there **the goal is to pick a function or a memory location, and understand what it does**, so that we can label it in the disassembled code. For this the process usually goes like this:
1. Pick a function instruction (for instance `call label_0A43`)
2. Understand what is does. For this you can either:
- read the assembly,
- set a breakpoint, to see when this function is called,
- see what memory location it reads or changes,
- observe the values changing in the memory viewer while the game runs,
- use the debugger to replace the function by a `nop`, and see what change occur in the game
[Awake](https://github.com/kemenaran/awake) is a static GameBoy assembly explorer, specially tuned for exploring ZeldaGB and ZeldaDX. It allows to identify functions, loops, and to jump easily from functions to function. It makes much easier to follow the flow of the code and data during the game.
The tool was initially developed by @devdri. @kemenaran is currently writing some improvement to this tools, so that it can read debug symbols (otherwise no functions are labelled), and label functions from within the explorer.
- [The Legend of Zelda Link's Awakening /DX Speedrunning Wiki](http://spiraster.x10host.com/LADXWiki/index.php/) : infos on wrong warps and map data format
- [Disassembling Link's Awakening](https://kemenaran.winosx.com/posts/category-disassembling-links-awakening/): a serie of blog posts and progress reports