OXYGENHUB
◆ main openmsx / src / laserdisc / PioneerLDControl.hh
1.5 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#ifndef PIONEERLDCONTROL_HH
2
#define PIONEERLDCONTROL_HH
3
4
#include "LaserdiscPlayer.hh"
5
6
#include "Clock.hh"
7
#include "IRQHelper.hh"
8
#include "MSXDevice.hh"
9
#include "Rom.hh"
10
11
#include <optional>
12
13
namespace openmsx {
14
15
class MSXPPI;
16
class VDP;
17
18
class PioneerLDControl final : public MSXDevice
19
{
20
public:
21
	explicit PioneerLDControl(DeviceConfig& config);
22
	~PioneerLDControl() override;
23
24
	void reset(EmuTime time) override;
25
	[[nodiscard]] byte readMem(uint16_t address, EmuTime time) override;
26
	[[nodiscard]] byte peekMem(uint16_t address, EmuTime time) const override;
27
	void writeMem(uint16_t address, byte value, EmuTime time) override;
28
	[[nodiscard]] const byte* getReadCacheLine(uint16_t address) const override;
29
	[[nodiscard]] byte* getWriteCacheLine(uint16_t address) override;
30
	void init() override;
31
32
	void videoIn(bool enabled);
33
34
	template<typename Archive>
35
	void serialize(Archive& ar, unsigned version);
36
37
private:
38
	void updateVideoSource();
39
40
private:
41
	Rom rom;
42
	std::optional<LaserdiscPlayer> laserdisc; // can be nullopt
43
	MSXPPI* ppi;
44
	VDP* vdp;
45
46
	/**
47
	 * The reference clock for the pulse is 500kHz / 128, which
48
	 * alternates after each period. We double the frequency
49
	 * and use modulo 2 for whether it will be high or low.
50
	 *
51
	 * See page 88 of the PX-7 Service Manual.
52
	 */
53
	Clock<2 * 500000, 128> clock{EmuTime::zero()}; // 2*500kHz / 128 = 7812.5Hz
54
55
	/**
56
	 * When video output stops, generate an IRQ
57
	 */
58
	IRQHelper irq;
59
60
	bool extInt;
61
	bool muteL, muteR;
62
	bool videoEnabled = false;
63
	bool superimposing;
64
};
65
66
} // namespace openmsx
67
68
#endif