OXYGENHUB
◆ main openmsx / src / MSXE6Timer.hh
974 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
/*
2
 * This class implements a simple timer, used in a TurboR.
3
 * This is a 16-bit (up) counter running at 255681Hz (3.58MHz / 14).
4
 * The least significant byte can be read from port 0xE6.
5
 *     most                                         0xE7.
6
 * Writing a random value to port 0xE6 resets the counter.
7
 * Writing to port 0xE7 has no effect.
8
 */
9
10
#ifndef MSXE6TIMER_HH
11
#define MSXE6TIMER_HH
12
13
#include "Clock.hh"
14
#include "MSXDevice.hh"
15
16
namespace openmsx {
17
18
class MSXE6Timer final : public MSXDevice
19
{
20
public:
21
	explicit MSXE6Timer(const DeviceConfig& config);
22
23
	void reset(EmuTime time) override;
24
	[[nodiscard]] byte readIO(uint16_t port, EmuTime time) override;
25
	void writeIO(uint16_t port, byte value, EmuTime time) override;
26
	[[nodiscard]] byte peekIO(uint16_t port, EmuTime time) const override;
27
28
	template<typename Archive>
29
	void serialize(Archive& ar, unsigned version);
30
31
private:
32
	Clock<3579545, 14> reference; // (3.58 / 14)MHz
33
};
34
35
} // namespace openmsx
36
37
#endif