16 ?
std::optional<
Rom>(
std::in_place, getName() +
" ROM",
"rom", config, romId)
19 if (needROM && (
rom->size() == 0)) {
21 "Empty ROM not allowed for \"",
getName(),
"\".");
23 bool singleSided = config.
findChild(
"singlesided") !=
nullptr;
25 if ((0 > numDrives) || (numDrives >= 4)) {
26 throw MSXException(
"Invalid number of drives: ", numDrives);
29 const auto* styleEl = config.
findChild(
"connectionstyle");
30 bool signalsNeedMotorOn = !styleEl || (styleEl->getData() ==
"Philips");
33 for (; i < numDrives; ++i) {
34 drives[i] = std::make_unique<RealDrive>(
36 !singleSided, trackMode);
39 drives[i] = std::make_unique<DummyDrive>();
45 for (
const auto& drive :
drives) {
46 drive->setMotor(
false, time);
62 return &(*rom)[start & 0x3FFF];
73template<
typename Archive>
76 ar.template serializeBase<MSXDevice>(*
this);
82 std::array<char, 7> tag = {
'd',
'r',
'i',
'v',
'e',
'X', 0};
84 if (
auto* drive =
dynamic_cast<RealDrive*
>(drv.get())) {
85 tag[5] = char(
'a' + i);
86 ar.serialize(tag.data(), *drive);
const XMLElement * findChild(std::string_view name) const
int getChildDataAsInt(std::string_view name, int defaultValue) const
static constexpr EmuDuration msec(unsigned x)
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
MSXMotherBoard & getMotherBoard() const
Get the mother board this device belongs to.
virtual const std::string & getName() const
Returns a human-readable name for this device.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
void powerDown(EmuTime::param time) override
This method is called when MSX is powered down.
std::array< std::unique_ptr< DiskDrive >, 4 > drives
MSXFDC(const DeviceConfig &config, const std::string &romId={}, bool needROM=true, DiskDrive::TrackMode trackMode=DiskDrive::TrackMode::NORMAL)
void getExtraDeviceInfo(TclObject &result) const override
void serialize(Archive &ar, unsigned version)
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
This class implements a real drive, single or double sided.
constexpr auto enumerate(Iterable &&iterable)
Heavily inspired by Nathan Reed's blog post: Python-Like enumerate() In C++17 http://reedbeta....
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)