openMSX
YamahaSKW01.hh
Go to the documentation of this file.
1#ifndef YAMAHASKW01_HH
2#define YAMAHASKW01_HH
3
4#include "MSXDevice.hh"
5#include "Connector.hh"
6#include "SRAM.hh"
7#include "Rom.hh"
8#include <array>
9#include <optional>
10
11namespace openmsx {
12
13class PrinterPortDevice;
14
16{
17public:
18 YamahaSKW01PrinterPort(PluggingController& pluggingController, const std::string& name);
19
20 // printer port functionality
21 void reset(EmuTime::param time);
22 [[nodiscard]] bool getStatus(EmuTime::param time) const;
23 void setStrobe(bool newStrobe, EmuTime::param time);
24 void writeData(uint8_t newData, EmuTime::param time);
25
26 // Connector
27 [[nodiscard]] std::string_view getDescription() const override;
28 [[nodiscard]] std::string_view getClass() const override;
29 void plug(Pluggable& dev, EmuTime::param time) override;
30
31 template<typename Archive>
32 void serialize(Archive& ar, unsigned version);
33
34private:
35 [[nodiscard]] PrinterPortDevice& getPluggedPrintDev() const;
36
37
38private:
39 bool strobe = false; // != true
40 uint8_t data = 255; // != 0
41};
42
43class YamahaSKW01 final : public MSXDevice
44{
45public:
46 explicit YamahaSKW01(const DeviceConfig& config);
47
48 // MSXDevice
49 void reset(EmuTime::param time) override;
50
51 [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
52 [[nodiscard]] byte peekMem(word address, EmuTime::param time) const override;
53 void writeMem(word address, byte value, EmuTime::param time) override;
54 [[nodiscard]] const byte* getReadCacheLine(word start) const override;
55 [[nodiscard]] byte* getWriteCacheLine(word start) override;
56
57 template<typename Archive>
58 void serialize(Archive& ar, unsigned version);
59
60private:
61 Rom mainRom;
62 Rom fontRom;
63 Rom dataRom;
64 SRAM sram;
65 std::array<uint16_t, 4> fontAddress;
66 uint16_t dataAddress;
67
68 std::optional<YamahaSKW01PrinterPort> printerPort;
69};
70
71} // namespace openmsx
72
73#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
Central administration of Connectors and Pluggables.
void reset(EmuTime::param time)
void setStrobe(bool newStrobe, EmuTime::param time)
void plug(Pluggable &dev, EmuTime::param time) override
This plugs a Pluggable in this Connector.
void serialize(Archive &ar, unsigned version)
bool getStatus(EmuTime::param time) const
std::string_view getClass() const override
A Connector belong to a certain class.
std::string_view getDescription() const override
Get a description for this connector.
void writeData(uint8_t newData, EmuTime::param time)
byte * getWriteCacheLine(word start) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
void writeMem(word address, byte value, EmuTime::param time) override
Write a given byte to a given location at a certain time to this device.
void reset(EmuTime::param time) override
This method is called on reset.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
void serialize(Archive &ar, unsigned version)
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29