25class CommandController;
27class PluggingController;
56 void testRemove(std::span<
const std::unique_ptr<MSXDevice>> removed)
const;
62 virtual void reset(EmuTime::param time);
79 virtual void powerDown(EmuTime::param time);
86 virtual void powerUp(EmuTime::param time);
92 [[nodiscard]]
virtual const std::string&
getName()
const;
119 [[nodiscard]]
virtual byte readIO(
word port, EmuTime::param time);
126 virtual void writeIO(
word port,
byte value, EmuTime::param time);
136 [[nodiscard]]
virtual byte peekIO(
word port, EmuTime::param time)
const;
146 [[nodiscard]]
virtual byte readMem(
word address, EmuTime::param time);
153 virtual void writeMem(
word address,
byte value, EmuTime::param time);
193 [[nodiscard]]
virtual byte peekMem(
word address, EmuTime::param time)
const;
203 virtual void globalWrite(
word address,
byte value, EmuTime::param time);
225 void fillDeviceRWCache(
unsigned start,
unsigned size,
const byte* rData,
byte* wData);
237 return *deviceConfig.
getXML();
258 template<
typename Archive>
259 void serialize(Archive& ar,
unsigned version);
310 template<
typename Action,
typename... Args>
311 void clip(
unsigned start,
unsigned size, Action action, Args... args);
313 void initName(std::string_view name);
314 static void staticInit();
317 void unlockDevices();
319 void registerSlots();
320 void unregisterSlots();
322 void registerPorts();
323 void unregisterPorts();
330 assert((0 <= ps) && (ps <= 3));
331 return narrow_cast<byte>(ps);
338 [[nodiscard]]
unsigned end()
const {
return base + size; }
340 using MemRegions = std::vector<BaseSize>;
341 MemRegions memRegions;
345 DeviceConfig deviceConfig;
356#define REGISTER_MSXDEVICE(CLASS, NAME) \
357REGISTER_POLYMORPHIC_INITIALIZER(MSXDevice, CLASS, NAME);
356#define REGISTER_MSXDEVICE(CLASS, NAME) \ …
const HardwareConfig & getHardwareConfig() const
const XMLElement * getXML() const
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.
void invalidateDeviceRCache()
void fillDeviceWCache(unsigned start, unsigned size, byte *wData)
PluggingController & getPluggingController() const
MSXDevice(MSXDevice &&)=delete
virtual void powerUp(EmuTime::param time)
This method is called when MSX is powered up.
static std::array< byte, 0x10000 > unmappedRead
MSXDevice & operator=(const MSXDevice &)=delete
const HardwareConfig & getHardwareConfig() const
Returns the hardwareconfig this device belongs to.
void fillDeviceRWCache(unsigned start, unsigned size, byte *rwData)
Calls MSXCPUInterface::fillXXCache() for the specific (part of) the slot that this device is located ...
virtual const byte * getReadCacheLine(word start) const
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
void invalidateDeviceWCache()
void getDeviceInfo(TclObject &result) const
Get device info.
virtual void writeIO(word port, byte value, EmuTime::param time)
Write a byte to a given IO port at a certain time to this device.
virtual byte readIRQVector()
Gets IRQ vector used in IM2.
virtual void globalWrite(word address, byte value, EmuTime::param time)
Global writes.
Reactor & getReactor() const
virtual bool allowUnaligned() const
By default we don't allow unaligned <mem> specifications in the config file.
const DeviceConfig & getDeviceConfig2() const
virtual unsigned getBaseSizeAlignment() const
The 'base' and 'size' attribute values need to be at least aligned to CacheLine::SIZE.
MSXDevice(const MSXDevice &)=delete
std::vector< MSXDevice * > Devices
virtual byte readMem(word address, EmuTime::param time)
Read a byte from a location at a certain time from this device.
virtual void getExtraDeviceInfo(TclObject &result) const
void getVisibleMemRegion(unsigned &base, unsigned &size) const
Returns the range where this device is visible in memory.
virtual void writeMem(word address, byte value, EmuTime::param time)
Write a given byte to a given location at a certain time to this device.
virtual byte peekIO(word port, EmuTime::param time) const
Read a byte from a given IO port.
virtual byte peekMem(word address, EmuTime::param time) const
Read a byte from a given memory location.
virtual const std::string & getName() const
Returns a human-readable name for this device.
LedStatus & getLedStatus() const
void serialize(Archive &ar, unsigned version)
static std::array< byte, 0x10000 > unmappedWrite
void invalidateDeviceRWCache()
Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is lo...
Scheduler & getScheduler() const
virtual void getNameList(TclObject &result) const
Returns list of name(s) of this device.
MSXDevice & operator=(MSXDevice &&)=delete
void testRemove(std::span< const std::unique_ptr< MSXDevice > > removed) const
Checks whether this device can be removed (no other device has a reference to it).
virtual byte * getWriteCacheLine(word start)
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
const XMLElement & getDeviceConfig() const
Get the configuration section for this device.
byte getPrimarySlot() const
void fillDeviceRCache(unsigned start, unsigned size, const byte *rData)
CommandController & getCommandController() const
const Devices & getReferences() const
Get the device references that are specified for this device.
virtual void powerDown(EmuTime::param time)
This method is called when MSX is powered down.
virtual void globalRead(word address, EmuTime::param time)
Global reads.
virtual void reset(EmuTime::param time)
This method is called on reset.
EmuTime::param getCurrentTime() const
MSXCPUInterface & getCPUInterface() const
virtual byte readIO(word port, EmuTime::param time)
Read a byte from an IO port at a certain time from this device.
MSXCliComm & getCliComm() const
Central administration of Connectors and Pluggables.
Contains the main loop of openMSX.
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
constexpr auto end(const zstring_view &x)