Awesome
Modern n64sdk
This repo describes how to get the n64 sdk compiling on a modern OS (Linux, Windows, macOS).
Download the sdk.
Download the sdk and extract to a folder. We'll call this folder N64_SDK
.
Compile the GCC toolchain
Clone the n64chain repo found here: https://github.com/tj90241/n64chain.
Copy the tools
directory into another directory. We'll call this folder
N64_TOOLCHAIN
.
Run either the build-linux64-toolchain.sh
script for linux or mac. Run the
build-windows64-toolchain.sh
for windows. This'll take a while.
After running this command, make sure that N64_TOOLCHAIN
is on your path:
export PATH="$N64_TOOLCHAIN/bin:$PATH"
Set up additional tools
Download all of the latest versions of these tools, extract them, and place
them somewhere on your path ($N64_TOOLCHAIN/bin
for example):
Apply patches to n64sdk
The first file you'll need to modify is $N64_SDK/ultra/usr/include/make/PRdefs
.
Make the following modifications:
- Change
CC = gcc
toCC = mips64-elf-gcc
- Change
LD = ld
toLD = mips64-elf-ld
- Change
MAKEROM = mild
toMAKEROM = spicy
- Change
GCCFLAG
toGCCFLAG = -c -I$(INC) -D_MIPS_SZLONG=32 -D_MIPS_SZINT=32 -D_LANGUAGE_C -D_ULTRA64 -D__EXTENSIONS__ -mabi=32 -march=vr4300 -mtune=vr4300
For any demo you'd like to build, make the follow modifications:
FINAL = YES
is not commented out in theMakefile
- If running on unix (linux or osx):
- Download dos2unix.
- Run
dos2unix *.{h,c}
in the current directory.
Export the appropriate variables
Note that these will need to be set for every terminal you use to build.
<N64_SDK>
below should be substituted with the path where you extracted the
sdk. <N64_TOOLCHAIN>
should be substituted with the path where you built the
toolchain.
export ROOT=<N64_SDK>
export PATH=<N64_TOOLCHAIN>/bin:$PATH
export GCCDIR=$ROOT/ultra/GCC
Feedback
Note that both spicy
and makemask
are far from polished. Please open issues
on the appropriate tool and I'll try to investigate as soon as possible.
Useful commands
Disassembling code:
mips64-elf-objdump -b binary -m mips:4300 --start-address=0x40 --stop-address=0xB70 -D -EB letters.n64