Class Mapper000

Inheritance Relationships

Base Type

Class Documentation

class Mapper000 : public Mapper

iNES mapper 000.

PRG ROM: 16 or 32 KiB. PRG RAM: 2 or 4 KiB, this implementation provides always 8 KiB for compatibility. CHR ROM: 8 KiB If no CHR ROM present (0 KiB), m_CHRRAM will be mapped to CHR ROM and 8 KiB of memory provided.

Mirroring settings: via solder pads. This mapper has no bankswitching support.

Public Functions

Mapper000(std::vector<uint8_t> &PRGROM, std::vector<uint8_t> &CHRROM, mirroringType_t mirroringType)

Construct Mapper 000. This mapper has a fixed mirroring mode depending on hardware configuration (soldered pad), this information is contained in the ROM dump and passed to the mapper via mirroringType parameter.

Throws
  • std::invalid_argument – If PRGROM has invalid size (not 0x4000 nor 0x8000).

  • std::invalid_argument – If CHRROM has invalid size (not 0x8000).

~Mapper000() 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.

Protected Attributes

std::vector<uint8_t> &m_PRGROM
std::vector<uint8_t> &m_CHRROM
std::array<uint8_t, 0x2000> m_PRGRAM = {0x00}
std::vector<uint8_t> m_CHRRAM
bool m_CHRWritable = false