openMSX
MSXCielTurbo.cc
Go to the documentation of this file.
1#include "MSXCielTurbo.hh"
2#include "MSXCPU.hh"
3#include "LedStatus.hh"
4#include "serialize.hh"
5
6namespace openmsx {
7
9 : MSXDevice(config)
10{
11 reset(EmuTime::dummy());
12}
13
14void MSXCielTurbo::reset(EmuTime::param time)
15{
16 word port = 0; // dummy
17 writeIO(port, 0, time);
18}
19
20byte MSXCielTurbo::readIO(word /*port*/, EmuTime::param /*time*/)
21{
22 return lastValue;
23}
24
25byte MSXCielTurbo::peekIO(word /*port*/, EmuTime::param /*time*/) const
26{
27 return lastValue;
28}
29
30void MSXCielTurbo::writeIO(word /*port*/, byte value, EmuTime::param /*time*/)
31{
32 lastValue = value;
33 bool enabled = (value & 0x80) != 0;
34 unsigned freq = 3579545;
35 if (enabled) freq *= 2;
36 getCPU().setZ80Freq(freq);
38}
39
40template<typename Archive>
41void MSXCielTurbo::serialize(Archive& ar, unsigned /*version*/)
42{
43 ar.template serializeBase<MSXDevice>(*this);
44
45 ar.serialize("value", lastValue);
46 if constexpr (!Archive::IS_LOADER) {
47 word port = 0; // dummy
48 writeIO(port, lastValue, EmuTime::dummy());
49 }
50}
53
54} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:354
void setLed(Led led, bool status)
Definition LedStatus.cc:41
void setZ80Freq(unsigned freq)
Switch the Z80 clock freq.
Definition MSXCPU.cc:316
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.
MSXCielTurbo(const DeviceConfig &config)
void serialize(Archive &ar, unsigned version)
void reset(EmuTime::param time) override
This method is called on reset.
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition MSXDevice.hh:36
MSXCPU & getCPU() const
Definition MSXDevice.cc:129
LedStatus & getLedStatus() const
Definition MSXDevice.cc:153
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)