openMSX
SETetrisDongle.cc
Go to the documentation of this file.
1#include "SETetrisDongle.hh"
2#include "serialize.hh"
3#include "serialize_meta.hh"
4
5namespace openmsx {
6
7// Pluggable
8std::string_view SETetrisDongle::getName() const
9{
10 return "tetris2-protection";
11}
12
13std::string_view SETetrisDongle::getDescription() const
14{
15 return "Tetris II Special Edition dongle";
16}
17
19 Connector& /*connector*/, EmuTime::param /*time*/)
20{
21}
22
23void SETetrisDongle::unplugHelper(EmuTime::param /*time*/)
24{
25}
26
27
28// JoystickDevice
29uint8_t SETetrisDongle::read(EmuTime::param /*time*/)
30{
31 return status;
32}
33
34void SETetrisDongle::write(uint8_t value, EmuTime::param /*time*/)
35{
36 // Original device used 4 NOR ports
37 // pin4 will be value of pin7
38 if (value & 2) {
39 status |= JOY_RIGHT;
40 } else {
41 status &= ~JOY_RIGHT;
42 }
43}
44
45template<typename Archive>
46void SETetrisDongle::serialize(Archive& /*ar*/, unsigned /*version*/)
47{
48 // no need to serialize 'status', port will anyway be re-written
49 // on de-serialize
50}
53
54} // namespace openmsx
Represents something you can plug devices into.
Definition Connector.hh:21
static constexpr uint8_t JOY_RIGHT
void plugHelper(Connector &connector, EmuTime::param time) override
std::string_view getName() const override
Name used to identify this pluggable.
std::string_view getDescription() const override
Description for this pluggable.
void serialize(Archive &ar, unsigned version)
uint8_t read(EmuTime::param time) override
Read from the joystick device.
void unplugHelper(EmuTime::param time) override
void write(uint8_t value, EmuTime::param time) override
Write a value to the joystick device.
This file implemented 3 utility functions:
Definition Autofire.cc:11
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
#define REGISTER_POLYMORPHIC_INITIALIZER(BASE, CLASS, NAME)