openMSX
MSXMatsushita.hh
Go to the documentation of this file.
1 #ifndef MSXMATSUSHITA_HH
2 #define MSXMATSUSHITA_HH
3 
4 #include "MSXDevice.hh"
5 #include "MSXSwitchedDevice.hh"
6 #include "FirmwareSwitch.hh"
7 #include "Clock.hh"
8 #include "serialize_meta.hh"
9 
10 namespace openmsx {
11 
12 class MSXCPU;
13 class SRAM;
14 class VDP;
15 
16 class MSXMatsushita final : public MSXDevice, public MSXSwitchedDevice
17 {
18 public:
19  explicit MSXMatsushita(const DeviceConfig& config);
20  void init() override;
21  ~MSXMatsushita() override;
22 
23  // MSXDevice
24  void reset(EmuTime::param time) override;
25  [[nodiscard]] byte readIO(word port, EmuTime::param time) override;
26  [[nodiscard]] byte peekIO(word port, EmuTime::param time) const override;
27  void writeIO(word port, byte value, EmuTime::param time) override;
28 
29  // MSXSwitchedDevice
30  [[nodiscard]] byte readSwitchedIO(word port, EmuTime::param time) override;
31  [[nodiscard]] byte peekSwitchedIO(word port, EmuTime::param time) const override;
32  void writeSwitchedIO(word port, byte value, EmuTime::param time) override;
33 
34  template<typename Archive>
35  void serialize(Archive& ar, unsigned version);
36 
37 private:
38  void unwrap();
39  void delay(EmuTime::param time);
40 
41 private:
42  MSXCPU& cpu;
43  VDP* vdp;
45  Clock<5369318> lastTime; // 5.3MHz = 3.5MHz * 3/2
46 
47  FirmwareSwitch firmwareSwitch;
48  const std::unique_ptr<SRAM> sram; // can be nullptr
49  word address;
50  nibble color1, color2;
51  byte pattern;
52  const bool turboAvailable;
53  bool turboEnabled;
54 };
56 
57 } // namespace openmsx
58 
59 #endif
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:32
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.
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
void serialize(Archive &ar, unsigned version)
void init() override
MSXMatsushita(const DeviceConfig &config)
void reset(EmuTime::param time) override
This method is called on reset.
byte peekSwitchedIO(word port, EmuTime::param time) const override
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
void writeSwitchedIO(word port, byte value, EmuTime::param time) override
byte readSwitchedIO(word port, EmuTime::param time) override
Unified implementation of MSX Video Display Processors (VDPs).
Definition: VDP.hh:63
This file implemented 3 utility functions:
Definition: Autofire.cc:5
uint8_t nibble
4 bit integer
Definition: openmsx.hh:23
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
SRAM
Definition: SRAM.cc:150