-
Notifications
You must be signed in to change notification settings - Fork 9
Description
cargo-n64 does not ship with an IPL ROM for copyright reasons, even though this code is required to cold boot a Nintendo 64. We should add a default open source IPL3, preferably one with MIT license (or equivalent).
I know of two open source IPL3s:
- https://github.com/PeterLemon/N64/tree/master/BOOTCODE It is unlicensed and looks like a direct copy of
6102.binwith some minor adjustments. - https://github.com/pseudophpt/pseultra/blob/master/n64/boot/src/boot.sx Minimal implementation. Appears to be incomplete.
The biggest challenge is that IPL2 authenticates IPL3 with the PIF. Exact details of PIF authentication are out of scope for cargo-n64, but there is more on the topic in the links below:
- https://n64brew.dev/wiki/Peripheral_Interface#Console_startup
- Implementation of the IPL2 checksum algorithm: https://github.com/pseudophpt/pseultra/blob/master/tools/bootcsum/src/bootcsum.c
- Implementation of the CIC-side (which sends the precomputed checksum to the PIF through its side-channel ... i.e. this data is inaccessible from software): https://github.com/jago85/UltraCIC_C/blob/3450b4403a1df190b9abb2dbe071ce07a546179b/cic_c.c#L44
This means that the easiest way to workaround the IPL2 checksum is including a custom CIC implementation with the IPL3 code that sends the appropriate precomputed checksum to the PIF.
Note that the IPL2 checksum is not a problem on emulators or on carts like 64Drive and EverDrive64. These carts include an UltraCIC implementation and boot into a menu (using CIC-NUS-6102).
The 64Drive has a special "USB mode" that makes the cart act like a bare N64 cart with a selectable CIC when powered on with a USB cable plugged in. When running a ROM created with a custom IPL3 in USB mode, it is necessary to reprogram the CIC emulation on the 64drive with the appropriate precomputed checksum. Unfortunately, this is not currently supported by 64drive.