# Controllers, paks and save types Sources: n64brew: Joybus Protocol, Controller, Controller Pak (+ Filesystem), Rumble Pak, Transfer Pak, Flash, Cart Backup Hardware, ROM Header (CC BY-SA 4.0, facts only, tier 3). ## Joybus (the wire behind the PIF) - Symbols of 4 µs (0, 1, device stop) and 3 µs (console stop); devices must answer within about 62.5 µs; reset is the line held low for 1 ms. - Commands (TX/RX bytes): 0xFF reset+info 1/3; 0x00 info 1/3; 0x01 controller state 1/4; 0x02 pak read 3/33; 0x03 pak write 35/1; 0x04 EEPROM read 2/8; 0x05 EEPROM write 10/1; 0x06 RTC info 1/3; 0x07 RTC read 2/9; 0x08 RTC write 10/1; 0x09-0x0D VRU (unknown); 0x13/0x14 keyboard and 64GB cable. Unknown commands are ignored: the PIF reports a timeout. - Info replies (device type): 0x0500 controller (third byte: pak present 1, absent 2, newly inserted 3; bit 2 = checksum error on the last command); 0x0080 EEPROM 4 Kbit, 0x00C0 EEPROM 16 Kbit (0x80 = write busy); 0x0010 RTC; 0x0001 VRU; 0x0200 mouse; 0x0002 keyboard. - Pak addresses carry an 11-bit address plus a 5-bit checksum (XOR table on the Joybus page); data blocks of 32 bytes carry a CRC-8 (polynomial 0x85, initial 0) computed by the device; an empty port answers zeros with the CRC complemented. ## The controller 14 buttons, a reset bit (L+R+Start clears Start, re-centres the stick and sets RST), and the stick as signed 8-bit X and Y (optical quadrature encoders counted relative to power-on). **The button bit order is only in an image on the wiki** (U11): the board's Phase 1 takes it from a test ROM (mimi, n64_controller_test: MIT) or from libdragon's `joybus.h` (Unlicense). ## Paks (on the controller's 32-pin port) - **Controller Pak**: 32 KiB battery SRAM (0x0000-0x7FFF; OEM paks ignore writes above and read 0 there); the filesystem (128 pages of 256 bytes: ID sector, FAT and backup, 16 notes) is software, not hardware, so the board stores 32 KiB and nothing more. Third-party multi-bank paks switch banks by a write to 0x8000-0xFFFF (U12: missing banks). - **Rumble Pak**: write 0x80 to 0x8000-0xBFFF to unlock (reads 0x80 when unlocked); odd/even writes to 0xC000-0xFFFF start/stop the motor (the Joybus page puts the motor elsewhere: C10). - **Transfer Pak**: a Game Boy cartridge reached through pak reads and writes (banked); the wiki has no detail (U13). In the family, gameboy-python owns Game Boy cartridges: a Transfer Pak socket would pin it rather than copy any mapper code (handoff Open decision 9). - Others: VRU (voice recognition, unknown commands), mouse, keyboard (Randnet), Densha de Go, dance pad. Out of scope for the first build. ## Save types (on the cartridge) | Type | Where | Size | Notes | | --- | --- | --- | --- | | EEPROM 4 Kbit | joybus channel 4 | 512 B (64 blocks of 8) | info 0x0080; writes finish in the background, up to 6 ms | | EEPROM 16 Kbit | joybus channel 4 | 2 KiB (256 blocks) | info 0x00C0 | | SRAM 256 Kbit | PI domain 2 at 0x08000000 | 32 KiB | plain memory on the PI bus | | SRAM 768 Kbit (banked) | PI domain 2 | 96 KiB (3 x 32) | one title in the census (ares: 96 KB); the banking is not on the wiki (U14) | | FlashRAM 1 Mbit | PI domain 2, command register at 0x08010000 | 128 KiB (8 sectors x 128 pages x 128 B) | commands (chip/sector erase, program page, load page buffer, status, ID, read array); 7 chip IDs (Macronix MX29L0000/0001/1100/1101 A-C, Matsushita MN63F8MPN) with word vs byte addressing and per-chip timing and status quirks; the page is "WIP" | | RTC | joybus channel 4 | 8 B SRAM + BCD clock | Animal Forest only | | Controller Pak | joybus pak commands | 32 KiB per pak | in the controller, not the cartridge | **The cartridge does not say which it has** (ROM Header: only the homebrew "ED" header declares a save type). Games probe EEPROM by joybus info and simply use SRAM or FlashRAM at 0x08000000; emulators match a database by game code or checksum. So the board takes the save type as **cartridge metadata supplied by the host** (a database row, or the homebrew header), never guessed by probing. The census uses ares's database (ISC, tier 5) only to count; the board's own table would be built from it with its notice (code OK with notice), or from a clean list (handoff Open decision 8).