openMSX
MSXPrinterPort.hh
Go to the documentation of this file.
1 #ifndef MSXPRINTERPORT_HH
2 #define MSXPRINTERPORT_HH
3 
4 #include "MSXDevice.hh"
5 #include "Connector.hh"
6 #include "SimpleDebuggable.hh"
7 
8 namespace openmsx {
9 
10 class PrinterPortDevice;
11 
12 class MSXPrinterPort final : public MSXDevice, public Connector
13 {
14 public:
15  explicit MSXPrinterPort(const DeviceConfig& config);
16 
18 
19  // MSXDevice
20  void reset(EmuTime::param time) override;
21  byte readIO(word port, EmuTime::param time) override;
22  byte peekIO(word port, EmuTime::param time) const override;
23  void writeIO(word port, byte value, EmuTime::param time) override;
24 
25  // Connector
26  std::string_view getDescription() const override;
27  std::string_view getClass() const override;
28  void plug(Pluggable& dev, EmuTime::param time) override;
29 
30  template<typename Archive>
31  void serialize(Archive& ar, unsigned version);
32 
33 private:
34  void setStrobe(bool newStrobe, EmuTime::param time);
35  void writeData(byte newData, EmuTime::param time);
36 
37  struct Debuggable final : SimpleDebuggable {
38  Debuggable(MSXMotherBoard& motherBoard, const std::string& name);
39  byte read(unsigned address) override;
40  void write(unsigned address, byte value) override;
41  } debuggable;
42 
43  bool strobe;
44  byte data;
45 };
46 
47 } // namespace openmsx
48 
49 #endif
openmsx::MSXDevice
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:32
openmsx::DeviceConfig
Definition: DeviceConfig.hh:20
openmsx::MSXPrinterPort
Definition: MSXPrinterPort.hh:13
openmsx::SimpleDebuggable
Definition: SimpleDebuggable.hh:12
openmsx::MSXPrinterPort::peekIO
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition: MSXPrinterPort.cc:35
openmsx::Pluggable
Definition: Pluggable.hh:12
openmsx::MSXPrinterPort::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: MSXPrinterPort.cc:24
openmsx::MSXPrinterPort::readIO
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
Definition: MSXPrinterPort.cc:30
openmsx::MSXPrinterPort::getPluggedPrintDev
PrinterPortDevice & getPluggedPrintDev() const
Definition: MSXPrinterPort.cc:88
openmsx::MSXPrinterPort::serialize
void serialize(Archive &ar, unsigned version)
Definition: MSXPrinterPort.cc:113
openmsx::MSXPrinterPort::writeIO
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: MSXPrinterPort.cc:42
openmsx::MSXMotherBoard
Definition: MSXMotherBoard.hh:60
MSXDevice.hh
SimpleDebuggable.hh
openmsx::MSXPrinterPort::getClass
std::string_view getClass() const override
A Connector belong to a certain class.
Definition: MSXPrinterPort.cc:76
Connector.hh
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::MSXPrinterPort::MSXPrinterPort
MSXPrinterPort(const DeviceConfig &config)
Definition: MSXPrinterPort.cc:13
openmsx::Connector
Represents something you can plug devices into.
Definition: Connector.hh:21
openmsx::MSXPrinterPort::getDescription
std::string_view getDescription() const override
Get a description for this connector.
Definition: MSXPrinterPort.cc:71
openmsx::PrinterPortDevice
Definition: PrinterPortDevice.hh:10
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::MSXPrinterPort::plug
void plug(Pluggable &dev, EmuTime::param time) override
This plugs a Pluggable in this Connector.
Definition: MSXPrinterPort.cc:81