๐Ÿ“ฆ MaxwellKnight / nes-emulator

๐Ÿ“„ test_cartridge.h ยท 24 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#pragma once
#include "cartridge.h"
#include "mapper_zero.h"

namespace nes {

class MockCartridge : public nes::Cartridge {
 public:
  MockCartridge()
    : Cartridge("") {
    _prg_memory.resize(0x4000);  // Minimum PRG ROM size
    _chr_memory.resize(0x2000);  // Minimum CHR ROM size
    _mapper = std::make_shared<MapperZero>(_prg_banks, _chr_banks);
  }

  bool cpu_read(u16 address, u8& data) const {
    data = 0x00;
    return true;
  }

  bool cpu_write(u16 address, u8 value) { return true; }
};
};  // namespace nes