openMSX
MSXHiResTimer.hh
Go to the documentation of this file.
1#ifndef MSXHIRESTIMER_HH
2#define MSXHIRESTIMER_HH
3
4#include "MSXDevice.hh"
5#include "Clock.hh"
6
7namespace openmsx {
8
9class MSXHiResTimer final : public MSXDevice
10{
11public:
12 explicit MSXHiResTimer(const DeviceConfig& config);
13
14 void reset(EmuTime::param time) override;
15
16 void writeIO(word port, byte value, EmuTime::param time) override;
17 [[nodiscard]] byte readIO(word port, EmuTime::param time) override;
18 [[nodiscard]] byte peekIO(word port, EmuTime::param time) const override;
19
20 template<typename Archive>
21 void serialize(Archive& ar, unsigned version);
22
23private:
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
Represents a clock with a fixed frequency.
Definition Clock.hh:19
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition MSXDevice.hh:36
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port at a certain time to this device.
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
void serialize(Archive &ar, unsigned version)
void reset(EmuTime::param time) override
This method is called on reset.
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29