MSXE6Timer.hh 962 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. #ifndef MSXE6TIMER_HH
  10. #define MSXE6TIMER_HH
  11. #include "MSXDevice.hh"
  12. #include "Clock.hh"
  13. namespace openmsx {
  14. class MSXE6Timer final : public MSXDevice
  15. {
  16. public:
  17. explicit MSXE6Timer(const DeviceConfig& config);
  18. void reset(EmuTime::param time) override;
  19. byte readIO(word port, EmuTime::param time) override;
  20. void writeIO(word port, byte value, EmuTime::param time) override;
  21. byte peekIO(word port, EmuTime::param time) const override;
  22. template<typename Archive>
  23. void serialize(Archive& ar, unsigned version);
  24. private:
  25. Clock<3579545, 14> reference; // (3.58 / 14)MHz
  26. };
  27. } // namespace openmsx
  28. #endif