openMSX
ReproCartridgeV1.hh
Go to the documentation of this file.
1 #ifndef REPROCARTRIDGEV1_HH
2 #define REPROCARTRIDGEV1_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 ReproCartridgeV1 final : public MSXRom
12 {
13 public:
14  ReproCartridgeV1(const DeviceConfig& config, Rom&& rom);
15  ~ReproCartridgeV1() 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 psg;
40 
41  bool flashRomWriteEnabled;
42  byte mainBankReg;
43  byte psgLatch;
44  byte sccMode;
45  byte bankRegs[4];
46 };
47 
48 } // namespace openmsx
49 
50 #endif
openmsx::ReproCartridgeV1::serialize
void serialize(Archive &ar, unsigned version)
Definition: ReproCartridgeV1.cc:245
openmsx::ReproCartridgeV1::getWriteCacheLine
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: ReproCartridgeV1.cc:219
openmsx::ReproCartridgeV1::powerUp
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
Definition: ReproCartridgeV1.cc:80
openmsx::AmdFlash
Definition: AmdFlash.hh:18
openmsx::DeviceConfig
Definition: DeviceConfig.hh:20
openmsx::ReproCartridgeV1::getReadCacheLine
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition: ReproCartridgeV1.cc:159
openmsx::ReproCartridgeV1::peekMem
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: ReproCartridgeV1.cc:147
AY8910.hh
openmsx::MSXRom
Definition: MSXRom.hh:10
openmsx::ReproCartridgeV1::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: ReproCartridgeV1.cc:169
AmdFlash.hh
openmsx::SCC
Definition: SCC.hh:12
MSXRom.hh
openmsx::ReproCartridgeV1::setVolume
void setVolume(EmuTime::param time, byte value)
openmsx::ReproCartridgeV1::readMem
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: ReproCartridgeV1.cc:135
openmsx::ReproCartridgeV1::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: ReproCartridgeV1.cc:86
openmsx::ReproCartridgeV1::~ReproCartridgeV1
~ReproCartridgeV1() override
Definition: ReproCartridgeV1.cc:73
openmsx::MSXRom::rom
Rom rom
Definition: MSXRom.hh:20
openmsx::Rom
Definition: Rom.hh:21
openmsx::AY8910
This class implements the AY-3-8910 sound chip.
Definition: AY8910.hh:20
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::ReproCartridgeV1::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: ReproCartridgeV1.cc:226
openmsx::ReproCartridgeV1
Definition: ReproCartridgeV1.hh:12
SCC.hh
openmsx::ReproCartridgeV1::ReproCartridgeV1
ReproCartridgeV1(const DeviceConfig &config, Rom &&rom)
Definition: ReproCartridgeV1.cc:58
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5