Skip to main content

Cartridge

Trait Cartridge 

Source
pub trait Cartridge {
    // Provided methods
    fn pi_read(&mut self, addr: u32) -> u8 { ... }
    fn pi_write(&mut self, addr: u32, val: u8) { ... }
    fn si_exchange(&mut self, _channel: u8, _tx: &[u8], _rx: &mut [u8]) { ... }
    fn notify_cpu_cycle(&mut self) { ... }
    fn save_type(&self) -> SaveType { ... }
}
Expand description

The cartridge trait. One cart model, parameterized by save type, CIC, and region (ADR 0003) — the N64 has no mapper equivalent.

Board-specific behavior — PI/SI-mediated reads and writes, save backing, optional bootstrap — lives behind it, not in the CPU. All hooks default to no-op so a board implements only what it uses.

Provided Methods§

Source

fn pi_read(&mut self, addr: u32) -> u8

PI-side read from the cartridge address space ($1000_0000..).

Source

fn pi_write(&mut self, addr: u32, val: u8)

PI-side write into the cartridge address space (save SRAM/FlashRAM, regs).

Source

fn si_exchange(&mut self, _channel: u8, _tx: &[u8], _rx: &mut [u8])

SI-side joybus exchange (controllers + Controller Pak). Default no-op.

Source

fn notify_cpu_cycle(&mut self)

Per-CPU-cycle hook (counter-driven cart hardware). Default no-op.

Source

fn save_type(&self) -> SaveType

The active save backend for this cartridge.

Implementors§