OXYGENHUB
◆ main openmsx / src / cpu / VDPIODelay.hh
1.0 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef VDPIODELAY_HH
2
#define VDPIODELAY_HH
3
4
#include "Clock.hh"
5
#include "MSXDevice.hh"
6
7
#include <array>
8
9
namespace openmsx {
10
11
class MSXCPU;
12
class MSXCPUInterface;
13
14
class VDPIODelay final : public MSXDevice
15
{
16
public:
17
	VDPIODelay(const DeviceConfig& config, MSXCPUInterface& cpuInterface);
18
19
	[[nodiscard]] uint8_t readIO(uint16_t port, EmuTime time) override;
20
	[[nodiscard]] uint8_t peekIO(uint16_t port, EmuTime time) const override;
21
	void writeIO(uint16_t port, uint8_t value, EmuTime time) override;
22
23
	[[nodiscard]] const MSXDevice& getInDevice(uint8_t port) const;
24
	[[nodiscard]] MSXDevice*& getInDevicePtr (uint8_t port);
25
	[[nodiscard]] MSXDevice*& getOutDevicePtr(uint8_t port);
26
27
	template<typename Archive>
28
	void serialize(Archive& ar, unsigned version);
29
30
private:
31
	void delay(EmuTime time);
32
33
private:
34
	MSXCPU& cpu;
35
	std::array<MSXDevice*, 4> inDevices;
36
	std::array<MSXDevice*, 4> outDevices;
37
	/** Remembers the time at which last VDP I/O action took place. */
38
	Clock<7159090> lastTime{EmuTime::zero()};
39
};
40
41
} // namespace openmsx
42
43
#endif