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
10namespace openmsx {
11
12class PrinterPortDevice;
13
14class YamahaSKW01 final : public MSXDevice, public Connector
15{
16public:
17 explicit YamahaSKW01(const DeviceConfig& config);
18
19 // MSXDevice
20 void reset(EmuTime::param time) override;
21
22 [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
23 [[nodiscard]] byte peekMem(word address, EmuTime::param time) const override;
24 void writeMem(word address, byte value, EmuTime::param time) override;
25 [[nodiscard]] const byte* getReadCacheLine(word start) const override;
26 [[nodiscard]] byte* getWriteCacheLine(word start) const override;
27
28 // Connector
29 [[nodiscard]] std::string_view getDescription() const override;
30 [[nodiscard]] std::string_view getClass() const override;
31 void plug(Pluggable& dev, EmuTime::param time) override;
32
33 template<typename Archive>
34 void serialize(Archive& ar, unsigned version);
35
36private:
37 // printer port stuff
38 [[nodiscard]] PrinterPortDevice& getPluggedPrintDev() const;
39
40 void setStrobe(bool newStrobe, EmuTime::param time);
41 void writeData(uint8_t newData, EmuTime::param time);
42
43private:
44 Rom mainRom;
45 Rom fontRom;
46 Rom dataRom;
47 SRAM sram;
48 std::array<uint16_t, 4> fontAddress;
49 uint16_t dataAddress;
50
51 // printer port stuff
52 bool strobe = false; // != true
53 uint8_t data = 255; // != 0
54};
55
56} // namespace openmsx
57
58#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
YamahaSKW01(const DeviceConfig &config)
Definition: YamahaSKW01.cc:23
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: YamahaSKW01.cc:59
void plug(Pluggable &dev, EmuTime::param time) override
This plugs a Pluggable in this Connector.
Definition: YamahaSKW01.cc:161
byte * getWriteCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: YamahaSKW01.cc:125
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.
Definition: YamahaSKW01.cc:87
void reset(EmuTime::param time) override
This method is called on reset.
Definition: YamahaSKW01.cc:45
std::string_view getDescription() const override
Get a description for this connector.
Definition: YamahaSKW01.cc:151
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: YamahaSKW01.cc:54
void serialize(Archive &ar, unsigned version)
Definition: YamahaSKW01.cc:174
std::string_view getClass() const override
A Connector belong to a certain class.
Definition: YamahaSKW01.cc:156
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition: YamahaSKW01.cc:113
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29