NESemu/src/mappers/Mapper000.cpp

46 lines
816 B
C++
Raw Normal View History

2022-02-28 15:04:25 +00:00
#include "Mapper000.hpp"
#include "../Log.hpp"
#include <fstream>
#include "../Cartridge.hpp"
2022-03-01 02:34:19 +00:00
Mapper000::Mapper000(const Header& header, std::ifstream& ifs) :
Mapper(header)
2022-02-28 15:04:25 +00:00
{
LOG_CORE_INFO("Allocating PRG ROM");
2022-03-03 16:29:56 +00:00
PRG_ROM = std::vector<Byte>(0x4000 * prgBanks);
ifs.read((char*)PRG_ROM.data(), 0x4000 * prgBanks);
2022-02-28 15:04:25 +00:00
LOG_CORE_INFO("Allocating CHR ROM");
CHR_ROM = std::vector<Byte>(0x2000);
ifs.read((char*)CHR_ROM.data(), 0x2000);
}
Byte Mapper000::ReadCPU(Word addr)
{
if (0x8000 <= addr && addr <= 0xFFFF)
{
2022-03-04 13:16:41 +00:00
return PRG_ROM[addr & (0x4000 * prgBanks - 1)];
2022-02-28 15:04:25 +00:00
}
return 0x00;
2022-02-28 15:04:25 +00:00
}
Byte Mapper000::ReadPPU(Word addr)
{
if (0x0000 <= addr && addr <= 0x1FFF)
{
return CHR_ROM[addr];
}
return 0x00;
2022-02-28 15:04:25 +00:00
}
void Mapper000::WriteCPU(Word addr, Byte val)
{
}
void Mapper000::WritePPU(Word addr, Byte val)
{
}