OXYGENHUB
◆ main openmsx / src / fdc / MSXFDC.hh
1.2 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef MSXFDC_HH
2
#define MSXFDC_HH
3
4
#include "DiskDrive.hh"
5
6
#include "MSXDevice.hh"
7
#include "Rom.hh"
8
9
#include <array>
10
#include <memory>
11
#include <optional>
12
#include <string>
13
14
namespace openmsx {
15
16
class MSXFDC : public MSXDevice
17
{
18
public:
19
	void powerDown(EmuTime time) override;
20
	[[nodiscard]] byte readMem(uint16_t address, EmuTime time) override;
21
	[[nodiscard]] byte peekMem(uint16_t address, EmuTime time) const override;
22
	[[nodiscard]] const byte* getReadCacheLine(uint16_t start) const override;
23
24
	void getExtraDeviceInfo(TclObject& result) const override;
25
26
	template<typename Archive>
27
	void serialize(Archive& ar, unsigned version);
28
29
protected:
30
	explicit MSXFDC(DeviceConfig& config, const std::string& romId = {},
31
	                bool needROM = true,
32
	                DiskDrive::TrackMode trackMode = DiskDrive::TrackMode::NORMAL);
33
34
	void parseRomVisibility(DeviceConfig& config, unsigned defaultBase, unsigned defaultSize);
35
36
protected:
37
	std::optional<Rom> rom;
38
	uint16_t romVisibilityStart = 0;
39
	uint16_t romVisibilityLast = 0xFFFF; // so, inclusive
40
41
	std::array<std::unique_ptr<DiskDrive>, 4> drives;
42
};
43
44
REGISTER_BASE_NAME_HELPER(MSXFDC, "FDC");
45
46
} // namespace openmsx
47
48
#endif