openMSX
MSXE6Timer.hh
Go to the documentation of this file.
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 "MSXDevice.hh"
14#include "Clock.hh"
15
16namespace openmsx {
17
18class MSXE6Timer final : public MSXDevice
19{
20public:
21 explicit MSXE6Timer(const DeviceConfig& config);
22
23 void reset(EmuTime::param time) override;
24 [[nodiscard]] byte readIO(word port, EmuTime::param time) override;
25 void writeIO(word port, byte value, EmuTime::param time) override;
26 [[nodiscard]] byte peekIO(word port, EmuTime::param time) const override;
27
28 template<typename Archive>
29 void serialize(Archive& ar, unsigned version);
30
31private:
32 Clock<3579545, 14> reference; // (3.58 / 14)MHz
33};
34
35} // namespace openmsx
36
37#endif
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:33
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition: MSXE6Timer.cc:42
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.
Definition: MSXE6Timer.cc:17
MSXE6Timer(const DeviceConfig &config)
Definition: MSXE6Timer.cc:6
void serialize(Archive &ar, unsigned version)
Definition: MSXE6Timer.cc:49
void reset(EmuTime::param time) override
This method is called on reset.
Definition: MSXE6Timer.cc:12
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
Definition: MSXE6Timer.cc:37
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29