| e8555c89 Andy McCall |
1 |
#ifndef MSXMATSUSHITA_HH |
| 2 |
#define MSXMATSUSHITA_HH |
| 3 |
|
| 4 |
#include "Clock.hh" |
| 5 |
#include "EmuTime.hh" |
| 6 |
#include "FirmwareSwitch.hh" |
| 7 |
#include "MSXDevice.hh" |
| 8 |
#include "MSXSwitchedDevice.hh" |
| 9 |
#include "serialize_meta.hh" |
| 10 |
|
| 11 |
#include <cstdint> |
| 12 |
|
| 13 |
namespace openmsx { |
| 14 |
|
| 15 |
using uint4_t = uint8_t; |
| 16 |
|
| 17 |
class MSXCPU; |
| 18 |
class SRAM; |
| 19 |
class VDP; |
| 20 |
|
| 21 |
class MSXMatsushita final : public MSXDevice, public MSXSwitchedDevice |
| 22 |
{ |
| 23 |
public: |
| 24 |
explicit MSXMatsushita(const DeviceConfig& config); |
| 25 |
void init() override; |
| 26 |
~MSXMatsushita() override; |
| 27 |
|
| 28 |
|
| 29 |
void reset(EmuTime time) override; |
| 30 |
[[nodiscard]] uint8_t readIO(uint16_t port, EmuTime time) override; |
| 31 |
[[nodiscard]] uint8_t peekIO(uint16_t port, EmuTime time) const override; |
| 32 |
void writeIO(uint16_t port, uint8_t value, EmuTime time) override; |
| 33 |
|
| 34 |
|
| 35 |
[[nodiscard]] uint8_t readSwitchedIO(uint16_t port, EmuTime time) override; |
| 36 |
[[nodiscard]] uint8_t peekSwitchedIO(uint16_t port, EmuTime time) const override; |
| 37 |
void writeSwitchedIO(uint16_t port, uint8_t value, EmuTime time) override; |
| 38 |
|
| 39 |
template<typename Archive> |
| 40 |
void serialize(Archive& ar, unsigned version); |
| 41 |
|
| 42 |
private: |
| 43 |
void unwrap(); |
| 44 |
void delay(EmuTime time); |
| 45 |
|
| 46 |
private: |
| 47 |
MSXCPU& cpu; |
| 48 |
VDP* vdp = nullptr; |
| 49 |
|
| 50 |
Clock<5369318> lastTime{EmuTime::zero()}; |
| 51 |
|
| 52 |
FirmwareSwitch firmwareSwitch; |
| 53 |
const std::unique_ptr<SRAM> sram; |
| 54 |
uint16_t address; |
| 55 |
uint4_t color1, color2; |
| 56 |
uint8_t pattern; |
| 57 |
const bool turboAvailable; |
| 58 |
bool turboEnabled = false; |
| 59 |
}; |
| 60 |
SERIALIZE_CLASS_VERSION(MSXMatsushita, 2); |
| 61 |
|
| 62 |
} |
| 63 |
|
| 64 |
#endif |