openMSX
Autofire.hh
Go to the documentation of this file.
1#ifndef AUTOFIRE_HH
2#define AUTOFIRE_HH
3
4#include "Observer.hh"
5#include "DynamicClock.hh"
6#include "EmuTime.hh"
7#include "IntegerSetting.hh"
10
11namespace openmsx {
12
13class MSXMotherBoard;
14class Scheduler;
15class StateChangeDistributor;
16
25class Autofire final : private Observer<Setting>, private StateChangeListener
26{
27public:
29
30public:
31 Autofire(MSXMotherBoard& motherBoard,
32 unsigned newMinInts, unsigned newMaxInts,
33 ID id);
34 ~Autofire();
35
40 [[nodiscard]] bool getSignal(EmuTime::param time);
41
42 template<typename Archive>
43 void serialize(Archive& ar, unsigned version);
44
45private:
46 void setSpeed(EmuTime::param time);
47
51 void setClock(int speed);
52
53 // Observer<Setting>
54 void update(const Setting& setting) noexcept override;
55
56 // StateChangeListener
57 void signalStateChange(const StateChange& event) override;
58 void stopReplay(EmuTime::param time) noexcept override;
59
60private:
61 Scheduler& scheduler;
62 StateChangeDistributor& stateChangeDistributor;
63
64 // Following two values specify the range of the autofire
65 // as measured by the test program:
70 const unsigned min_ints;
75 const unsigned max_ints;
76
78 IntegerSetting speedSetting;
79
83 DynamicClock clock;
84
85 const ID id;
86};
87
88} // namespace openmsx
89
90#endif
BaseSetting * setting
Autofire is a device that is between two other devices and outside the bus.
Definition Autofire.hh:26
bool getSignal(EmuTime::param time)
Get the output signal in negative logic.
Definition Autofire.cc:109
void serialize(Archive &ar, unsigned version)
Definition Autofire.cc:117
Represents a clock with a variable frequency.
A Setting with an integer value.
Generic Gang-of-Four Observer class, templatized edition.
Definition Observer.hh:10
Base class for all external MSX state changing events.
This file implemented 3 utility functions:
Definition Autofire.cc:9