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 
7 namespace openmsx {
8 
9 class MSXHiResTimer final : public MSXDevice
10 {
11 public:
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  byte readIO(word port, EmuTime::param time) override;
18  byte peekIO(word port, EmuTime::param 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
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
MSXHiResTimer(const DeviceConfig &config)
Definition: MSXHiResTimer.cc:6
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX...
Definition: MSXDevice.hh:31
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.
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
void reset(EmuTime::param time) override
This method is called on reset.
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
void serialize(Archive &ar, unsigned version)