OXYGENHUB
◆ main openmsx / src / MSXHiResTimer.hh
705 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#ifndef MSXHIRESTIMER_HH
2
#define MSXHIRESTIMER_HH
3
4
#include "Clock.hh"
5
#include "MSXDevice.hh"
6
7
namespace openmsx {
8
9
class MSXHiResTimer final : public MSXDevice
10
{
11
public:
12
	explicit MSXHiResTimer(const DeviceConfig& config);
13
14
	void reset(EmuTime time) override;
15
16
	void writeIO(uint16_t port, byte value, EmuTime time) override;
17
	[[nodiscard]] byte readIO(uint16_t port, EmuTime time) override;
18
	[[nodiscard]] byte peekIO(uint16_t port, EmuTime time) const override;
19
20
	template<typename Archive>
21
	void serialize(Archive& ar, unsigned version);
22
23
private:
24
	Clock<3579545> reference; // last time the counter was reset
25
	unsigned latchedValue;    // last latched timer value
26
};
27
28
} // namespace openmsx
29
30
#endif