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#include <cstdint>
8
9namespace openmsx {
10
11class PrinterPortDevice;
12
13class MSXPrinterPort final : public MSXDevice, public Connector
14{
15public:
16 explicit MSXPrinterPort(const DeviceConfig& config);
17
18 // MSXDevice
19 void reset(EmuTime::param time) override;
20 [[nodiscard]] uint8_t readIO(uint16_t port, EmuTime::param time) override;
21 [[nodiscard]] uint8_t peekIO(uint16_t port, EmuTime::param time) const override;
22 void writeIO(uint16_t port, uint8_t value, EmuTime::param time) override;
23
24 // Connector
25 [[nodiscard]] std::string_view getDescription() const override;
26 [[nodiscard]] std::string_view getClass() const override;
27 void plug(Pluggable& dev, EmuTime::param time) override;
28
29 template<typename Archive>
30 void serialize(Archive& ar, unsigned version);
31
32private:
33 [[nodiscard]] PrinterPortDevice& getPluggedPrintDev() const;
34 void setStrobe(bool newStrobe, EmuTime::param time);
35 void writeData(uint8_t newData, EmuTime::param time);
36
37private:
38 struct Debuggable final : SimpleDebuggable {
39 Debuggable(MSXMotherBoard& motherBoard, const std::string& name);
40 [[nodiscard]] uint8_t read(unsigned address) override;
41 void write(unsigned address, uint8_t value) override;
42 } debuggable;
43
44 bool strobe = false; // != true
45 uint8_t data = 255; // != 0
46 const uint8_t writePortMask;
47 const uint8_t readPortMask;
48 const uint8_t unusedBits;
49};
50
51} // namespace openmsx
52
53#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:36
void serialize(Archive &ar, unsigned version)
std::string_view getDescription() const override
Get a description for this connector.
uint8_t readIO(uint16_t port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
void reset(EmuTime::param time) override
This method is called on reset.
uint8_t peekIO(uint16_t port, EmuTime::param time) const override
Read a byte from a given IO port.
void writeIO(uint16_t port, uint8_t 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:11