定制 tourze/nes-mmc 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tourze/nes-mmc

最新稳定版本:0.0.1

Composer 安装命令:

composer require tourze/nes-mmc

包简介

MMC模块 (Memory Mapper Controller)

README 文档

README

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

中文文档

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

Install via Composer:

composer require tourze/nes-mmc

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

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

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

This project is licensed under the MIT License. See the LICENSE file for details.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-24