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