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#include <span>
9
10namespace openmsx {
11
12class IDEDevice;
13
14class SunriseIDE final : public MSXDevice
15{
16public:
17 explicit SunriseIDE(const DeviceConfig& config);
18 ~SunriseIDE() override;
19
20 void powerUp(EmuTime::param time) override;
21 void reset(EmuTime::param time) override;
22
23 [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
24 void writeMem(word address, byte value, EmuTime::param time) override;
25 [[nodiscard]] const byte* getReadCacheLine(word start) const override;
26
27 template<typename Archive>
28 void serialize(Archive& ar, unsigned version);
29
30private:
31 [[nodiscard]] byte getBank() const;
32 void writeControl(byte value);
33
34 [[nodiscard]] byte readDataLow(EmuTime::param time);
35 [[nodiscard]] byte readDataHigh(EmuTime::param time) const;
36 [[nodiscard]] word readData(EmuTime::param time);
37 [[nodiscard]] byte readReg(nibble reg, EmuTime::param time);
38 void writeDataLow(byte value);
39 void writeDataHigh(byte value, EmuTime::param time);
40 void writeData(word value, EmuTime::param time);
41 void writeReg(nibble reg, byte value, EmuTime::param time);
42
43private:
44 struct Blocks final : RomBlockDebuggableBase {
45 explicit Blocks(const SunriseIDE& device);
46 [[nodiscard]] byte read(unsigned address) override;
47 } romBlockDebug;
48
49 Rom rom;
50 std::array<std::unique_ptr<IDEDevice>, 2> device;
51 std::span<const byte, 0x4000> internalBank;
52 byte readLatch;
53 byte writeLatch;
54 byte selectedDevice;
55 byte control;
56 bool ideRegsEnabled = false;
57 bool softReset;
58};
59
60} // namespace openmsx
61
62#endif
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition MSXDevice.hh:36
void reset(EmuTime::param time) override
This method is called on reset.
Definition SunriseIDE.cc:33
~SunriseIDE() override
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:77
void serialize(Archive &ar, unsigned version)
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:63
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
Definition SunriseIDE.cc:27
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition SunriseIDE.cc:41
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint8_t nibble
4 bit integer
Definition openmsx.hh:23
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29