PIF-NUS: Difference between revisions
m (Added link to PAKs category page) |
Fraser.mips (talk | contribs) m (Console Startup Description) |
||
Line 1: | Line 1: | ||
The '''Peripheral Interface''', or '''PIF''' manages many of the critical functions of the N64 console. |
|||
⚫ | |||
* Console startup and piracy protections |
|||
** Stores the first 2 stages of the Initial Program Load (IPL) that is executed by the VR4300 CPU |
|||
* Manages the console reset button to avoid corrupting save game data |
|||
* Handles all JoyBus communication with the controllers and EEPROM inside the cartridges |
|||
=== Console startup === |
|||
# PIF holds all of the console components in reset mode, listening for cartridge CIC |
|||
# Cartridge sends 4 bits (nibble) including region encoding |
|||
# Cartridge sends 4 bit encrypted seed value |
|||
# Cartridge sends 4 bit checksum |
|||
# PIF checks that these are the expected values |
|||
## If the values don't match (same scenario if no cartridge is inserted) |
|||
### The user would generally reset using the button or power off |
|||
### Remove/Re-insert cartridge (or change games) |
|||
### Power on (go to step #1) |
|||
# PIF writes the encrypted seed value to memory address 0xBFC0'07E4 |
|||
# PIF releases the reset pin for the whole console |
|||
# VR4300 requests RAM address 0xBFC0'0000 from the Memory Management Unit inside the RCP |
|||
# IPL1: The MMU then loads the MIPS code from a storage area of the PIF chip |
|||
## These instructions are executed directly in this very slow manner. |
|||
## Thankfully IPL1 is only 52 instructions + some looping |
|||
## Some really basic hardware initialization |
|||
## Copy IPL2 to the RSP IMEM address range |
|||
# IPL 2 is executed by the VR4300 but reading the instructions from the RSP's IMEM |
|||
## More general hardware initialization |
|||
## If it's determined to be a 64DD disk it will jump to 0xA600'0000 |
|||
## Load IPL3 from the cartridge into the RSP's DMEM |
|||
## The IPL3 code is CRC checked |
|||
## Set 0xBFC0'0000 range to "invisible" |
|||
## Jump to RSP DMEM to execute IPL3 |
|||
# IPL3 is executed by the VR4300 but reading the instructions from the RSP's DMEM |
|||
## Initialize RDRAM |
|||
## Depending on reset type |
|||
### Power On: Invalidate VR4300 ICache & DCache |
|||
### Reset : Writeback VR4300 ICache & DCache |
|||
## Move IPL3 execution from DMEM to RDRAM |
|||
## DMA 1 MB of Game code to RDRAM |
|||
## Authenticate 1 MB of Game Program |
|||
## Reset RSP |
|||
## Clear Interrupts |
|||
## Clear IPL3 from DMEM |
|||
## Clear IPL2 from IMEM |
|||
## Jump to Game code in RDRAM |
|||
Both the PIF and CIC (inside the cartridge) are custom versions of Sharp branded SM5 4-bit microcontrollers. These microcontrollers were also used in the Game & Watch handheld games, so Nintendo already had developers that were familiar with them. |
|||
⚫ | is a Sharp SM5 microcontroller on the main board that does many functions for the Nintendo 64. In addition to managing the [[Joybus Protocol]] for connected hardware like controllers and connected [[:Category:PAKs|accessory PAKs]], it also continuously communicates with the [[CIC]] copy protection chip in the game cartridge, handles console startup, and manages the Reset button. |
||
=== References === |
|||
https://sites.google.com/site/consoleprotocols/home/techinfo/lowlevel/pif12 |
https://sites.google.com/site/consoleprotocols/home/techinfo/lowlevel/pif12 |
||
https://code.google.com/archive/p/mupen64plus/wikis/SoftResetNotes.wiki |
|||
https://github.com/jago85/UltraCIC_C/blob/master/cic_c.c |
|||
[[Category:Motherboard]] |
[[Category:Motherboard]] |
Revision as of 07:23, 16 August 2020
The Peripheral Interface, or PIF manages many of the critical functions of the N64 console.
- Console startup and piracy protections
- Stores the first 2 stages of the Initial Program Load (IPL) that is executed by the VR4300 CPU
- Manages the console reset button to avoid corrupting save game data
- Handles all JoyBus communication with the controllers and EEPROM inside the cartridges
Console startup
- PIF holds all of the console components in reset mode, listening for cartridge CIC
- Cartridge sends 4 bits (nibble) including region encoding
- Cartridge sends 4 bit encrypted seed value
- Cartridge sends 4 bit checksum
- PIF checks that these are the expected values
- If the values don't match (same scenario if no cartridge is inserted)
- The user would generally reset using the button or power off
- Remove/Re-insert cartridge (or change games)
- Power on (go to step #1)
- If the values don't match (same scenario if no cartridge is inserted)
- PIF writes the encrypted seed value to memory address 0xBFC0'07E4
- PIF releases the reset pin for the whole console
- VR4300 requests RAM address 0xBFC0'0000 from the Memory Management Unit inside the RCP
- IPL1: The MMU then loads the MIPS code from a storage area of the PIF chip
- These instructions are executed directly in this very slow manner.
- Thankfully IPL1 is only 52 instructions + some looping
- Some really basic hardware initialization
- Copy IPL2 to the RSP IMEM address range
- IPL 2 is executed by the VR4300 but reading the instructions from the RSP's IMEM
- More general hardware initialization
- If it's determined to be a 64DD disk it will jump to 0xA600'0000
- Load IPL3 from the cartridge into the RSP's DMEM
- The IPL3 code is CRC checked
- Set 0xBFC0'0000 range to "invisible"
- Jump to RSP DMEM to execute IPL3
- IPL3 is executed by the VR4300 but reading the instructions from the RSP's DMEM
- Initialize RDRAM
- Depending on reset type
- Power On: Invalidate VR4300 ICache & DCache
- Reset : Writeback VR4300 ICache & DCache
- Move IPL3 execution from DMEM to RDRAM
- DMA 1 MB of Game code to RDRAM
- Authenticate 1 MB of Game Program
- Reset RSP
- Clear Interrupts
- Clear IPL3 from DMEM
- Clear IPL2 from IMEM
- Jump to Game code in RDRAM
Both the PIF and CIC (inside the cartridge) are custom versions of Sharp branded SM5 4-bit microcontrollers. These microcontrollers were also used in the Game & Watch handheld games, so Nintendo already had developers that were familiar with them.
is a Sharp SM5 microcontroller on the main board that does many functions for the Nintendo 64. In addition to managing the Joybus Protocol for connected hardware like controllers and connected accessory PAKs, it also continuously communicates with the CIC copy protection chip in the game cartridge, handles console startup, and manages the Reset button.
References
https://sites.google.com/site/consoleprotocols/home/techinfo/lowlevel/pif12
https://code.google.com/archive/p/mupen64plus/wikis/SoftResetNotes.wiki