Class Gamepak
Defined in File Gamepak.h
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public Component
(Class Component)
Class Documentation
-
class Gamepak : public Component
NES/Famicom cartridge emulation class.
This class handles parsing of supported cartridge dump formats, loads an appropriate mapper and handles PPU’s built in VRAM (CIRAM) if requested. There are two virtual connectors, this corresponds to the real hardware, where the cartridge is directly connected to the CPU’s and PPU’s buses.
Connectors: data “cpuBus” for CPU and data “ppuBus” for PPU.
Public Functions
-
Gamepak()
-
~Gamepak() override
-
virtual void init() override
Initialize Gamepak to power-up state.
Note
This does not delete any previously loaded ROM, only deletes data stored on volatile memories.
-
void load(std::ifstream &ifs)
Load a ROM file.
- Parameters
ifs – Input stream containing ROM data.
-
virtual std::vector<EmulatorWindow> getGUIs() override
Render a debugging GUI. Shows Gamepak parameters and mapper’s internal state.
- Returns
GUI windows.
Protected Types
-
enum class fileFormat_t
Type of file format.
Values:
-
enumerator NES20
-
enumerator INES
-
enumerator ARCHAICINES
-
enumerator NES20
Protected Attributes
-
struct Gamepak::gamepakParams m_params
-
std::vector<uint8_t> m_trainer
Trainer data.
-
std::vector<uint8_t> m_PRGROM
Program data.
-
std::vector<uint8_t> m_CHRROM
Character (picture) data.
Protected Static Attributes
-
static const size_t PRGROM_UNIT_SIZE = 16384
Size of program ROM unit.
-
static const size_t CHRROM_UNIT_SIZE = 8192
Size of character ROM unit.
-
static const size_t PRGRAM_UNIT_SIZE = 8192
Size of program RAM unit.
-
struct gamepakParams
Gamepak parameters.
Public Functions
-
inline gamepakParams()
-
inline void init()
Init parameters to common default values for all types.
Public Members
-
size_t PRGROMsize
Absolute size of PRG ROM.
-
size_t CHRROMsize
Absolute size of CHR ROM.
-
Mapper::mirroringType_t mirroringType
Mirroring type.
-
fileFormat_t fileFormat
File format.
-
bool hasPersistentMemory
Whether the gamepak contains any persistent memory.
-
bool hasTrainer
Whether the gamepak contains trainer.
-
uint16_t mapperNumber
iNES mapper number.
-
size_t PRGRAMsize
Absolute size of PRG RAM.
-
consoleType_t consoleType
Console type.
-
tvSystem_t tvSystem
TV region type.
-
size_t PRGNVRAMsize
Non-volatile PRG memory absolute size.
-
size_t CHRRAMsize
Character RAM absolute size.
-
size_t CHRNVRAMsize
Character NVRAM absolute size.
-
inline gamepakParams()
-
Gamepak()