n64

module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2025 License: BSD-3-Clause

README

Go on Nintendo 64

Develop applications for the Nintendo 64 in pure Go. Builds upon embeddedgo, which adds a minimal rtos to the runtime via GOOS=noos.

Prerequisites

  • Go
  • Git
  • ares emulator (optional)

Getting Started

  1. Install the embeddedgo toolchain:
    go install github.com/embeddedgo/dl/go1.24.4-embedded@latest
    go1.24.4-embedded download
  1. Install n64go:
    go install github.com/clktmr/n64/tools/n64go@latest

This tool helps managing n64 file formats. It's also hooked into the go command via the -toolexec flag to provide generation of z64 and uf2 ROM files.

  1. Setup your build environment. Copy go.env from this repository to your desired location and make use of it:
    export GOENV="path/to/go.env"

Alternatively you can of course use your preferred way of managing environment variables.

You can now use go build and go run as usual! Try it with the minimal hello world example:

package main

import _ "github.com/clktmr/n64/machine"

func main() {
	println("hello world!")
}

Differences from mainline Go

machine

Your application needs to import github.com/clktmr/n64/machine at some point, which provides basic system setup. Otherwise your build will fail with a linker error.

fmt and log

Per default fmt.Print() and log.Print() write to os.Stdout, which isn't set after boot. Use embedded/rtos.Mount() and github.com/embeddedgo/fs/termfs to place an io.Writer at that location.

os and net

Having no operating system has obvious consequences for the os package. There are neither processes nor any network stack in the kernel. While os/exec is not supported, networking applications can run if an implementation of the Conn or Listener interface is passed to them.

embed

While embed can be used, it will load all embedded files into RAM at boot. As an alternative github.com/clktmr/n64/drivers/cartfs provides a fs.FS implementation to read embedded files from the cartridge via DMA instead.

testing

The go test command does currently not work reliably for several reasons:

  • The build might fail because of missing machine import
  • The tests might fail if they try to access testdata directory

This will probably be solved in the future. In the meantime fall back to providing a TestMain for each package that should run tests on the Nintendo 64. Package github.com/clktmr/n64/testing provides a reusable TestMain implementation for that purpose.

cgo

cgo is not supported!

Directories

Path Synopsis
Package debug provides assertions that can be enabled with the debug build tag or will otherwise compile to no-ops.
Package debug provides assertions that can be enabled with the debug build tag or will otherwise compile to no-ops.
Package drivers and it's subdirectories build upon github.com/clktmr/n64/rcp to provide common interfaces and higher-level features.
Package drivers and it's subdirectories build upon github.com/clktmr/n64/rcp to provide common interfaces and higher-level features.
cartfs
Package cartfs wraps an embed.FS and stores it on the cartridge.
Package cartfs wraps an embed.FS and stores it on the cartridge.
carts
Package carts provides probing for various n64 flashcarts.
Package carts provides probing for various n64 flashcarts.
carts/everdrive64
Package everdrive64 implements support for EverDrive64.
Package everdrive64 implements support for EverDrive64.
carts/isviewer
Package isviewer provides a logging via an ISViewer devices.
Package isviewer provides a logging via an ISViewer devices.
carts/summercart64
Package summercart64 implements support for SummerCart64.
Package summercart64 implements support for SummerCart64.
controller
Package controller implements helpers for reading the states of the gamepads and their pak accessories.
Package controller implements helpers for reading the states of the gamepads and their pak accessories.
controller/pakfs
Package pakfs implements access the Controller Pak's filesystem.
Package pakfs implements access the Controller Pak's filesystem.
display
Package display provides video output by managing framebuffers and video DAC behind the scenes.
Package display provides video output by managing framebuffers and video DAC behind the scenes.
draw
Package draw provides hardware accelerated implementations of draw.Drawer.
Package draw provides hardware accelerated implementations of draw.Drawer.
rspq
Package rspq provides loading RSP microcodes developed for libdragon.
Package rspq provides loading RSP microcodes developed for libdragon.
Package fonts implements loading of fonts optimized for Nintendo 64.
Package fonts implements loading of fonts optimized for Nintendo 64.
basicfont12
basicfont 12
basicfont 12
gomono12
Go Mono 12
Go Mono 12
goregular12
Go Regular 12
Go Regular 12
Package machine implements some target specific functions of the runtime and provides access to the bootloader.
Package machine implements some target specific functions of the runtime and provides access to the bootloader.
rcp
The rcp package provides an hardware abstraction layer for the Nintendo 64.
The rcp package provides an hardware abstraction layer for the Nintendo 64.
audio
Package audio provides analog audio output from a buffer.
Package audio provides analog audio output from a buffer.
cpu
Package cpu provides helpers to share memory between the CPU and other hardware components.
Package cpu provides helpers to share memory between the CPU and other hardware components.
fixed
Package fixed provides fixed-point arithmetic types used by the RCP.
Package fixed provides fixed-point arithmetic types used by the RCP.
periph
Package periph provides IO and DMA on the PI bus.
Package periph provides IO and DMA on the PI bus.
rdp
Package rdp provides writing commands to the display processor.
Package rdp provides writing commands to the display processor.
rsp
Package rsp provides loading and running microcode on the signal processor.
Package rsp provides loading and running microcode on the signal processor.
serial
Package serial provides running commands on the PIF microchip.
Package serial provides running commands on the PIF microchip.
serial/joybus
Package joybus contains functions for creating and parsing of joybus messages as they are represented in the n64 PIF, which adds a 2-byte header to each message.
Package joybus contains functions for creating and parsing of joybus messages as they are represented in the n64 PIF, which adds a 2-byte header to each message.
texture
Package texture provides image types used by the rcp, e.g.
Package texture provides image types used by the rcp, e.g.
video
Package video provides configuration of the analog video output.
Package video provides configuration of the analog video output.
Package testing provides utilities for writing n64 specific tests.
Package testing provides utilities for writing n64 specific tests.
tools
n64go command
n64go bundles all commands into a single executable.
n64go bundles all commands into a single executable.
rom
toolexec
toolexec is invocated with go build's -toolexec flag.
toolexec is invocated with go build's -toolexec flag.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL