OXYGENHUB
◆ main openmsx / src / sound / YMF278B.hh
1.2 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef YMF278B_HH
2
#define YMF278B_HH
3
4
#include "YMF262.hh"
5
#include "YMF278.hh"
6
7
#include "serialize.hh"
8
9
#include <cstdint>
10
11
namespace openmsx {
12
13
// This combines the FM-part (YMF262) and the Wave-part (YMF278) into a single chip.
14
class YMF278B
15
{
16
public:
17
	YMF278B(const std::string& name, size_t ramSize, DeviceConfig& config,
18
	        YMF278::SetupMemPtrFunc setupMemPtrs, EmuTime time);
19
20
	void powerUp(EmuTime time);
21
	void reset(EmuTime time);
22
	[[nodiscard]] uint8_t readIO(uint16_t port, EmuTime time);
23
	[[nodiscard]] uint8_t peekIO(uint16_t port, EmuTime time) const;
24
	void writeIO(uint16_t port, uint8_t value, EmuTime time);
25
	void setupMemoryPointers();
26
27
	void serialize_bw_compat(XmlInputArchive& ar, unsigned version, EmuTime time);
28
29
	template<typename Archive>
30
	void serialize(Archive& ar, unsigned version);
31
32
private:
33
	[[nodiscard]] bool getNew2() const;
34
	[[nodiscard]] uint8_t readYMF278Status(EmuTime time) const;
35
36
private:
37
	YMF262 ymf262;
38
	YMF278 ymf278;
39
40
	/** Time at which instrument loading is finished. */
41
	EmuTime ymf278LoadTime;
42
	/** Time until which the YMF278 is busy. */
43
	EmuTime ymf278BusyTime;
44
45
	int opl3latch = 0;
46
	uint8_t opl4latch = 0;
47
};
48
49
} // namespace openmsx
50
51
#endif