The hardware
This page is the whole Nintendo 64 at a glance. Each page after it says how one part of the real console works, how n64emu emulates it,
where its facts are from, and what is missing or a guess. To see how all parts run together in n64emu, start with
the architecture. The facts here are from NEC's manual of the VR4300 and from n64brew.dev's pages, which each page names.
The console
The Nintendo 64 has two large chips and a few small ones:
| Part | What it is | Its clock | Page |
| The VR4300 | NEC's 64-bit MIPS processor (MIPS III), with a floating point unit, caches of 16 KB for instructions and 8 KB for data, a TLB of 32 entries and a timer. It runs the game | 93.75 MHz | the processor, floating point |
| The RCP | the Reality Co-Processor: everything else of the console's logic, in one chip. The processor reaches all memory and devices through it | 62.5 MHz | below |
| the RSP, in the RCP | a second processor for the game's own small programs (microcode), with 4 KB for its program (IMEM), 4 KB for data (DMEM), and a vector unit of eight lanes of 16 bits | the RCP's | the RSP |
| the RDP, in the RCP | draws triangles and rectangles into RDRAM, with textures from its own 4 KB (TMEM) | the RCP's | the RDP, its command interface |
| the MI, RI, VI, AI, PI and SI, in the RCP | the interfaces: interrupts and modes of the memory (MI), RDRAM (RI), the picture (VI), sound (AI), the cartridge's bus (PI) and the serial bus to the PIF (SI) | the RCP's | memory and the bus, the VI, PI, SI and AI |
| RDRAM | the only main memory: 4 MB in two chips, or 8 MB with the Expansion Pak. Each byte has a ninth bit, which the RDP and the VI use for coverage at the edges of shapes | its own | memory and the bus |
| The PIF | a small chip with its own program and 64 bytes of RAM. It starts the console, talks to the controllers over the joybus, and checks the cartridge's security chip | | controllers and the PIF |
| The cartridge | the game's ROM on the parallel bus, often with SRAM or FlashRAM for saves, or with EEPROM and a clock on the joybus, and a security chip (CIC) | | cartridges, the security chip |
| Controllers | a stick and 14 buttons, the D-pad's four among them, with a slot for a pak: the Controller Pak keeps saves, and the Rumble Pak shakes | | controllers and the PIF |
How they are joined:
the VR4300 (93.75 MHz) ── SysAD ──┐
│
┌─────────────────────── the RCP (62.5 MHz) ────────────────────────┐
│ the RSP (IMEM, DMEM) ──commands──► the RDP (TMEM) │
│ │ DMA │ draws │
│ MI RI ─────────── RDRAM, 4 or 8 MB with ninth bits ────────────┤
│ VI ── reads a frame buffer, filters it ──► the video DAC ──► TV │
│ AI ── reads samples ──────────────────────► the audio DAC │
│ PI ── the parallel bus ──► the cartridge: ROM, SRAM, FlashRAM │
│ SI ── the serial bus ───► the PIF ── joybus ──► 4 controllers │
│ └───────► EEPROM, clock │
└───────────────────────────────────────────────────────────────────┘
- Everything goes through RDRAM. The processor, the RSP's DMA, the RDP, the VI, the AI, the PI and the SI all read and write the same
memory, one at a time, so they wait for each other there (who gets the memory).
- The processor sees every part as memory, at fixed physical addresses (the map). Its own TLB and
segments put them where a program wants them.
- Each interface raises one interrupt in the MI, and the MI's one line goes to the processor (the MI).
A frame, step by step
What a typical game does for each picture, as n64brew's pages of the VR4300, the RSP's and the RDP's interfaces and the AI describe it:
- The processor runs the game: it reads the controllers through the SI and the PIF, and writes lists of what to draw and of sound to
make, in RDRAM.
- It starts the RSP: a DMA brings a microcode into IMEM and its data into DMEM, and the processor clears the RSP's halt bit.
- The RSP turns the lists into commands for the RDP: it transforms and lights the points of the shapes with its vector unit, and gives
the commands to the RDP through its command interface, from DMEM or from RDRAM. Most games make their sound with another microcode,
which mixes the samples into a buffer in RDRAM.
- The RDP loads textures into TMEM, and draws each shape into a frame buffer in RDRAM, with its depth and coverage. A full sync tells
the processor that it is done.
- The VI reads the frame buffer that the game points it to, line by line, scales it, smooths the edges with the coverage in the
ninth bits, and sends it to the television. Its interrupt comes at a line that the game chooses, so that the game knows where the picture is.
- The AI plays the sound buffer while the next one is made. Its interrupt comes when a buffer begins, so that the game can give it
the next one in time.
In n64emu each of these parts runs only when something could see it, in one order of time (architecture).
How a game starts
- The console's own boot program, from the PIF's ROM, runs on the processor, and copies the cartridge's boot code (IPL3, 4 KB from the ROM's start) into DMEM.
- The security chip gives the PIF a seed. The boot code checks the game's first megabyte with it, sets up RDRAM, copies the game to
it, and jumps there.
- The game tells the PIF that its boot has ended within about 5 seconds, or the PIF stops it.
n64emu has none of the console maker's programs. It starts at the state in which the PIF's program would leave the boot code, finds the
seed by trying each one with the game's own boot code, and for the games with the 6105 chip does what their boot code would leave itself
(starting a game).
The pages
| Page | What is in it |
| The processor | the VR4300's pipeline, caches, TLB, exceptions and times. A store and a long division, step by step |
| Floating point arithmetic | what the floating point unit gives, NaNs, rounding, and what was measured on a console |
| Memory and the bus | the map, how the RCP takes each size of access, RDRAM's chips and how long they take, the ninth bits, and the MI |
| The RSP | the second processor, which is a port: its memories, its registers, a DMA step by step, and its recompiler |
| The RDP and the VI's filters | drawing on Vulkan, which is a port, the picture, the render scale, and pictures shared with the window |
| The VI and the RDP's command interface | the picture's signal: lines, fields and frames, and how commands reach the RDP |
| PI, SI and AI | the cartridge's bus with its DMA, the serial bus, and sound. A DMA from the cartridge step by step |
| Cartridges | file formats, the header, ROM, SRAM and FlashRAM, and how the kind of save is found |
| Controllers and the PIF | the joybus and its devices, paks, EEPROM, the clock, the security chips, and how a game starts |
The scheduler is about n64emu and not the console: who runs when, and how long each call into a part runs.
Status has the state of each part.
From commit 9ba9172cfa64. Edit this page