PHPackages                             tourze/nes-mmc - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tourze/nes-mmc

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tourze/nes-mmc
==============

MMC模块 (Memory Mapper Controller)

0.0.1(11mo ago)00MITPHPPHP ^8.1CI passing

Since May 24Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/tourze/nes-mmc)[ Packagist](https://packagist.org/packages/tourze/nes-mmc)[ RSS](/packages/tourze-nes-mmc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

NES Memory Mapper Controller (MMC)
==================================

[](#nes-memory-mapper-controller-mmc)

This package provides an implementation of NES Memory Mapper Controller (MMC) for NES emulators, handling different types of mapper chips.

[中文文档](README.zh-CN.md)

Features
--------

[](#features)

- Support for multiple mapper types
- Unified mapper interface
- CPU and PPU address space mapping
- Bank switching support
- Different name table mirroring modes support
- IRQ interrupt generation

Installation
------------

[](#installation)

Install via Composer:

```
composer require tourze/nes-mmc
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use Tourze\NES\Cartridge\Memory\PrgRom;
use Tourze\NES\Cartridge\Memory\ChrRom;
use Tourze\NES\MMC\MapperFactory;
use Tourze\NES\MMC\MirroringMode;

// Create ROM data
$prgRom = new PrgRom($prgRomData);
$chrRom = new ChrRom($chrRomData);

// Create mapper instance - using mapper #0 (NROM)
$mapper = MapperFactory::create(0, $prgRom, $chrRom);

// CPU read
$data = $mapper->cpuRead(0x8000);

// CPU write
$mapper->cpuWrite(0x6000, 0x42);

// PPU read
$patternData = $mapper->ppuRead(0x0000);

// Change mirroring mode
$mapper->setMirroringMode(MirroringMode::VERTICAL);
```

### Register Custom Mapper

[](#register-custom-mapper)

```
use Tourze\NES\MMC\Registry\MapperRegistry;
use MyApp\Mappers\CustomMapper;

// Register custom mapper
MapperRegistry::register(123, CustomMapper::class);

// Use custom mapper
$mapper = MapperFactory::create(123, $prgRom, $chrRom);
```

Supported Mappers
-----------------

[](#supported-mappers)

Currently supported mappers:

- Mapper #0 (NROM) - The most basic mapper without bank switching, used for games like Super Mario Bros
- More mappers coming soon...

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance54

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

350d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/tourze)

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-nes-mmc/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-nes-mmc/health.svg)](https://phpackages.com/packages/tourze-nes-mmc)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
