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