openMSX
CircuitDesignerRDDongle.cc
Go to the documentation of this file.
2
3#include "serialize.hh"
4#include "serialize_meta.hh"
5
6/*
7 The circuit designer RD dongle is a simple dongle that is used to protect the software.
8 It needs to be plugged in Joystick port B, when it's not plugged in the software will
9 add a reset command to the BLOAD hook which will reset the MSX.
10
11 Pin 1 = Up
12 Pin 6 = Button A
13 Pin 7 = Button B
14
15 Output Input
16 pin|pin|Pin (Up)
17 7 | 6 | 1
18 -----------------
19 0 | 0 | 0
20 0 | 1 | 1
21 1 | 0 | 0
22 1 | 1 | 0
23*/
24
25namespace openmsx {
26
27// Pluggable
28std::string_view CircuitDesignerRDDongle::getName() const
29{
30 return "circuit-designer-rd-dongle";
31}
32
34{
35 return "Circuit Designer RD dongle";
36}
37
39 Connector& /*connector*/, EmuTime::param /*time*/)
40{
41}
42
43void CircuitDesignerRDDongle::unplugHelper(EmuTime::param /*time*/)
44{
45}
46
47
48// JoystickDevice
49uint8_t CircuitDesignerRDDongle::read(EmuTime::param /*time*/)
50{
51 return status;
52}
53
54void CircuitDesignerRDDongle::write(uint8_t value, EmuTime::param /*time*/)
55{
56 if (!(value & WR_PIN7) && (value & WR_PIN6)) {
57 status |= JOY_UP;
58 } else {
59 status &= ~JOY_UP;
60 }
61}
62
63template<typename Archive>
64void CircuitDesignerRDDongle::serialize(Archive& /*ar*/, unsigned /*version*/)
65{
66 // no need to serialize 'status', port will anyway be re-written
67 // on de-serialize
68}
71
72} // namespace openmsx
void write(uint8_t value, EmuTime::param time) override
Write a value to the joystick device.
uint8_t read(EmuTime::param time) override
Read from the joystick device.
void unplugHelper(EmuTime::param time) override
void plugHelper(Connector &connector, EmuTime::param time) override
void serialize(Archive &ar, unsigned version)
std::string_view getDescription() const override
Description for this pluggable.
std::string_view getName() const override
Name used to identify this pluggable.
Represents something you can plug devices into.
Definition Connector.hh:21
static constexpr uint8_t WR_PIN6
static constexpr uint8_t WR_PIN7
static constexpr uint8_t JOY_UP
This file implemented 3 utility functions:
Definition Autofire.cc:11
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
#define REGISTER_POLYMORPHIC_INITIALIZER(BASE, CLASS, NAME)