openMSX
SunriseIDE.hh
Go to the documentation of this file.
1 #ifndef SUNRISEIDE_HH
2 #define SUNRISEIDE_HH
3 
4 #include "MSXDevice.hh"
5 #include "Rom.hh"
7 #include <memory>
8 
9 namespace openmsx {
10 
11 class IDEDevice;
12 
13 class SunriseIDE final : public MSXDevice
14 {
15 public:
16  explicit SunriseIDE(const DeviceConfig& config);
17  ~SunriseIDE() override;
18 
19  void powerUp(EmuTime::param time) override;
20  void reset(EmuTime::param time) override;
21 
22  byte readMem(word address, EmuTime::param time) override;
23  void writeMem(word address, byte value, EmuTime::param time) override;
24  const byte* getReadCacheLine(word start) const override;
25 
26  template<typename Archive>
27  void serialize(Archive& ar, unsigned version);
28 
29 private:
30  byte getBank() const;
31  void writeControl(byte value);
32 
33  byte readDataLow(EmuTime::param time);
34  byte readDataHigh(EmuTime::param time);
35  word readData(EmuTime::param time);
36  byte readReg(nibble reg, EmuTime::param time);
37  void writeDataLow(byte value);
38  void writeDataHigh(byte value, EmuTime::param time);
39  void writeData(word value, EmuTime::param time);
40  void writeReg(nibble reg, byte value, EmuTime::param time);
41 
42  struct Blocks final : RomBlockDebuggableBase {
43  explicit Blocks(SunriseIDE& device);
44  byte read(unsigned address) override;
45  } romBlockDebug;
46 
47  Rom rom;
48  std::unique_ptr<IDEDevice> device[2];
49  const byte* internalBank;
50  byte readLatch;
51  byte writeLatch;
52  byte selectedDevice;
53  byte control;
54  bool ideRegsEnabled;
55  bool softReset;
56 };
57 
58 } // namespace openmsx
59 
60 #endif
~SunriseIDE() override
bool getEnum() const noexcept
Definition: EnumSetting.hh:96
void reset(EmuTime::param time) override
This method is called on reset.
Definition: SunriseIDE.cc:35
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: SunriseIDE.cc:43
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: SunriseIDE.cc:79
void serialize(Archive &ar, unsigned version)
Definition: SunriseIDE.cc:217
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX...
Definition: MSXDevice.hh:31
SunriseIDE(const DeviceConfig &config)
Definition: SunriseIDE.cc:10
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
Definition: SunriseIDE.cc:29
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading...
Definition: SunriseIDE.cc:65