openMSX
ReproCartridgeV2.hh
Go to the documentation of this file.
1 #ifndef REPROCARTRIDGEV2_HH
2 #define REPROCARTRIDGEV2_HH
3 
4 #include "MSXRom.hh"
5 #include "AmdFlash.hh"
6 #include "SCC.hh"
7 #include "AY8910.hh"
8 
9 namespace openmsx {
10 
11 class ReproCartridgeV2 final : public MSXRom
12 {
13 public:
14  ReproCartridgeV2(const DeviceConfig& config, Rom&& rom);
15  ~ReproCartridgeV2() override;
16 
17  void powerUp(EmuTime::param time) override;
18  void reset(EmuTime::param time) override;
19  byte peekMem(word address, EmuTime::param time) const override;
20  byte readMem(word address, EmuTime::param time) override;
21  const byte* getReadCacheLine(word address) const override;
22  void writeMem(word address, byte value, EmuTime::param time) override;
23  byte* getWriteCacheLine(word address) const override;
24 
25  void writeIO(word port, byte value, EmuTime::param time) override;
26 
27  void setVolume(EmuTime::param time, byte value);
28 
29  template<typename Archive>
30  void serialize(Archive& ar, unsigned version);
31 
32 private:
33  bool isSCCAccess(word addr) const;
34  unsigned getFlashAddr(unsigned addr) const;
35 
36 private:
37  AmdFlash flash;
38  SCC scc;
39  AY8910 psg0x10, psg0xA0;
40 
41  bool flashRomWriteEnabled;
42  byte mainBankReg;
43  byte volumeReg;
44  byte mapperTypeReg;
45  byte psg0x10Latch, psg0xA0Latch;
46  byte sccMode;
47  byte bankRegs[4];
48 };
49 
50 } // namespace openmsx
51 
52 #endif
openmsx::ReproCartridgeV2::readMem
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: ReproCartridgeV2.cc:191
openmsx::AmdFlash
Definition: AmdFlash.hh:17
openmsx::DeviceConfig
Definition: DeviceConfig.hh:19
openmsx::ReproCartridgeV2::serialize
void serialize(Archive &ar, unsigned version)
Definition: ReproCartridgeV2.cc:373
openmsx::ReproCartridgeV2::writeIO
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port at a certain time to this device.
Definition: ReproCartridgeV2.cc:333
openmsx::ReproCartridgeV2::getReadCacheLine
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition: ReproCartridgeV2.cc:215
openmsx::ReproCartridgeV2::writeMem
void writeMem(word address, byte value, EmuTime::param time) override
Write a given byte to a given location at a certain time to this device.
Definition: ReproCartridgeV2.cc:225
AY8910.hh
openmsx::ReproCartridgeV2::getWriteCacheLine
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: ReproCartridgeV2.cc:326
openmsx::MSXRom
Definition: MSXRom.hh:9
openmsx::ReproCartridgeV2::powerUp
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
Definition: ReproCartridgeV2.cc:132
openmsx::ReproCartridgeV2::setVolume
void setVolume(EmuTime::param time, byte value)
Definition: ReproCartridgeV2.cc:360
AmdFlash.hh
openmsx::SCC
Definition: SCC.hh:11
MSXRom.hh
openmsx::ReproCartridgeV2::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: ReproCartridgeV2.cc:138
openmsx::ReproCartridgeV2
Definition: ReproCartridgeV2.hh:11
openmsx::MSXRom::rom
Rom rom
Definition: MSXRom.hh:20
openmsx::Rom
Definition: Rom.hh:20
openmsx::ReproCartridgeV2::peekMem
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: ReproCartridgeV2.cc:203
openmsx::AY8910
This class implements the AY-3-8910 sound chip.
Definition: AY8910.hh:19
openmsx::ReproCartridgeV2::ReproCartridgeV2
ReproCartridgeV2(const DeviceConfig &config, Rom &&rom)
Definition: ReproCartridgeV2.cc:102
openmsx::ReproCartridgeV2::~ReproCartridgeV2
~ReproCartridgeV2() override
Definition: ReproCartridgeV2.cc:122
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
SCC.hh
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5