openMSX
MSXMegaRam.hh
Go to the documentation of this file.
1 #ifndef MSXMEGARAM_HH
2 #define MSXMEGARAM_HH
3 
4 #include "MSXDevice.hh"
5 #include "Ram.hh"
6 #include "RomBlockDebuggable.hh"
7 #include <memory>
8 
9 namespace openmsx {
10 
11 class Rom;
12 
13 class MSXMegaRam final : public MSXDevice
14 {
15 public:
16  explicit MSXMegaRam(const DeviceConfig& config);
17  ~MSXMegaRam() override;
18 
19  void powerUp(EmuTime::param time) override;
20  void reset(EmuTime::param time) override;
21  byte readMem(word address, EmuTime::param time) override;
22  const byte* getReadCacheLine(word address) const override;
23  void writeMem(word address, byte value,
24  EmuTime::param time) override;
25  byte* getWriteCacheLine(word address) const override;
26 
27  byte readIO(word port, EmuTime::param time) override;
28  byte peekIO(word port, EmuTime::param time) const override;
29  void writeIO(word port, byte value, EmuTime::param time) override;
30 
31  template<typename Archive>
32  void serialize(Archive& ar, unsigned version);
33 
34 private:
35  void setBank(byte page, byte block);
36 
37  const unsigned numBlocks; // must come before ram
38  Ram ram;
39  const std::unique_ptr<Rom> rom; // can be nullptr
40  RomBlockDebuggable romBlockDebug;
41  const byte maskBlocks;
42  byte bank[4];
43  bool writeMode;
44  bool romMode;
45 };
46 
47 } // namespace openmsx
48 
49 #endif
openmsx::MSXDevice
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:32
openmsx::DeviceConfig
Definition: DeviceConfig.hh:20
openmsx::MSXMegaRam::peekIO
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition: MSXMegaRam.cc:122
openmsx::MSXMegaRam::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: MSXMegaRam.cc:58
openmsx::MSXMegaRam
Definition: MSXMegaRam.hh:14
Ram.hh
openmsx::MSXMegaRam::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: MSXMegaRam.cc:83
MSXDevice.hh
openmsx::MSXMegaRam::readMem
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: MSXMegaRam.cc:64
openmsx::MSXMegaRam::serialize
void serialize(Archive &ar, unsigned version)
Definition: MSXMegaRam.cc:151
openmsx::MSXMegaRam::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: MSXMegaRam.cc:127
openmsx::MSXMegaRam::~MSXMegaRam
~MSXMegaRam() override
openmsx::MSXMegaRam::powerUp
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
Definition: MSXMegaRam.cc:48
openmsx::RomBlockDebuggable
Definition: RomBlockDebuggable.hh:26
RomBlockDebuggable.hh
openmsx::Ram
Definition: Ram.hh:16
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::MSXMegaRam::readIO
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
Definition: MSXMegaRam.cc:106
openmsx::MSXMegaRam::getWriteCacheLine
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: MSXMegaRam.cc:93
openmsx::MSXMegaRam::getReadCacheLine
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition: MSXMegaRam.cc:69
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::MSXMegaRam::MSXMegaRam
MSXMegaRam(const DeviceConfig &config)
Definition: MSXMegaRam.cc:33