OXYGENHUB
◆ main openmsx / src / memory / ReproCartridgeV2.hh
1.3 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef REPROCARTRIDGEV2_HH
2
#define REPROCARTRIDGEV2_HH
3
4
#include "AmdFlash.hh"
5
#include "MSXRom.hh"
6
7
#include "AY8910.hh"
8
#include "SCC.hh"
9
10
#include <array>
11
12
namespace openmsx {
13
14
class ReproCartridgeV2 final : public MSXRom
15
{
16
public:
17
	ReproCartridgeV2(DeviceConfig& config, Rom&& rom);
18
	~ReproCartridgeV2() override;
19
20
	void powerUp(EmuTime time) override;
21
	void reset(EmuTime time) override;
22
	[[nodiscard]] byte peekMem(uint16_t address, EmuTime time) const override;
23
	[[nodiscard]] byte readMem(uint16_t address, EmuTime time) override;
24
	[[nodiscard]] const byte* getReadCacheLine(uint16_t address) const override;
25
	void writeMem(uint16_t address, byte value, EmuTime time) override;
26
	[[nodiscard]] byte* getWriteCacheLine(uint16_t address) override;
27
28
	void writeIO(uint16_t port, byte value, EmuTime time) override;
29
30
	void setVolume(EmuTime time, byte value);
31
32
	template<typename Archive>
33
	void serialize(Archive& ar, unsigned version);
34
35
private:
36
	[[nodiscard]] bool isSCCAccess(uint16_t addr) const;
37
	[[nodiscard]] unsigned getFlashAddr(unsigned addr) const;
38
39
private:
40
	AmdFlash flash;
41
	SCC scc;
42
	AY8910 psg0x10, psg0xA0;
43
44
	bool flashRomWriteEnabled;
45
	byte mainBankReg;
46
	byte volumeReg;
47
	byte mapperTypeReg;
48
	byte psg0x10Latch, psg0xA0Latch;
49
	byte sccMode;
50
	std::array<byte, 4> bankRegs;
51
};
52
53
} // namespace openmsx
54
55
#endif