openMSX
MSXRam.hh
Go to the documentation of this file.
1#ifndef MSXRAM_HH
2#define MSXRAM_HH
3
4#include "MSXDevice.hh"
5#include "CheckedRam.hh"
6#include <optional>
7
8namespace openmsx {
9
10class MSXRam final : public MSXDevice
11{
12public:
13 explicit MSXRam(const DeviceConfig& config);
14
15 void powerUp(EmuTime::param time) override;
16 [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
17 void writeMem(word address, byte value, EmuTime::param time) override;
18 [[nodiscard]] const byte* getReadCacheLine(word start) const override;
19 [[nodiscard]] byte* getWriteCacheLine(word start) const override;
20 [[nodiscard]] byte peekMem(word address, EmuTime::param time) const override;
21
22 template<typename Archive>
23 void serialize(Archive& ar, unsigned version);
24
25private:
26 void init() override;
27 [[nodiscard]] inline unsigned translate(unsigned address) const;
28
29private:
30 /*const*/ unsigned base;
31 /*const*/ unsigned size;
32 /*const*/ std::optional<CheckedRam> checkedRam;
33};
34
35} // namespace openmsx
36
37#endif
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:34
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: MSXRam.cc:53
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition: MSXRam.cc:58
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
Definition: MSXRam.cc:31
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: MSXRam.cc:43
void serialize(Archive &ar, unsigned version)
Definition: MSXRam.cc:69
MSXRam(const DeviceConfig &config)
Definition: MSXRam.cc:9
byte * getWriteCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: MSXRam.cc:63
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: MSXRam.cc:48
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29