16 ? std::make_unique<
Rom>(
getName() +
" ROM",
"rom", config, romId)
19 if (needROM && (
rom->getSize() == 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);
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>();
47 for (
auto& drive :
drives) {
48 drive->setMotor(
false, time);
64 return &(*rom)[start & 0x3FFF];
68 template<
typename Archive>
71 ar.template serializeBase<MSXDevice>(*
this);
77 char tag[7] = {
'd',
'r',
'i',
'v',
'e',
'X', 0 };
79 if (
auto* drive =
dynamic_cast<RealDrive*
>(drv.get())) {
80 tag[5] = char(
'a' + i);
81 ar.serialize(tag, *drive);
const XMLElement * findChild(std::string_view name) const
int getChildDataAsInt(std::string_view name, int defaultValue=0) 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 std::string getName() const
Returns a human-readable name for this device.
std::unique_ptr< DiskDrive > drives[4]
std::unique_ptr< Rom > rom
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.
MSXFDC(const DeviceConfig &config, const std::string &romId={}, bool needROM=true, DiskDrive::TrackMode trackMode=DiskDrive::TrackMode::NORMAL)
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.
const std::string & getData() const
constexpr auto enumerate(Iterable &&iterable)
Heavily inspired by Nathan Reed's blog post: Python-Like enumerate() In C++17 http://reedbeta....
string getName(KeyCode keyCode)
Translate key code to key name.
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)