openMSX
DalSoRiR2.hh
Go to the documentation of this file.
1#ifndef DALSORIR2_HH
2#define DALSORIR2_HH
3
4#include "AmdFlash.hh"
5#include "MSXDevice.hh"
6#include "Observer.hh"
7#include "YMF278B.hh"
8
9namespace openmsx {
10
11class DalSoRiR2 final : public MSXDevice, private Observer<Setting>
12{
13public:
14 explicit DalSoRiR2(const DeviceConfig& config);
15 ~DalSoRiR2() override;
16
17 void powerUp(EmuTime::param time) override;
18 void reset(EmuTime::param time) override;
19 [[nodiscard]] byte readIO(word port, EmuTime::param time) override;
20 [[nodiscard]] byte peekIO(word port, EmuTime::param time) const override;
21 void writeIO(word port, byte value, EmuTime::param time) override;
22 byte readMem(word addr, EmuTime::param time) override;
23 byte peekMem(word addr, EmuTime::param time) const override;
24 const byte* getReadCacheLine(word start) const override;
25 byte* getWriteCacheLine(word start) override;
26 void writeMem(word addr, byte value, EmuTime::param time) override;
27
28 template<typename Archive>
29 void serialize(Archive& ar, unsigned version);
30
31private:
32 void setRegCfg(byte value);
33 byte* getSramAddr(word addr);
34 unsigned getFlashAddr(word addr) const;
35
36 void setupMemPtrs(
37 bool mode0,
38 std::span<const uint8_t> rom,
39 std::span<const uint8_t> ram,
40 std::span<YMF278::Block128, 32> memPtrs);
41
42 // Observer<Setting>
43 void update(const Setting& setting) noexcept override;
44
45private:
46 YMF278B ymf278b;
47
48 Ram sram;
49 AmdFlash flash;
50
51 BooleanSetting dipSwitchBDIS;
52 BooleanSetting dipSwitchMCFG;
53 BooleanSetting dipSwitchIO_C0;
54 BooleanSetting dipSwitchIO_C4;
55
56 std::array<byte, 4> regBank = {};
57 std::array<byte, 2> regFrame = {};
58 byte regCfg = 0;
59
60 bool biosDisable;
61};
62
63} // namespace openmsx
64
65#endif
BaseSetting * setting
void writeMem(word addr, byte value, EmuTime::param time) override
Write a given byte to a given location at a certain time to this device.
Definition DalSoRiR2.cc:211
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 DalSoRiR2.cc:148
byte peekMem(word addr, EmuTime::param time) const override
Read a byte from a given memory location.
Definition DalSoRiR2.cc:191
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition DalSoRiR2.cc:201
byte readMem(word addr, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition DalSoRiR2.cc:181
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
Definition DalSoRiR2.cc:138
~DalSoRiR2() override
Definition DalSoRiR2.cc:52
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
Definition DalSoRiR2.cc:94
void reset(EmuTime::param time) override
This method is called on reset.
Definition DalSoRiR2.cc:100
byte * getWriteCacheLine(word start) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition DalSoRiR2.cc:230
void serialize(Archive &ar, unsigned version)
Definition DalSoRiR2.cc:252
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition DalSoRiR2.cc:143
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition MSXDevice.hh:36
Generic Gang-of-Four Observer class, templatized edition.
Definition Observer.hh:10
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29