openMSX
MegaFlashRomSCCPlus.hh
Go to the documentation of this file.
1 #ifndef MEGAFLASHROMSCCPLUS_HH
2 #define MEGAFLASHROMSCCPLUS_HH
3 
4 #include "MSXRom.hh"
5 #include "SCC.hh"
6 #include "AY8910.hh"
7 #include "AmdFlash.hh"
8 
9 namespace openmsx {
10 
11 class MegaFlashRomSCCPlus final : public MSXRom
12 {
13 public:
14  MegaFlashRomSCCPlus(const DeviceConfig& config, Rom&& rom);
15  ~MegaFlashRomSCCPlus() 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  template<typename Archive>
28  void serialize(Archive& ar, unsigned version);
29 
30 private:
31  byte readMem2(word addr, EmuTime::param time);
32 
33  enum SCCEnable { EN_NONE, EN_SCC, EN_SCCPLUS };
34  SCCEnable getSCCEnable() const;
35 
36  unsigned getSubslot(unsigned address) const;
37  unsigned getFlashAddr(unsigned addr) const;
38 
39  SCC scc;
40  AY8910 psg;
41  AmdFlash flash;
42 
43  byte configReg;
44  byte offsetReg;
45  byte subslotReg;
46  byte bankRegs[4][4];
47  byte psgLatch;
48  byte sccMode;
49  byte sccBanks[4];
50 };
51 
52 } // namespace openmsx
53 
54 #endif
openmsx::MegaFlashRomSCCPlus::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: MegaFlashRomSCCPlus.cc:492
openmsx::MegaFlashRomSCCPlus::peekMem
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: MegaFlashRomSCCPlus.cc:269
openmsx::AmdFlash
Definition: AmdFlash.hh:18
openmsx::MegaFlashRomSCCPlus::~MegaFlashRomSCCPlus
~MegaFlashRomSCCPlus() override
Definition: MegaFlashRomSCCPlus.cc:193
openmsx::DeviceConfig
Definition: DeviceConfig.hh:20
openmsx::MegaFlashRomSCCPlus::serialize
void serialize(Archive &ar, unsigned version)
Definition: MegaFlashRomSCCPlus.cc:504
openmsx::MegaFlashRomSCCPlus::getWriteCacheLine
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: MegaFlashRomSCCPlus.cc:486
AY8910.hh
openmsx::MSXRom
Definition: MSXRom.hh:10
openmsx::MegaFlashRomSCCPlus::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: MegaFlashRomSCCPlus.cc:351
AmdFlash.hh
openmsx::SCC
Definition: SCC.hh:12
MSXRom.hh
openmsx::MegaFlashRomSCCPlus
Definition: MegaFlashRomSCCPlus.hh:12
openmsx::MegaFlashRomSCCPlus::readMem
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: MegaFlashRomSCCPlus.cc:296
openmsx::MegaFlashRomSCCPlus::powerUp
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
Definition: MegaFlashRomSCCPlus.cc:199
openmsx::MegaFlashRomSCCPlus::getReadCacheLine
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition: MegaFlashRomSCCPlus.cc:323
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::MegaFlashRomSCCPlus::MegaFlashRomSCCPlus
MegaFlashRomSCCPlus(const DeviceConfig &config, Rom &&rom)
Definition: MegaFlashRomSCCPlus.cc:179
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
SCC.hh
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::MegaFlashRomSCCPlus::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: MegaFlashRomSCCPlus.cc:205