Class Mapper001

Inheritance Relationships

Base Type

Class Documentation

class Mapper001 : public Mapper

iNES mapper 001.

PRG ROM: 256 or 512 KiB. PRG RAM: 8-32 KiB (default 32 KiB, selectable only with NES 2.0 dumps). CHR ROM: 8-128 KiB

If no CHR ROM present (0 KiB), m_CHRRAM will be mapped to CHR ROM and 8 KiB of memory provided.

Mirroring settings: H, V, single or switchable. Both PRG and CHR ROMs support banking.

Public Functions

Mapper001(std::vector<uint8_t> &PRGROM, std::vector<uint8_t> &CHRROM, size_t PRGRAMSize = 0x8000)

Create instance of Mapper 001.

PRG RAM size can be selected in NES 2.0 headers, default of 32 KiB is provided for backwards compatibility.

~Mapper001() override = default
virtual void init() override

Initialize mapper to the power-up state = clean all volatile memories.

virtual bool cpuRead(uint16_t addr, uint8_t &data) override

CPU read interface.

Parameters
  • addr – Address to read from.

  • data – Buffer to write to.

Returns

true If anything was read

virtual bool cpuWrite(uint16_t addr, uint8_t data) override

CPU write interface.

Parameters
  • addr – Address to write to.

  • data – Data to write.

Returns

true If anything was written.

virtual bool ppuRead(uint16_t addr, uint8_t &data) override

PPU read interface.

Parameters
  • addr – Address to read from.

  • data – Buffer to write to.

Returns

true If anything was read.

virtual bool ppuWrite(uint16_t addr, uint8_t data) override

PPU write interface.

Parameters
  • addr – Address to write to.

  • data – Data to write.

Returns

true If anything was written.

virtual void drawGUI() override

Draw a debugging GUI.

Public Members

PRGMode_t PRGMode

PRG switching mode.

uint8_t PRGROMSelect

Select PRG ROM bank.

CHRMode_t CHRMode

CHR switching mode.

uint8_t CHRROMLoSelect

Select low CHR bank.

uint8_t CHRROMHiSelect

Select high CHR bank.

bool enablePRGRAM

Enable program RAM.

uint8_t PRGRAMSelect

PRG RAM bank select (A13 for 16 KB version; A14-A13 for 32 KB version).