| e8555c89 Andy McCall |
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 |
|
| 9 |
#include <optional> |
| 10 |
|
| 11 |
namespace openmsx { |
| 12 |
|
| 13 |
class DalSoRiR2 final : public MSXDevice, private Observer<Setting> |
| 14 |
{ |
| 15 |
public: |
| 16 |
explicit DalSoRiR2(DeviceConfig& config); |
| 17 |
~DalSoRiR2() override; |
| 18 |
|
| 19 |
void powerUp(EmuTime time) override; |
| 20 |
void reset(EmuTime time) override; |
| 21 |
[[nodiscard]] byte readIO(uint16_t port, EmuTime time) override; |
| 22 |
[[nodiscard]] byte peekIO(uint16_t port, EmuTime time) const override; |
| 23 |
void writeIO(uint16_t port, byte value, EmuTime time) override; |
| 24 |
byte readMem(uint16_t addr, EmuTime time) override; |
| 25 |
byte peekMem(uint16_t addr, EmuTime time) const override; |
| 26 |
const byte* getReadCacheLine(uint16_t start) const override; |
| 27 |
byte* getWriteCacheLine(uint16_t start) override; |
| 28 |
void writeMem(uint16_t addr, byte value, EmuTime time) override; |
| 29 |
|
| 30 |
template<typename Archive> |
| 31 |
void serialize(Archive& ar, unsigned version); |
| 32 |
|
| 33 |
private: |
| 34 |
void setRegCfg(byte value); |
| 35 |
std::optional<size_t> getSramAddr(uint16_t addr) const; |
| 36 |
unsigned getFlashAddr(uint16_t addr) const; |
| 37 |
|
| 38 |
void setupMemPtrs( |
| 39 |
bool mode0, |
| 40 |
std::span<const uint8_t> rom, |
| 41 |
std::span<const uint8_t> ram, |
| 42 |
std::span<YMF278::Block128, 32> memPtrs) const; |
| 43 |
|
| 44 |
|
| 45 |
void update(const Setting& setting) noexcept override; |
| 46 |
|
| 47 |
private: |
| 48 |
YMF278B ymf278b; |
| 49 |
|
| 50 |
Ram sram; |
| 51 |
AmdFlash flash; |
| 52 |
|
| 53 |
BooleanSetting dipSwitchBDIS; |
| 54 |
BooleanSetting dipSwitchMCFG; |
| 55 |
BooleanSetting dipSwitchIO_C0; |
| 56 |
BooleanSetting dipSwitchIO_C4; |
| 57 |
|
| 58 |
std::array<byte, 4> regBank = {}; |
| 59 |
std::array<byte, 2> regFrame = {}; |
| 60 |
byte regCfg = 0; |
| 61 |
|
| 62 |
bool biosDisable; |
| 63 |
}; |
| 64 |
|
| 65 |
} |
| 66 |
|
| 67 |
#endif |