PHPackages                             tourze/nes-cartridge - 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. tourze/nes-cartridge

ActiveLibrary

tourze/nes-cartridge
====================

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

Since May 24Pushed 11mo ago1 watchersCompare

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

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

NES Cartridge
=============

[](#nes-cartridge)

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

[![Latest Version](https://camo.githubusercontent.com/1f1ff4d029731c3740efd166855ad21e4b61c72515f186dfa23f1be4f1de8e25/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e65732f6361727472696467652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nes/cartridge)[![Total Downloads](https://camo.githubusercontent.com/1bb16570dd92314b525c7c613efb50bf591cb24d285624969cb2b7aed38214cb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e65732f6361727472696467652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nes/cartridge)

This package provides NES cartridge-related functionality, handling game ROM data loading and memory mapping for a NES emulator.

Features
--------

[](#features)

- Support for standard iNES and NES2.0 format ROM file parsing
- Memory structure management for cartridge data
- ROM data loading and processing
- Integration with the mapper module (nes-mappers)
- Support for battery-backed SRAM management

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

[](#installation)

Install via Composer:

```
composer require nes/cartridge
```

Basic Usage
-----------

[](#basic-usage)

```
// Load ROM from file
$cartridge = CartridgeFactory::createFromFile('/path/to/game.nes');

// Get mapper type
$mapperType = $cartridge->getMapperType();

// Get PRG-ROM data
$prgRomData = $cartridge->getPrgRomData();

// Get CHR-ROM data
$chrRomData = $cartridge->getChrRomData();

// Reset cartridge state
$cartridge->reset();
```

Integration with Mapper Module
------------------------------

[](#integration-with-mapper-module)

This package is designed to work with the `nes-mappers` package:

```
// Cartridge and mapper integration example
$cartridge = CartridgeFactory::createFromFile('/path/to/game.nes');
$mapper = MapperFactory::create($cartridge->getMapperType(), $cartridge);

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

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

Architecture
------------

[](#architecture)

The module uses a layered design:

1. **Interface Layer** - Defines standard interfaces for interaction with other modules
2. **Core Layer** - Provides core cartridge implementation
3. **Functional Layer** - Implements ROM header parsing, memory management, etc.
4. **Factory Layer** - Provides factory classes for creating cartridge instances
5. **Loader Layer** - Handles file IO and ROM data loading

Contributing
------------

[](#contributing)

Contributions are welcome. Please ensure you add appropriate tests before submitting PRs.

License
-------

[](#license)

MIT License

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance50

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

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

353d 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-cartridge/health.svg)

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

PHPackages © 2026

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