openMSX
SNPSG.cc
Go to the documentation of this file.
1 #include "SNPSG.hh"
2 #include "SN76489.hh"
3 #include "serialize.hh"
4 #include <memory>
5 
6 namespace openmsx {
7 
8 SNPSG::SNPSG(const DeviceConfig& config)
9  : MSXDevice(config)
10  , sn76489(std::make_unique<SN76489>(config))
11 {
12 }
13 
14 SNPSG::~SNPSG() = default;
15 
16 void SNPSG::reset(EmuTime::param time)
17 {
18  sn76489->reset(time);
19 }
20 
21 void SNPSG::writeIO(word /*port*/, byte value, EmuTime::param time)
22 {
23  // The chip has only a single port.
24  sn76489->write(value, time);
25 }
26 
27 template<typename Archive>
28 void SNPSG::serialize(Archive& ar, unsigned /*version*/)
29 {
30  ar.template serializeBase<MSXDevice>(*this);
31  ar.serialize("sn76489", *sn76489);
32 }
34 REGISTER_MSXDEVICE(SNPSG, "SN76489 PSG");
35 
36 } // namespace openmsx
openmsx::MSXDevice
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:32
serialize.hh
openmsx::DeviceConfig
Definition: DeviceConfig.hh:20
SNPSG.hh
openmsx::REGISTER_MSXDEVICE
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
openmsx::SNPSG::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: SNPSG.cc:16
INSTANTIATE_SERIALIZE_METHODS
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:981
openmsx::SNPSG::~SNPSG
~SNPSG() override
openmsx::SN76489
This class implements the Texas Instruments SN76489 sound chip.
Definition: SN76489.hh:25
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::SNPSG
Device that puts the Texas Instruments SN76489 sound chip at a fixed I/O address.
Definition: SNPSG.hh:15
openmsx::SNPSG::writeIO
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: SNPSG.cc:21
openmsx::SNPSG::serialize
void serialize(Archive &ar, unsigned version)
Definition: SNPSG.cc:28
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::SNPSG::SNPSG
SNPSG(const DeviceConfig &config)
Definition: SNPSG.cc:8
SN76489.hh