Go to the documentation of this file.
5 #ifndef COMSQUARE_CARTRIDGE_HPP
6 #define COMSQUARE_CARTRIDGE_HPP
9 #include "../Memory/IMemory.hpp"
10 #include "../Models/Ints.hpp"
11 #include "../Memory/IRectangleMemory.hpp"
16 #define ADDMAPPINGMODE(x, flag) (x = static_cast<MappingMode>(x | (flag)))
71 static size_t getRomSize(
const std::string &romPath);
84 explicit Cartridge(
const std::string &romPath);
103 #endif //COMSQUARE_CARTRIDGE_HPP
Superset of the IMemory to map non continuous rectangle to the memory. (A rectangle that spam across ...
Definition: IRectangleMemory.hpp:14
@ LoRom
Definition: Cartridge.hpp:18
size_t _size
The size of the rom data.
Definition: Cartridge.hpp:66
void write_internal(uint24_t addr, uint8_t data) override
Write data to the rom.
Definition: Cartridge.cpp:55
uint8_t * _data
The rom data (contains all the instructions).
Definition: Cartridge.hpp:64
unsigned uint24_t
Definition: Ints.hpp:8
Definition: Cartridge.cpp:13
Cartridge(const std::string &romPath)
Load a rom from it's path.
Definition: Cartridge.cpp:15
~Cartridge()
Destructor that free the cartridge data.
Definition: Cartridge.cpp:33
uint32_t _getHeaderAddress()
Get the address of the header.
Definition: Cartridge.cpp:110
MappingMode
Definition: Cartridge.hpp:17
@ FastRom
Definition: Cartridge.hpp:21
@ SlowRom
Definition: Cartridge.hpp:20
uint8_t read_internal(uint24_t addr) override
Read from the rom.
Definition: Cartridge.cpp:48
Definition: InterruptVectors.hpp:10
Contains the rom's memory/instructions.
Definition: Cartridge.hpp:61
@ ExRom
Definition: Cartridge.hpp:22
static size_t getRomSize(const std::string &romPath)
Get the size of a rom from it's path.
Definition: Cartridge.cpp:38
Header header
The header of the cartridge.
Definition: Cartridge.hpp:89
bool _loadHeader()
Set the public variable header by parsing the header in the ROM.
Definition: Cartridge.cpp:169
@ HiRom
Definition: Cartridge.hpp:19
Header _mapHeader(uint32_t headerAddress)
Parse the memory to get a readable header.
Definition: Cartridge.cpp:62