DQpkTdAV4AAlF0D.jpg

Nintendo N64 - Homebrew starting guide

I’m documenting my N64 development here.
This is the start of my journey with the Nintendo N64, so here’s a bit of my background with it.
I’ve never had one!
To be honest, I don’t think I’ve even played one!

But as of 9th of December 2017, I bought a ‘cheap’ N64 on ebay for $160AUD.
I put in a low bid, thinking I would be out bid and oh well, I guess I’m committed now!

Original NINTENDO 64 PAL console in original box with instruction booklet and all original plastic bags, chord and controller.
Extras include authentic expansion pack, extra controller, 2 rumble packs and jumper pack.
Excellent condition.
All original and authentic.

My next purchase will be the 64drive.
Expensive, but not that bad for a N64 ‘development kit’ ;)


I’m not using Nintendo’s & SN’s proprietary development software/hardware.
It would be the easiest and fastest way to develop on as it’s a complete system with a visual debugger!

I respect Nintendo’s & SN software rights and I don’t want to get into any legal trouble.
I also believe, the owner of the hardware can do what they like with it, ie program it and play homebrew games!
Besides, it’s more interesting!

So, after working on the PS1, why switch to the Nintendo N64?
I’m looking at Nintendo N64 game development because:

Unfortunately, there are a few negatives:

  • Only very few emulators work at a hardware level and are very slow, see below.
  • And to be expected, open source libraries aren’t fully developed, ie very limited 3D.

So, let’s get started!


The toolchain

https://dragonminded.com/n64dev/
Most likely the popular choice, it has a nice and easy install script.

Read their 2 pages, download it and read the readme installations.
There’s a my install notes:

sudo su #must be root
apt-get install libmpc-dev libmpfr-dev libmpfr4 # my extra libs required

#where path is where you want it installed
export PATH=$PATH:"path/mips64-elf/bin"
export N64_INST="path/mips64-elf"

# in the root of libdragon directory
mkdir build
cp tools/build build
cd build
chmod 777 build
./build

cd .. # back to the root of libdragon directory 
make # build the libraries with newly built toolchain

It’s not hard, but I couldn’t get it to build, gcc error on my hacky 64bit linux mint 18.1.
There’s a win32 build on their site, the toolchain doesn’t really matter that much, it doesn’t need updating, you rebuild the new libraries with it.
But using linux, the only linux prebuilt toolchain I could find was from the VM here and just copied out.

There’s also this toolchain using crosstool-ng, but I haven’t tried it.

The libraries

Next, after installing a working toolchain, we need a good libraries as in the script above.
Libdragon, isn’t regularly updated, but this fork is.
To build the library type make in the root of the library directory, I copy across the .a and headers manually.

N64chain, apart from having a toolchain install script (which actually worked for me! I had to copy the header file from libdragon to libn64/header.bin ).
N64chain also has a library which is also regularly updated and focused on 3D support!

DIY

A few people build there own libraries, like:


Emulation

Firstly, you’ll need to find these rom files: pifdata.bin normpnt.rom normslp.rom

Cen64
It sole purpose is to be hardware accurate emulation of Nintendo 64!
Cen64, is pretty easy to compile, install and setup.

I use this a shortcut alias to run emulator easily:
alias cen=’path/cen64/cen64 path/cen64/pifdata.bin ‘ # ie, cen test.z64

Mame
Mame, is a popular emulator of arcade machines, computers and consoles.
It also works with homebrew N64 games but it’s not as reliable as cen64.
and has a built in assembly debugger!

Mame, in linux for n64 was a pain for me to set up!
Follow this guide to install mame on linux.
Make sure the default paths have .mame and not just mame!
The three files should be zipped up in a file called n64.zip and place in the roms folder.

These are my alias’
alias mamedebug=’mame n64 -verbose -window -debug -cart ‘
alias namerun=’mame n64 -verbose -window -cart ‘

To run it:
mame n64 -verbose -debug -cart path/rom.n64

DQuDTm3U8AEh0dq.jpg


At this stage, I’m just reading info and playing around with the toolchains’ and libraries’ examples, running on emulation!

13th Dec, Update
I ported my Net Yaroze, Commodore 64 intro to the Nintendo 64!

DQ7EDtVUQAA7zDf.jpg
DQ7EDssUQAA6uXI.jpg
DQ7EDtRU8AEysG6.jpg


Links

Guides:
A good intro into assembly and Peter Lemon’s library
Install mame on linux

Info:
Online N64 programmer’s manuals
Hardware info
Docs and info
http://n64dev.org - more info
http://n64.icequake.net - more info
Official N64 developer’s documentation or https://level42.ca/p … man/start/index.html
http://en64.shoutwiki.com/wiki/Noob_Portal - Hacking/dev info
http://hcs64.com/
Good info

3D triangle info
How To Triangle
https://github.com/PeterLemon/N64/tree/master/RDP/16BPP/Triangle/Cube/FillTriangle320×240

Social/Help
chat on IRC: enter a unique name and channel: #n64dev
Assemblergames’ Nintendo game development forum
#N64Dev on twitter
https://www.reddit.com/r/N64Homebrew/