Tool: boot - pseudophpt/pseultra GitHub Wiki

Tool: boot

boot contains the source for custom IPL3 bootcode, which can be used instead of Nintendo's copyrighted bootcode to keep your ROMs legal. The bootcode sets up various N64 related registers, and loads a specified boot segment to the ROM at 0x80001000 and jumps to it.

Installation

Simply configure the Makefile in pseultra/boot to your MIPS compiler, and make in the pseultra/boot directory.

Usage

Since the bootcode will not match the checksum of a normal ROM, when using the generated bootcode in the boot file, you will need to invoke the bootcsumr tool (See "Tool: bootcsum") to find a collision between the bootcode and the existing Nintendo bootcode. This may take days or weeks. However, at one point a pre-brute-forced bootcode should be available.

The bootcode looks at three specific values in the ROM header (first 0x40 bytes of the ROM) when executing:

  • 0x08 - 0x0C for an address in KSEG0 to branch to when booting (Usually this will be 0x80001000)
  • 0x10 - 0x14 for a ROM address describing the start of the boot segment
  • 0x14 - 0x18 for the length of the boot segment

The bootcode performs the following actions:

  • Restore all interrupt related registers, including the COP0 registers and the Cause register of the MIPS Interface
  • DMA the boot segment from ROM to 0x80001000 using the values in the header seen above
  • Store registers passed by the PIF at 0x80000300
  • Clear RSP DMEM and IMEM
  • Jump to the boot segment

Note: The two values used to describe the boot segment location in this format are the locations of the CRC values for Nintendo's bootcode. With this being said, do not apply a CRC updater to a ROM built with the pseultra toolchain, or these values will be overwritten. There are no checksums for ROMS using this bootcode.

Tests

There are currently no tests available.

Todo

  • Polish bootcode and brute force checksum