Chances are if you are in any Mario 64 related Discord, you’ve seen the news- Decomp is on GitHub and available for public usage. But what is decomp? What does it actually do?

When programs are written, it is typically done in a high-level language like “C”, which is typically very legible to a human (if documented/labeled/named well). Machines can not read this code, however, as they only understand very basic instructions like “add these two values together” or “skip forward if this value is zero”. To turn our nice C code into something a machine can understand, we run it through a “compiler”. A compiler is a computer program that takes that C code and makes it into equivalent machine code so that it can be run by the machine. This machine code is what is present in a game cartridge or ROM, like Mario 64’s.

Programming directly in machine code is usually much more difficult than programming in a language like C for a variety of reasons. For one, C compilers strip out all function, variable, and file names, as well as comments; machines don’t need those to run the code, so they would take up unnecessary space. The code often points to hard-coded locations (called addresses), so shifting a ROM by inserting or removing lines of code would break the entire program. To prevent this, code must be removed to insert new code in its place, making additions often come at the cost of subtractions from the ROM. The machine code is also not meant to be legible by humans, so things are usually less clear than normal even with knowledge of the machine code. It can take a significant amount of work to understand long functions in machine code.

“Decomp” or the SM64 Decompilation attempts to go backward from the machine code to the original code by decompiling it, turning the machine code to C. This can restore the code to a state similar to the original and very generally allow things that would otherwise be very difficult or impossible with just the machine coded ROM. The SM64 decomp is special in that it is also “matching”- many decompilation projects simply aim for code that does the same thing as the original, but this project actually generates the exact same ROM using the original compiler Nintendo used. This goal ensures that the new code doesn’t have any logic mistakes caused by improper interpretation of the compiled code.

With the understanding of decomp, what can we really do? What limitations does it have? Some of the most common questions/points are answered here.

If you want to find out more about decomp, you can join the Discord here or check out the GitHub here. Hopefully this article gives you a start to understanding decomp and perhaps even working with decomp.

In other news