How to compile a Nintendo 64 ROM
Once you have gone through the steps for creating a Nintendo 64 development environment, you can continue with this step. You’re going to need to go through a few steps in order to compile Nintendo 64 ROMs.
Find a project to compile
First thing you need to do is find a project that you want to compile. Let’s start by going to C:\nintendo\n64kit\nusys\sample\nu0.
Optional: If you want to be safe, copy the nu0 folder into another directory and work from that location. I like to put mine in a dropbox shared folder so that the ROM gets sent to my main computer.
Create a batch file
Next you’re going to need a batch file to run the ‘make’ command. Open up Notepad and type in the following code into it:
set ROOT=c:\ultra set gccdir=c:\ultra\gcc set PATH=c:\ultra\gcc\mipse\bin;c:\ultra\usr\sbin;%path% set gccsw=-mips3 -mgp32 -mfp32 -funsigned-char -D_LANGUAGE_C -D_ULTRA64 -D__EXTENSIONS__ set n64align=on set GCC_CELF=ON cd c:\Documents and Settings\Administrator\My Documents\Dropbox\nu0 make
Change the directory on the line that starts with cd
to match the folder of the project you want to compile!
Save this file into the root of your C:\ drive and call it whatever you want, but for the purposes of this tutorial we’ll be calling it make.bat
.
What this does is that it all the set
commands set the environment of that command prompt to behave as GNU/Linux, then cd
changes the directory and make
runs the Makefile.
Alternate option: CLI
If you prefer a command line interface, you can instead add all the variables in the batch file above into environmental variables like we did in the IDE page. Then just cd
into the folder you want and run make
.
Run the batch file
Now that everything is all set, it’s time to run the batch file! This part is really simple.
Go to Start > Run and type in cmd
to get the command prompt running. Next you need to run the batch file that you just made, do this by typing this into the command prompt:
c:\make.bat
If that doesn’t work, you can also try double-clicking the .bat file.
This will create a bunch of gibberish on the command prompt but it should finish after a few seconds.
N64 Compilation results
And that’s it! Have a look at the project folder and you’ll find a whole bunch of new files in there. You’ll see that there several .o files, one .out file and one .n64 file.The .o files are the object files ie. compiled C files. The .out file is the GCC executable file output. You can ignore or delete these if you wish.
The .n64 file is the actual ROM that you can run on your emulator or on a flash cart. When you load it on either one, you’ll get a CIC Chip error, but if you ignore it the ROM should work anyway after clicking away from the window.
And that’s it!
Notes
If you already have output files (.o) and/or a rom (.n64) in the folder, you will get an error saying Make.out: Nothing to be done for 'default'
. To fix this, move/delete those files from the folder to allow them to recompile.