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 "SRAM.hh"
8 #include "Clock.hh"
9 #include "serialize_meta.hh"
10 
11 namespace openmsx {
12 
13 class MSXCPU;
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;
22 
23  // MSXDevice
24  void reset(EmuTime::param time) override;
25  byte readIO(word port, EmuTime::param time) override;
26  byte peekIO(word port, EmuTime::param time) const override;
27  void writeIO(word port, byte value, EmuTime::param time) override;
28 
29  // MSXSwitchedDevice
30  byte readSwitchedIO(word port, EmuTime::param time) override;
31  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 delay(EmuTime::param time);
39 
40  MSXCPU& cpu;
41  VDP* vdp;
43  Clock<5369318> lastTime; // 5.3MHz = 3.5MHz * 3/2
44 
45  FirmwareSwitch firmwareSwitch;
46  const std::unique_ptr<SRAM> sram; // can be nullptr
47  word address;
48  nibble color1, color2;
49  byte pattern;
50  const bool turboAvailable;
51  bool turboEnabled;
52 };
54 
55 } // namespace openmsx
56 
57 #endif
void writeSwitchedIO(word port, byte value, EmuTime::param time) override
byte readSwitchedIO(word port, EmuTime::param time) override
MSXMatsushita(const DeviceConfig &config)
void init() override
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX...
Definition: MSXDevice.hh:31
unsigned char byte
8 bit unsigned integer
Definition: openmsx.hh:25
unsigned char nibble
4 bit integer
Definition: openmsx.hh:22
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
Unified implementation of MSX Video Display Processors (VDPs).
Definition: VDP.hh:60
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.
void reset(EmuTime::param time) override
This method is called on reset.
void serialize(Archive &ar, unsigned version)
unsigned short word
16 bit unsigned integer
Definition: openmsx.hh:28
byte peekSwitchedIO(word port, EmuTime::param time) const override