OXYGENHUB
◆ main openmsx / src / MSXTurboRPause.hh
1.4 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
/*
2
 * This class implements the 2 Turbo-R specific LEDS:
3
 *
4
 * Bit 0 of IO-port 0xA7 turns the PAUSE led ON (1) or OFF (0)
5
 * Bit 7                           TURBO
6
 * TODO merge doc below
7
 */
8
#ifndef TURBORPAUSE_HH
9
#define TURBORPAUSE_HH
10
11
#include "BooleanSetting.hh"
12
#include "MSXDevice.hh"
13
14
#include "Observer.hh"
15
16
namespace openmsx {
17
18
/**
19
 * This class implements the MSX Turbo-R pause key
20
 *
21
 *  Whenever the pause key is pressed a flip-flop is toggled.
22
 *  The status of this flip-flop can be read from io-port 0xA7.
23
 *   bit 0 indicates the status (1 = pause active)
24
 *   all other bits read 0
25
 */
26
class MSXTurboRPause final : public MSXDevice, private Observer<Setting>
27
{
28
public:
29
	explicit MSXTurboRPause(const DeviceConfig& config);
30
	~MSXTurboRPause() override;
31
32
	void reset(EmuTime time) override;
33
	void powerDown(EmuTime time) override;
34
35
	[[nodiscard]] byte readIO(uint16_t port, EmuTime time) override;
36
	[[nodiscard]] byte peekIO(uint16_t port, EmuTime time) const override;
37
	void writeIO(uint16_t port, byte value, EmuTime time) override;
38
39
	template<typename Archive>
40
	void serialize(Archive& ar, unsigned version);
41
42
private:
43
	// Observer<Setting>
44
	void update(const Setting& setting) noexcept override;
45
46
	void updatePause();
47
48
private:
49
	BooleanSetting pauseSetting;
50
	byte status = 255;
51
	bool pauseLed = false;
52
	bool turboLed = false;
53
	bool hwPause = false;
54
};
55
56
} // namespace openmsx
57
58
#endif