Nintendo 64: What is a bootcode?
The bootcode is (in short) Nintendo's "weapon" to stop hacking / change code in a N64 cartridge / ROM file. The bootcode calculate and match the result with the CRC's located in the header of a N64 ROM file and if they don't match then the game / demo or whatever refuses to start.
The Bootcode is located at file offset $40 to $FFFF (4032 bytes).. Nintendo did it clever enough by not placing the bootchip (CIC-NUS) in the N64 unit but in every cartridge, so they can change the chip (and the bootcode) as often as they like to.
There are six different CIC-Types. (Each CIC-Type refers to the first game to use that type of CIC bootchip.)
- mario = Mario-Type CIC Bootchip. (CIC-6102 or CIC-7101)
- starf = Starf-Type CIC Bootchip. (CIC-6101)
- lylat = Lylat-Type CIC Bootchip. (CIC-7102)
- diddy = Diddy-Type CIC Bootchip. (CIC-6103 or CIC-7103)
- yoshi = Yoshi-Type CIC Bootchip. (CIC-6106 or CIC-7106)
- zelda = Zelda-Type CIC Bootchip. (CIC-6105 or CIC-7105)
What is a Fake Entrypoint and what is a Real Entrypoint?
To allow a NUS-CIC-6103 or NUS-CIC-7103 image to boot, the entrypoint in the header must be 'faked'. This is done by adding 0x100000 to the real entrypoint. This is a nice little trick Nintendo included in their bootcode.
To allow a NUS-CIC-6106 or NUS-CIC-7106 image to boot, the entrypoint in the header must be 'faked'. This is done by adding 0x200000 to the real entrypoint. This is a nice little trick Nintendo included in their bootcode.
The NUS-CIC-6102, NUS-CIC-6101, and NUS-CIC-7101, all have their fake entrypoint (the one in the header) set the same as their real entrypoint.
To boot a rom image with the NUS-CIC-7102 bootcode, one must make sure the real entrypoint of the image is set to 0x80000480, otherwise the image will not boot at all. No matter what the fake entrypoint is set to the image will not boot unless the real entrypoint is at 0x80000480.