-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCartridge.h
50 lines (38 loc) · 1022 Bytes
/
Cartridge.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#include <string>
#include <cstdint>
#include <vector>
#include <ios>
#include <iostream>
#include <fstream>
#include <algorithm>
#include "Mapper_000.h"
class Cartridge
{
public:
Cartridge(const std::string &sFileName);
~Cartridge();
bool ImageValid();
enum MIRROR
{
HORIZONTAL,
VERTICAL,
ONESCREEN_LO,
ONESCREEN_HI
} mirror = HORIZONTAL;
private:
bool bImageValid = false;
std::vector<uint8_t> vPRGMemory; //Program ROM
std::vector<uint8_t> vCHRMemory; //CHR ROM
uint8_t nMapperID = 0; //which mapper to use
uint8_t nPRGBanks = 0; // how many "partitions" are in the PRG
uint8_t nCHRBanks = 0; // how many "partitions" are in the CHR
std::shared_ptr<Mapper> pMapper;
public:
//Comunicate with the main bus
bool cpuRead(uint16_t addr, uint8_t &data);
bool cpuWrite(uint16_t addr, uint8_t data);
//Communication with the PPU bus
bool ppuRead(uint16_t addr, uint8_t &data);
bool ppuWrite(uint16_t addr, uint8_t data);
};