| 1 |
#ifndef YAMAHASKW01_HH |
| 2 |
#define YAMAHASKW01_HH |
| 3 |
|
| 4 |
#include "Connector.hh" |
| 5 |
#include "MSXDevice.hh" |
| 6 |
#include "Rom.hh" |
| 7 |
#include "SRAM.hh" |
| 8 |
|
| 9 |
#include <array> |
| 10 |
#include <optional> |
| 11 |
|
| 12 |
namespace openmsx { |
| 13 |
|
| 14 |
class PrinterPortDevice; |
| 15 |
|
| 16 |
class YamahaSKW01PrinterPort final : public Connector |
| 17 |
{ |
| 18 |
public: |
| 19 |
YamahaSKW01PrinterPort(PluggingController& pluggingController, const std::string& name); |
| 20 |
|
| 21 |
|
| 22 |
void reset(EmuTime time); |
| 23 |
[[nodiscard]] bool getStatus(EmuTime time) const; |
| 24 |
void setStrobe(bool newStrobe, EmuTime time); |
| 25 |
void writeData(uint8_t newData, EmuTime time); |
| 26 |
|
| 27 |
|
| 28 |
[[nodiscard]] zstring_view getDescription() const override; |
| 29 |
[[nodiscard]] zstring_view getClass() const override; |
| 30 |
void plug(Pluggable& dev, EmuTime time) override; |
| 31 |
|
| 32 |
template<typename Archive> |
| 33 |
void serialize(Archive& ar, unsigned version); |
| 34 |
|
| 35 |
private: |
| 36 |
[[nodiscard]] PrinterPortDevice& getPluggedPrintDev() const; |
| 37 |
|
| 38 |
|
| 39 |
private: |
| 40 |
bool strobe = false; |
| 41 |
uint8_t data = 255; |
| 42 |
}; |
| 43 |
|
| 44 |
class YamahaSKW01 final : public MSXDevice |
| 45 |
{ |
| 46 |
public: |
| 47 |
explicit YamahaSKW01(DeviceConfig& config); |
| 48 |
|
| 49 |
|
| 50 |
void reset(EmuTime time) override; |
| 51 |
|
| 52 |
[[nodiscard]] byte readMem(uint16_t address, EmuTime time) override; |
| 53 |
[[nodiscard]] byte peekMem(uint16_t address, EmuTime time) const override; |
| 54 |
void writeMem(uint16_t address, byte value, EmuTime time) override; |
| 55 |
[[nodiscard]] const byte* getReadCacheLine(uint16_t start) const override; |
| 56 |
[[nodiscard]] byte* getWriteCacheLine(uint16_t start) override; |
| 57 |
|
| 58 |
template<typename Archive> |
| 59 |
void serialize(Archive& ar, unsigned version); |
| 60 |
|
| 61 |
private: |
| 62 |
Rom mainRom; |
| 63 |
std::optional<Rom> fontRom; |
| 64 |
Rom dataRom; |
| 65 |
SRAM sram; |
| 66 |
std::array<uint16_t, 4> fontAddress; |
| 67 |
uint16_t dataAddress; |
| 68 |
|
| 69 |
std::optional<YamahaSKW01PrinterPort> printerPort; |
| 70 |
}; |
| 71 |
|
| 72 |
} |
| 73 |
|
| 74 |
#endif |