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
void setLed(Led led, bool status)
Definition: LedStatus.cc:41
void setZ80Freq(unsigned freq)
Switch the Z80 clock freq.
Definition: MSXCPU.cc:313
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: MSXCielTurbo.cc:30
MSXCielTurbo(const DeviceConfig &config)
Definition: MSXCielTurbo.cc:8
void serialize(Archive &ar, unsigned version)
Definition: MSXCielTurbo.cc:41
void reset(EmuTime::param time) override
This method is called on reset.
Definition: MSXCielTurbo.cc:14
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
Definition: MSXCielTurbo.cc:20
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition: MSXCielTurbo.cc:25
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:34
MSXCPU & getCPU() const
Definition: MSXDevice.cc:129
LedStatus & getLedStatus() const
Definition: MSXDevice.cc:153
This file implemented 3 utility functions:
Definition: Autofire.cc:9
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:1021