openMSX
MSXResetStatusRegister.cc
Go to the documentation of this file.
2#include "serialize.hh"
3
4namespace openmsx {
5
7 : MSXDevice(config)
8 , inverted(config.getChildDataAsBool("inverted", false))
9{
10 reset(EmuTime::dummy());
11}
12
13void MSXResetStatusRegister::reset(EmuTime::param /*time*/)
14{
15 status = inverted ? 0xFF : 0x00;
16}
17
18byte MSXResetStatusRegister::readIO(word port, EmuTime::param time)
19{
20 return peekIO(port, time);
21}
22
23byte MSXResetStatusRegister::peekIO(word /*port*/, EmuTime::param /*time*/) const
24{
25 return status;
26}
27
28void MSXResetStatusRegister::writeIO(word /*port*/, byte value, EmuTime::param /*time*/)
29{
30 if (inverted) {
31 status = value | 0x7F;
32 } else {
33 status = (status & 0x20) | (value & 0xA0);
34 }
35}
36
37template<typename Archive>
38void MSXResetStatusRegister::serialize(Archive& ar, unsigned /*version*/)
39{
40 ar.template serializeBase<MSXDevice>(*this);
41 ar.serialize("status", status);
42}
44REGISTER_MSXDEVICE(MSXResetStatusRegister, "F4Device"); // TODO: find a way to handle renames of classes and keep bw compat with savestates....
45
46} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:356
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition MSXDevice.hh:36
MSXResetStatusRegister(const DeviceConfig &config)
void serialize(Archive &ar, unsigned version)
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
void reset(EmuTime::param time) override
This method is called on reset.
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.
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
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)