tourze/nes-cartridge
最新稳定版本:0.0.1
Composer 安装命令:
composer require tourze/nes-cartridge
包简介
README 文档
README
This package provides NES cartridge-related functionality, handling game ROM data loading and memory mapping for a NES emulator.
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
Install via Composer:
composer require nes/cartridge
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
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
The module uses a layered design:
- Interface Layer - Defines standard interfaces for interaction with other modules
- Core Layer - Provides core cartridge implementation
- Functional Layer - Implements ROM header parsing, memory management, etc.
- Factory Layer - Provides factory classes for creating cartridge instances
- Loader Layer - Handles file IO and ROM data loading
Contributing
Contributions are welcome. Please ensure you add appropriate tests before submitting PRs.
License
MIT License
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-24