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 
17  [[nodiscard]] PrinterPortDevice& getPluggedPrintDev() const;
18 
19  // MSXDevice
20  void reset(EmuTime::param time) override;
21  [[nodiscard]] byte readIO(word port, EmuTime::param time) override;
22  [[nodiscard]] byte peekIO(word port, EmuTime::param time) const override;
23  void writeIO(word port, byte value, EmuTime::param time) override;
24 
25  // Connector
26  [[nodiscard]] std::string_view getDescription() const override;
27  [[nodiscard]] 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 private:
38  struct Debuggable final : SimpleDebuggable {
39  Debuggable(MSXMotherBoard& motherBoard, const std::string& name);
40  [[nodiscard]] byte read(unsigned address) override;
41  void write(unsigned address, byte value) override;
42  } debuggable;
43 
44  bool strobe;
45  byte data;
46 };
47 
48 } // namespace openmsx
49 
50 #endif
Represents something you can plug devices into.
Definition: Connector.hh:21
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:32
void serialize(Archive &ar, unsigned version)
std::string_view getDescription() const override
Get a description for this connector.
MSXPrinterPort(const DeviceConfig &config)
void reset(EmuTime::param time) override
This method is called on reset.
PrinterPortDevice & getPluggedPrintDev() const
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.
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.
std::string_view getClass() const override
A Connector belong to a certain class.
void plug(Pluggable &dev, EmuTime::param time) override
This plugs a Pluggable in this Connector.
This file implemented 3 utility functions:
Definition: Autofire.cc:5
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29