openMSX
Y8950KeyboardConnector.cc
Go to the documentation of this file.
2
5
6#include "serialize.hh"
7
8#include "checked_cast.hh"
9
10#include <memory>
11
12namespace openmsx {
13
15 PluggingController& pluggingController_)
16 : Connector(pluggingController_, "audiokeyboardport",
17 std::make_unique<DummyY8950KeyboardDevice>())
18{
19}
20
21void Y8950KeyboardConnector::write(byte newData, EmuTime::param time)
22{
23 if (newData != data) {
24 data = newData;
25 getPluggedKeyb().write(data, time);
26 }
27}
28
29byte Y8950KeyboardConnector::read(EmuTime::param time) const
30{
31 return getPluggedKeyb().read(time);
32}
33
34byte Y8950KeyboardConnector::peek(EmuTime::param time) const
35{
36 // TODO implement proper peek
37 return read(time);
38}
39
41{
42 return "MSX-AUDIO keyboard connector";
43}
44
45std::string_view Y8950KeyboardConnector::getClass() const
46{
47 return "Y8950 Keyboard Port";
48}
49
50void Y8950KeyboardConnector::plug(Pluggable& dev, EmuTime::param time)
51{
52 Connector::plug(dev, time);
53 getPluggedKeyb().write(data, time);
54}
55
57{
58 return *checked_cast<Y8950KeyboardDevice*>(&getPlugged());
59}
60
61template<typename Archive>
62void Y8950KeyboardConnector::serialize(Archive& ar, unsigned /*version*/)
63{
64 ar.template serializeBase<Connector>(*this);
65 // don't serialize 'data', done in Y8950
66}
68
69} // namespace openmsx
Represents something you can plug devices into.
Definition Connector.hh:21
Pluggable & getPlugged() const
Returns the Pluggable currently plugged in.
Definition Connector.hh:61
virtual void plug(Pluggable &device, EmuTime::param time)
This plugs a Pluggable in this Connector.
Definition Connector.cc:25
Central administration of Connectors and Pluggables.
std::string_view getClass() const override
A Connector belong to a certain class.
byte read(EmuTime::param time) const
void write(byte data, EmuTime::param time)
std::string_view getDescription() const override
Get a description for this connector.
void plug(Pluggable &dev, EmuTime::param time) override
This plugs a Pluggable in this Connector.
Y8950KeyboardConnector(PluggingController &pluggingController)
byte peek(EmuTime::param time) const
void serialize(Archive &ar, unsigned version)
Y8950KeyboardDevice & getPluggedKeyb() const
virtual void write(byte data, EmuTime::param time)=0
Send data to the device.
virtual byte read(EmuTime::param time)=0
Read data from the device.
This file implemented 3 utility functions:
Definition Autofire.cc:11
STL namespace.
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)