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"
6 #include "RomBlockDebuggable.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  [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
23  void writeMem(word address, byte value, EmuTime::param time) override;
24  [[nodiscard]] const byte* getReadCacheLine(word start) const override;
25 
26  template<typename Archive>
27  void serialize(Archive& ar, unsigned version);
28 
29 private:
30  [[nodiscard]] byte getBank() const;
31  void writeControl(byte value);
32 
33  [[nodiscard]] byte readDataLow(EmuTime::param time);
34  [[nodiscard]] byte readDataHigh(EmuTime::param time) const;
35  [[nodiscard]] word readData(EmuTime::param time);
36  [[nodiscard]] 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 private:
43  struct Blocks final : RomBlockDebuggableBase {
44  explicit Blocks(SunriseIDE& device);
45  [[nodiscard]] byte read(unsigned address) override;
46  } romBlockDebug;
47 
48  Rom rom;
49  std::unique_ptr<IDEDevice> device[2];
50  const byte* internalBank;
51  byte readLatch;
52  byte writeLatch;
53  byte selectedDevice;
54  byte control;
55  bool ideRegsEnabled;
56  bool softReset;
57 };
58 
59 } // namespace openmsx
60 
61 #endif
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:33
void reset(EmuTime::param time) override
This method is called on reset.
Definition: SunriseIDE.cc:35
~SunriseIDE() override
SunriseIDE(const DeviceConfig &config)
Definition: SunriseIDE.cc:10
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:215
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
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
Definition: SunriseIDE.cc:29
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
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint8_t nibble
4 bit integer
Definition: openmsx.hh:23
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29