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