openMSX
Autofire.hh
Go to the documentation of this file.
1#ifndef AUTOFIRE_HH
2#define AUTOFIRE_HH
3
4#include "DynamicClock.hh"
5#include "EmuTime.hh"
6#include "IntegerSetting.hh"
7#include "Observer.hh"
9
10namespace openmsx {
11
12class MSXMotherBoard;
13class Scheduler;
14class StateChangeDistributor;
15
24class Autofire final : private Observer<Setting>, private StateChangeListener
25{
26public:
28
29public:
30 Autofire(MSXMotherBoard& motherBoard,
31 unsigned newMinInts, unsigned newMaxInts,
32 ID id);
33 ~Autofire();
34
39 [[nodiscard]] bool getSignal(EmuTime::param time) const;
40
41 template<typename Archive>
42 void serialize(Archive& ar, unsigned version);
43
44private:
45 void setSpeed(EmuTime::param time);
46
50 void setClock(int speed);
51
52 // Observer<Setting>
53 void update(const Setting& setting) noexcept override;
54
55 // StateChangeListener
56 void signalStateChange(const StateChange& event) override;
57 void stopReplay(EmuTime::param time) noexcept override;
58
59private:
60 Scheduler& scheduler;
61 StateChangeDistributor& stateChangeDistributor;
62
63 // Following two values specify the range of the autofire
64 // as measured by the test program:
69 const unsigned min_ints;
74 const unsigned max_ints;
75
77 IntegerSetting speedSetting;
78
82 DynamicClock clock;
83
84 const ID id;
85};
86
87} // namespace openmsx
88
89#endif
BaseSetting * setting
Autofire is a device that is between two other devices and outside the bus.
Definition Autofire.hh:25
void serialize(Archive &ar, unsigned version)
Definition Autofire.cc:119
bool getSignal(EmuTime::param time) const
Get the output signal in negative logic.
Definition Autofire.cc:111
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:11