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  [[nodiscard]] byte peekMem(word address, EmuTime::param time) const override;
20  [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
21  [[nodiscard]] const byte* getReadCacheLine(word address) const override;
22  void writeMem(word address, byte value, EmuTime::param time) override;
23  [[nodiscard]] 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  [[nodiscard]] byte readMem2(word addr, EmuTime::param time);
32 
33  enum SCCEnable { EN_NONE, EN_SCC, EN_SCCPLUS };
34  [[nodiscard]] SCCEnable getSCCEnable() const;
35 
36  [[nodiscard]] unsigned getSubslot(unsigned address) const;
37  [[nodiscard]] unsigned getFlashAddr(unsigned addr) const;
38 
39 private:
40  SCC scc;
41  AY8910 psg;
42  AmdFlash flash;
43 
44  byte configReg;
45  byte offsetReg;
46  byte subslotReg;
47  byte bankRegs[4][4];
48  byte psgLatch;
49  byte sccMode;
50  byte sccBanks[4];
51 };
52 
53 } // namespace openmsx
54 
55 #endif
This class implements the AY-3-8910 sound chip.
Definition: AY8910.hh:20
void reset(EmuTime::param time) override
This method is called on reset.
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
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.
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
MegaFlashRomSCCPlus(const DeviceConfig &config, Rom &&rom)
void serialize(Archive &ar, unsigned version)
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.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29