openMSX
MSXPSG.hh
Go to the documentation of this file.
1#ifndef MSXPSG_HH
2#define MSXPSG_HH
3
4#include "MSXDevice.hh"
5#include "AY8910.hh"
6#include "AY8910Periphery.hh"
7#include "serialize_meta.hh"
8#include <array>
9
10namespace openmsx {
11
12class CassettePortInterface;
13class RenShaTurbo;
14class JoystickPortIf;
15
16class MSXPSG final : public MSXDevice, public AY8910Periphery
17{
18public:
19 explicit MSXPSG(const DeviceConfig& config);
20 ~MSXPSG() override;
21
22 void reset(EmuTime::param time) override;
23 void powerDown(EmuTime::param time) override;
24 [[nodiscard]] byte readIO(word port, EmuTime::param time) override;
25 [[nodiscard]] byte peekIO(word port, EmuTime::param time) const override;
26 void writeIO(word port, byte value, EmuTime::param time) override;
27
28 template<typename Archive>
29 void serialize(Archive& ar, unsigned version);
30
31private:
32 // AY8910Periphery: port A input, port B output
33 [[nodiscard]] byte readA(EmuTime::param time) override;
34 void writeB(byte value, EmuTime::param time) override;
35
36private:
37 CassettePortInterface& cassette;
38 RenShaTurbo& renShaTurbo;
39
40 std::array<JoystickPortIf*, 2> ports;
41 int selectedPort = 0;
42 int registerLatch;
43 byte prev = 255;
44 const byte keyLayout; // 0x40 or 0x00
45 const byte addressMask; // controls address mirroring
46 AY8910 ay8910; // must come after initialisation of most stuff above
47};
49
50} // namespace openmsx
51
52#endif
Models the general purpose I/O ports of the AY8910.
This class implements the AY-3-8910 sound chip.
Definition AY8910.hh:22
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition MSXDevice.hh:36
void powerDown(EmuTime::param time) override
This method is called when MSX is powered down.
Definition MSXPSG.cc:55
~MSXPSG() override
Definition MSXPSG.cc:44
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.
Definition MSXPSG.cc:76
void serialize(Archive &ar, unsigned version)
Definition MSXPSG.cc:126
void reset(EmuTime::param time) override
This method is called on reset.
Definition MSXPSG.cc:49
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
Definition MSXPSG.cc:60
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition MSXPSG.cc:71
Ren-Sha Turbo is the autofire in several MSX 2+ models and in the MSX turbo R.
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29
#define SERIALIZE_CLASS_VERSION(CLASS, VERSION)