openMSX
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
openmsx::MSXDevice Class Referenceabstract

An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX. More...

#include <MSXDevice.hh>

Inheritance diagram for openmsx::MSXDevice:
Inheritance graph
[legend]

Public Types

using Devices = std::vector< MSXDevice * >
 

Public Member Functions

 MSXDevice (const MSXDevice &)=delete
 
MSXDeviceoperator= (const MSXDevice &)=delete
 
virtual ~MSXDevice ()=0
 
const HardwareConfiggetHardwareConfig () const
 Returns the hardwareconfig this device belongs to. More...
 
void testRemove (Devices alreadyRemoved) const
 Checks whether this device can be removed (no other device has a reference to it). More...
 
virtual void reset (EmuTime::param time)
 This method is called on reset. More...
 
virtual byte readIRQVector ()
 Gets IRQ vector used in IM2. More...
 
virtual void powerDown (EmuTime::param time)
 This method is called when MSX is powered down. More...
 
virtual void powerUp (EmuTime::param time)
 This method is called when MSX is powered up. More...
 
virtual std::string getName () const
 Returns a human-readable name for this device. More...
 
virtual void getNameList (TclObject &result) const
 Returns list of name(s) of this device. More...
 
void getDeviceInfo (TclObject &result) const
 Get device info. More...
 
void getVisibleMemRegion (unsigned &base, unsigned &size) const
 Returns the range where this device is visible in memory. More...
 
virtual byte readIO (word port, EmuTime::param time)
 Read a byte from an IO port at a certain time from this device. More...
 
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. More...
 
virtual byte peekIO (word port, EmuTime::param time) const
 Read a byte from a given IO port. More...
 
virtual byte readMem (word address, EmuTime::param time)
 Read a byte from a location at a certain time from this device. More...
 
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. More...
 
virtual const bytegetReadCacheLine (word start) const
 Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading. More...
 
virtual bytegetWriteCacheLine (word start) const
 Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing. More...
 
virtual byte peekMem (word address, EmuTime::param time) const
 Read a byte from a given memory location. More...
 
virtual void globalWrite (word address, byte value, EmuTime::param time)
 Global writes. More...
 
virtual void globalRead (word address, EmuTime::param time)
 Global reads. More...
 
void invalidateDeviceRWCache ()
 Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is located in. More...
 
void invalidateDeviceRCache ()
 
void invalidateDeviceWCache ()
 
void invalidateDeviceRWCache (unsigned start, unsigned size)
 
void invalidateDeviceRCache (unsigned start, unsigned size)
 
void invalidateDeviceWCache (unsigned start, unsigned size)
 
void fillDeviceRWCache (unsigned start, unsigned size, byte *rwData)
 Calls MSXCPUInterface::fillXXCache() for the specific (part of) the slot that this device is located in. More...
 
void fillDeviceRWCache (unsigned start, unsigned size, const byte *rData, byte *wData)
 
void fillDeviceRCache (unsigned start, unsigned size, const byte *rData)
 
void fillDeviceWCache (unsigned start, unsigned size, byte *wData)
 
MSXMotherBoardgetMotherBoard () const
 Get the mother board this device belongs to. More...
 
const XMLElementgetDeviceConfig () const
 Get the configuration section for this device. More...
 
const DeviceConfiggetDeviceConfig2 () const
 
const DevicesgetReferences () const
 Get the device references that are specified for this device. More...
 
EmuTime::param getCurrentTime () const
 
MSXCPUgetCPU () const
 
MSXCPUInterfacegetCPUInterface () const
 
SchedulergetScheduler () const
 
CliCommgetCliComm () const
 
ReactorgetReactor () const
 
CommandControllergetCommandController () const
 
PluggingControllergetPluggingController () const
 
LedStatusgetLedStatus () const
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 

Static Public Attributes

static byte unmappedRead [0x10000]
 
static byte unmappedWrite [0x10000]
 

Protected Member Functions

 MSXDevice (const DeviceConfig &config, const std::string &name)
 Every MSXDevice has a config entry; this constructor gets some device properties from that config entry. More...
 
 MSXDevice (const DeviceConfig &config)
 
virtual void init ()
 
virtual unsigned getBaseSizeAlignment () const
 The 'base' and 'size' attribute values need to be at least aligned to CacheLine::SIZE. More...
 
virtual bool allowUnaligned () const
 By default we don't allow unaligned <mem> specifications in the config file. More...
 
virtual void getExtraDeviceInfo (TclObject &result) const
 

Friends

class DeviceFactory
 Constructing a MSXDevice is a 2-step process, after the constructor is called this init() method must be called. More...
 

Detailed Description

An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.

There is no communication among devices, only between devices and the CPU.

Definition at line 31 of file MSXDevice.hh.

Member Typedef Documentation

◆ Devices

using openmsx::MSXDevice::Devices = std::vector<MSXDevice*>

Definition at line 37 of file MSXDevice.hh.

Constructor & Destructor Documentation

◆ MSXDevice() [1/3]

openmsx::MSXDevice::MSXDevice ( const MSXDevice )
delete

◆ ~MSXDevice()

openmsx::MSXDevice::~MSXDevice ( )
pure virtual

Definition at line 58 of file MSXDevice.cc.

◆ MSXDevice() [2/3]

openmsx::MSXDevice::MSXDevice ( const DeviceConfig config,
const std::string &  name 
)
protected

Every MSXDevice has a config entry; this constructor gets some device properties from that config entry.

Parameters
configconfig entry for this device.
nameThe name for the MSXDevice (will be made unique)

Definition at line 26 of file MSXDevice.cc.

◆ MSXDevice() [3/3]

openmsx::MSXDevice::MSXDevice ( const DeviceConfig config)
explicitprotected

Definition at line 32 of file MSXDevice.cc.

References getDeviceConfig().

Member Function Documentation

◆ allowUnaligned()

virtual bool openmsx::MSXDevice::allowUnaligned ( ) const
inlineprotectedvirtual

By default we don't allow unaligned <mem> specifications in the config file.

Though for a machine like 'Victor HC-95A' is it useful to model it with combinations of unaligned devices. So we do allow it for a select few devices: devices that promise to not call any of the 'fillDeviceXXXCache()' methods.

Reimplemented in openmsx::MSXRS232, openmsx::MSXMirrorDevice, openmsx::VictorFDC, and openmsx::MSXVictorHC9xSystemControl.

Definition at line 290 of file MSXDevice.hh.

Referenced by fillDeviceRCache(), fillDeviceRWCache(), and fillDeviceWCache().

◆ fillDeviceRCache()

void openmsx::MSXDevice::fillDeviceRCache ( unsigned  start,
unsigned  size,
const byte rData 
)

◆ fillDeviceRWCache() [1/2]

void openmsx::MSXDevice::fillDeviceRWCache ( unsigned  start,
unsigned  size,
byte rwData 
)

Calls MSXCPUInterface::fillXXCache() for the specific (part of) the slot that this device is located in.

Definition at line 511 of file MSXDevice.cc.

References utf8::unchecked::size().

Referenced by openmsx::MSXMemoryMapper::writeIO(), and openmsx::PanasonicRam::writeIO().

◆ fillDeviceRWCache() [2/2]

void openmsx::MSXDevice::fillDeviceRWCache ( unsigned  start,
unsigned  size,
const byte rData,
byte wData 
)

◆ fillDeviceWCache()

void openmsx::MSXDevice::fillDeviceWCache ( unsigned  start,
unsigned  size,
byte wData 
)

◆ getBaseSizeAlignment()

unsigned openmsx::MSXDevice::getBaseSizeAlignment ( ) const
protectedvirtual

The 'base' and 'size' attribute values need to be at least aligned to CacheLine::SIZE.

Though some devices may need a stricter alignment. In that case they must override this method.

Reimplemented in openmsx::MSXMemoryMapperBase, openmsx::RomBlocks< BANK_SIZE_ >, and openmsx::RomPlain.

Definition at line 402 of file MSXDevice.cc.

References openmsx::CacheLine::SIZE.

Referenced by openmsx::RomPlain::getBaseSizeAlignment().

◆ getCliComm()

CliComm & openmsx::MSXDevice::getCliComm ( ) const

◆ getCommandController()

CommandController & openmsx::MSXDevice::getCommandController ( ) const

◆ getCPU()

MSXCPU & openmsx::MSXDevice::getCPU ( ) const

◆ getCPUInterface()

MSXCPUInterface & openmsx::MSXDevice::getCPUInterface ( ) const

◆ getCurrentTime()

EmuTime::param openmsx::MSXDevice::getCurrentTime ( ) const

Definition at line 131 of file MSXDevice.cc.

References openmsx::MSXMotherBoard::getCurrentTime(), and getMotherBoard().

Referenced by openmsx::BeerIDE::BeerIDE(), openmsx::ColecoJoystickIO::ColecoJoystickIO(), openmsx::ColecoSuperGameModule::ColecoSuperGameModule(), openmsx::JVCMSXMIDI::JVCMSXMIDI(), openmsx::MegaFlashRomSCCPlusSD::MegaFlashRomSCCPlusSD(), openmsx::MSXAudio::MSXAudio(), openmsx::MSXFacMidiInterface::MSXFacMidiInterface(), openmsx::MSXFmPac::MSXFmPac(), openmsx::MSXHBI55::MSXHBI55(), openmsx::MSXHiResTimer::MSXHiResTimer(), openmsx::MSXMidi::MSXMidi(), openmsx::MSXMoonSound::MSXMoonSound(), openmsx::MSXMusicBase::MSXMusicBase(), openmsx::MSXMusicWX::MSXMusicWX(), openmsx::MSXOPL3Cartridge::MSXOPL3Cartridge(), openmsx::MSXPPI::MSXPPI(), openmsx::MSXPrinterPort::MSXPrinterPort(), openmsx::MSXRS232::MSXRS232(), openmsx::MSXRTC::MSXRTC(), openmsx::MSXSCCPlusCart::MSXSCCPlusCart(), openmsx::MSXTurboRPCM::MSXTurboRPCM(), openmsx::MSXYamahaSFG::MSXYamahaSFG(), openmsx::MusicModuleMIDI::MusicModuleMIDI(), openmsx::PhilipsFDC::PhilipsFDC(), openmsx::PioneerLDControl::PioneerLDControl(), openmsx::ROMHunterMk2::ROMHunterMk2(), openmsx::RomKonamiSCC::RomKonamiSCC(), openmsx::RomManbow2::RomManbow2(), openmsx::RomSynthesizer::RomSynthesizer(), openmsx::VDP::scheduleCmdSync(), openmsx::SensorKid::SensorKid(), openmsx::MSXMoonSound::serialize(), openmsx::SVIPSG::serialize(), openmsx::SVIPPI::serialize(), openmsx::MSXPSG::serialize(), openmsx::ChakkariCopy::serialize(), openmsx::PioneerLDControl::serialize(), openmsx::MSXAudio::serialize(), openmsx::Carnivore2::serialize(), openmsx::MSXPPI::serialize(), openmsx::V9990::serialize(), openmsx::SpectravideoFDC::SpectravideoFDC(), openmsx::SunriseIDE::SunriseIDE(), openmsx::SVIPPI::SVIPPI(), openmsx::SVIPrinterPort::SVIPrinterPort(), openmsx::SVIPSG::SVIPSG(), openmsx::TurboRFDC::TurboRFDC(), openmsx::V9990::V9990(), openmsx::VDP::VDP(), openmsx::VictorFDC::VictorFDC(), openmsx::ReproCartridgeV2::writeIO(), and openmsx::YamahaFDC::YamahaFDC().

◆ getDeviceConfig()

const XMLElement& openmsx::MSXDevice::getDeviceConfig ( ) const
inline

Get the configuration section for this device.

This was passed as a constructor argument.

Definition at line 230 of file MSXDevice.hh.

References openmsx::DeviceConfig::getXML().

Referenced by getDeviceInfo(), openmsx::MSXRom::getExtraDeviceInfo(), openmsx::VDP::getMSX1Palette(), and MSXDevice().

◆ getDeviceConfig2()

const DeviceConfig& openmsx::MSXDevice::getDeviceConfig2 ( ) const
inline

Definition at line 233 of file MSXDevice.hh.

Referenced by openmsx::MSXAudio::createPeriphery().

◆ getDeviceInfo()

void openmsx::MSXDevice::getDeviceInfo ( TclObject result) const

Get device info.

Used by the 'machine_info device' command.

Definition at line 391 of file MSXDevice.cc.

References openmsx::TclObject::addDictKeyValue(), getDeviceConfig(), getExtraDeviceInfo(), and getName().

Referenced by openmsx::DeviceInfo::execute().

◆ getExtraDeviceInfo()

void openmsx::MSXDevice::getExtraDeviceInfo ( TclObject result) const
protectedvirtual
See also
getDeviceInfo() Default implementation does nothing. Subclasses can override this method to add extra info (like subtypes).

Reimplemented in openmsx::MSXRom.

Definition at line 397 of file MSXDevice.cc.

Referenced by getDeviceInfo().

◆ getHardwareConfig()

const HardwareConfig& openmsx::MSXDevice::getHardwareConfig ( ) const
inline

Returns the hardwareconfig this device belongs to.

Definition at line 43 of file MSXDevice.hh.

References openmsx::DeviceConfig::getHardwareConfig().

Referenced by getMotherBoard(), and openmsx::PioneerLDControl::PioneerLDControl().

◆ getLedStatus()

LedStatus & openmsx::MSXDevice::getLedStatus ( ) const

◆ getMotherBoard()

MSXMotherBoard & openmsx::MSXDevice::getMotherBoard ( ) const

◆ getName()

string openmsx::MSXDevice::getName ( ) const
virtual

◆ getNameList()

void openmsx::MSXDevice::getNameList ( TclObject result) const
virtual

Returns list of name(s) of this device.

This is normally the same as getName() (but formatted as a Tcl list) except for multi-{mem,io}-devices.

Reimplemented in openmsx::MSXMultiIODevice, openmsx::MSXMultiMemDevice, and openmsx::DummyDevice.

Definition at line 386 of file MSXDevice.cc.

References openmsx::TclObject::addListElement(), and getName().

◆ getPluggingController()

PluggingController & openmsx::MSXDevice::getPluggingController ( ) const

◆ getReactor()

Reactor & openmsx::MSXDevice::getReactor ( ) const

◆ getReadCacheLine()

const byte * openmsx::MSXDevice::getReadCacheLine ( word  start) const
virtual

Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.

If it is, a pointer to a buffer containing this interval must be returned. If not, a null pointer must be returned. Cacheable for reading means the data may be read directly from the buffer, thus bypassing the readMem() method, and thus also ignoring EmuTime. The default implementation always returns a null pointer. The start of the interval is CacheLine::SIZE aligned.

Reimplemented in openmsx::BeerIDE, openmsx::MSXMusicWX, openmsx::MSXAudio, openmsx::MSXMemoryMapperBase, openmsx::MSXRS232, openmsx::MusicalMemoryMapper, openmsx::MSXMultiMemDevice, openmsx::SunriseIDE, openmsx::ColecoSuperGameModule, openmsx::MSXSCCPlusCart, openmsx::TurboRFDC, openmsx::MSXRam, openmsx::MSXYamahaSFG, openmsx::MSXFDC, openmsx::SpectravideoFDC, openmsx::GoudaSCSI, openmsx::MSXBunsetsu, openmsx::MSXMusicBase, openmsx::PhilipsFDC, openmsx::VictorFDC, openmsx::YamahaFDC, openmsx::FraelSwitchableROM, openmsx::MSXMirrorDevice, openmsx::NationalFDC, openmsx::SanyoFDC, openmsx::ToshibaFDC, openmsx::RomColecoMegaCart, openmsx::RomFSA1FM2, openmsx::RomManbow2, openmsx::ChakkariCopy, openmsx::NowindInterface, openmsx::PioneerLDControl, openmsx::MegaFlashRomSCCPlusSD, openmsx::ESE_SCC, openmsx::RomMitsubishiMLTS2, openmsx::RomBlocks< BANK_SIZE_ >, openmsx::MSXMegaRam, openmsx::MegaSCSI, openmsx::MegaFlashRomSCCPlus, openmsx::ReproCartridgeV1, openmsx::ReproCartridgeV2, openmsx::KonamiUltimateCollection, openmsx::RomFSA1FM1, openmsx::MSXFmPac, openmsx::ESE_RAM, openmsx::RomRamFile, openmsx::RomAscii8_8, openmsx::RomHolyQuran2, openmsx::RomKonamiSCC, openmsx::RomMatraInk, openmsx::RomPanasonic, openmsx::MSXPac, openmsx::ROMHunterMk2, openmsx::RomPlayBall, openmsx::RomAscii16_2, openmsx::RomDRAM, openmsx::RomNational, openmsx::RomHalnote, and openmsx::RomMSXtra.

Definition at line 431 of file MSXDevice.cc.

Referenced by openmsx::MSXCPUInterface::getReadCacheLine(), and peekMem().

◆ getReferences()

const MSXDevice::Devices & openmsx::MSXDevice::getReferences ( ) const

Get the device references that are specified for this device.

Definition at line 125 of file MSXDevice.cc.

Referenced by openmsx::MSXMatsushita::init(), openmsx::Video9000::init(), and openmsx::PioneerLDControl::init().

◆ getScheduler()

Scheduler & openmsx::MSXDevice::getScheduler ( ) const

Definition at line 143 of file MSXDevice.cc.

References getMotherBoard(), and openmsx::MSXMotherBoard::getScheduler().

◆ getVisibleMemRegion()

void openmsx::MSXDevice::getVisibleMemRegion ( unsigned &  base,
unsigned &  size 
) const

Returns the range where this device is visible in memory.

This is the union of the "mem" tags inside the device tag in hardwareconfig.xml (though practically always there is only one "mem" tag). Information on possible holes in this range (when there are multiple "mem" tags) is not returned by this method.

Definition at line 309 of file MSXDevice.cc.

References max_value(), min_value(), utf8::unchecked::size(), and view::transform().

◆ getWriteCacheLine()

byte * openmsx::MSXDevice::getWriteCacheLine ( word  start) const
virtual

Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.

If it is, a pointer to a buffer containing this interval must be returned. If not, a null pointer must be returned. Cacheable for writing means the data may be written directly to the buffer, thus bypassing the writeMem() method, and thus also ignoring EmuTime. The default implementation always returns a null pointer. The start of the interval is CacheLine::SIZE aligned.

Reimplemented in openmsx::MSXMusicWX, openmsx::MSXAudio, openmsx::MSXRS232, openmsx::MSXMemoryMapperBase, openmsx::MusicalMemoryMapper, openmsx::MSXMultiMemDevice, openmsx::ColecoSuperGameModule, openmsx::MSXSCCPlusCart, openmsx::MSXYamahaSFG, openmsx::MSXRam, openmsx::MSXBunsetsu, openmsx::MSXMirrorDevice, openmsx::PanasonicRam, openmsx::RomFSA1FM2, openmsx::ChakkariCopy, openmsx::MegaFlashRomSCCPlusSD, openmsx::RomManbow2, openmsx::NowindInterface, openmsx::PioneerLDControl, openmsx::ESE_SCC, openmsx::MSXMegaRam, openmsx::MegaFlashRomSCCPlus, openmsx::ReproCartridgeV1, openmsx::ReproCartridgeV2, openmsx::RomFSA1FM1, openmsx::RomMitsubishiMLTS2, openmsx::TurboRFDC, openmsx::MegaSCSI, openmsx::KonamiUltimateCollection, openmsx::RomRamFile, openmsx::MSXFmPac, openmsx::ESE_RAM, openmsx::RomKonamiSCC, openmsx::RomPanasonic, openmsx::SpectravideoFDC, openmsx::RomAscii8_8, openmsx::RomHolyQuran2, openmsx::ROMHunterMk2, openmsx::RomMatraInk, openmsx::RomPlayBall, openmsx::PhilipsFDC, openmsx::VictorFDC, openmsx::YamahaFDC, openmsx::MSXPac, openmsx::RomAscii16_2, openmsx::RomDooly, openmsx::RomNational, openmsx::NationalFDC, openmsx::SanyoFDC, openmsx::ToshibaFDC, openmsx::RomHalnote, openmsx::RomMSXtra, openmsx::RomMajutsushi, openmsx::RomNettouYakyuu, openmsx::RomSynthesizer, openmsx::RomZemina90in1, openmsx::RomAscii16kB, openmsx::RomAscii8kB, openmsx::RomCrossBlaim, openmsx::RomGameMaster2, openmsx::RomGeneric16kB, openmsx::RomGeneric8kB, openmsx::RomHarryFox, openmsx::RomHolyQuran, openmsx::RomKonami, openmsx::RomMatraCompilation, openmsx::RomMSXDOS2, openmsx::RomMSXWrite, openmsx::RomRType, openmsx::RomSuperSwangi, openmsx::RomZemina126in1, openmsx::RomZemina80in1, and openmsx::MSXRom.

Definition at line 465 of file MSXDevice.cc.

Referenced by openmsx::MSXCPUInterface::getWriteCacheLine().

◆ globalRead()

void openmsx::MSXDevice::globalRead ( word  address,
EmuTime::param  time 
)
virtual

Global reads.

Similar to globalWrite() but then for reads. 'Carnivore2' is an example of a device that monitors the MSX bus for reads in any slot.

Reimplemented in openmsx::Carnivore2.

Definition at line 460 of file MSXDevice.cc.

References UNREACHABLE.

◆ globalWrite()

void openmsx::MSXDevice::globalWrite ( word  address,
byte  value,
EmuTime::param  time 
)
virtual

Global writes.

Some devices violate the MSX standard by ignoring the SLOT-SELECT signal; they react to writes to a certain address in any slot. Luckily the only known example so far is 'Super Lode Runner'. This method is triggered for such 'global' writes. You need to register each address for which you want this method to be triggered.

Reimplemented in openmsx::RomSuperLodeRunner.

Definition at line 454 of file MSXDevice.cc.

References UNREACHABLE.

◆ init()

void openmsx::MSXDevice::init ( )
protectedvirtual

◆ invalidateDeviceRCache() [1/2]

void openmsx::MSXDevice::invalidateDeviceRCache ( )
inline

◆ invalidateDeviceRCache() [2/2]

void openmsx::MSXDevice::invalidateDeviceRCache ( unsigned  start,
unsigned  size 
)

◆ invalidateDeviceRWCache() [1/2]

void openmsx::MSXDevice::invalidateDeviceRWCache ( )
inline

◆ invalidateDeviceRWCache() [2/2]

void openmsx::MSXDevice::invalidateDeviceRWCache ( unsigned  start,
unsigned  size 
)

◆ invalidateDeviceWCache() [1/2]

void openmsx::MSXDevice::invalidateDeviceWCache ( )
inline

◆ invalidateDeviceWCache() [2/2]

void openmsx::MSXDevice::invalidateDeviceWCache ( unsigned  start,
unsigned  size 
)

◆ operator=()

MSXDevice& openmsx::MSXDevice::operator= ( const MSXDevice )
delete

◆ peekIO()

byte openmsx::MSXDevice::peekIO ( word  port,
EmuTime::param  time 
) const
virtual

◆ peekMem()

byte openmsx::MSXDevice::peekMem ( word  address,
EmuTime::param  time 
) const
virtual

Read a byte from a given memory location.

Reading memory via this method has no side effects (doesn't change the device status). If save reading is not possible this method returns 0xFF. This method is not used by the emulation. It can however be used by a debugger. The default implementation uses the cache mechanism (getReadCacheLine() method). If a certain region is not cacheable you cannot read it by default, Override this method if you want to improve this behaviour.

Reimplemented in openmsx::MSXMusicWX, openmsx::RomFSA1FM2, openmsx::Carnivore2, openmsx::MSXMemoryMapperBase, openmsx::MSXAudio, openmsx::ChakkariCopy, openmsx::MSXMultiMemDevice, openmsx::MusicalMemoryMapper, openmsx::PioneerLDControl, openmsx::MegaFlashRomSCCPlusSD, openmsx::RomManbow2, openmsx::NowindInterface, openmsx::ESE_SCC, openmsx::MSXRam, openmsx::RomBlocks< BANK_SIZE_ >, openmsx::RomMitsubishiMLTS2, openmsx::MSXSCCPlusCart, openmsx::ColecoSuperGameModule, openmsx::TurboRFDC, openmsx::MegaSCSI, openmsx::MegaFlashRomSCCPlus, openmsx::MSXMirrorDevice, openmsx::ReproCartridgeV1, openmsx::ReproCartridgeV2, openmsx::MSXYamahaSFG, openmsx::MSXFDC, openmsx::KonamiUltimateCollection, openmsx::RomFSA1FM1, openmsx::RomRamFile, openmsx::SpectravideoFDC, openmsx::RomHolyQuran2, openmsx::RomKonamiSCC, openmsx::RomPanasonic, openmsx::MSXMusicBase, openmsx::PhilipsFDC, openmsx::VictorFDC, openmsx::YamahaFDC, openmsx::RomDooly, openmsx::ROMHunterMk2, openmsx::RomMatraInk, openmsx::RomPlayBall, openmsx::NationalFDC, openmsx::SanyoFDC, openmsx::ToshibaFDC, openmsx::RomNational, and openmsx::MSXVictorHC9xSystemControl.

Definition at line 442 of file MSXDevice.cc.

References getReadCacheLine(), openmsx::CacheLine::HIGH, and openmsx::CacheLine::LOW.

Referenced by openmsx::MSXMultiMemDevice::peekMem(), openmsx::MSXCPUInterface::peekMem(), openmsx::MSXCPUInterface::peekSlottedMem(), and openmsx::MSXCPUInterface::readSlottedMem().

◆ powerDown()

void openmsx::MSXDevice::powerDown ( EmuTime::param  time)
virtual

This method is called when MSX is powered down.

The default implementation does nothing, this is usually ok. Typically devices that need to turn off LEDs need to reimplement this method.

Parameters
timeThe moment in time the power down occurs.

Reimplemented in openmsx::MSXPPI, openmsx::MSXTurboRPause, openmsx::MSXPSG, openmsx::SVIPSG, openmsx::MSXFDC, and openmsx::MSXMultiDevice.

Definition at line 371 of file MSXDevice.cc.

◆ powerUp()

void openmsx::MSXDevice::powerUp ( EmuTime::param  time)
virtual

◆ readIO()

byte openmsx::MSXDevice::readIO ( word  port,
EmuTime::param  time 
)
virtual

◆ readIRQVector()

byte openmsx::MSXDevice::readIRQVector ( )
virtual

Gets IRQ vector used in IM2.

This method only exists to support YamahaSfg05. There is no way for several devices to coordinate which vector is actually send to the CPU. But this IM is anyway not really supported in the MSX standard. Default implementation returns 0xFF.

Reimplemented in openmsx::MSXYamahaSFG.

Definition at line 366 of file MSXDevice.cc.

◆ readMem()

byte openmsx::MSXDevice::readMem ( word  address,
EmuTime::param  time 
)
virtual

Read a byte from a location at a certain time from this device.

The default implementation returns 255.

Reimplemented in openmsx::BeerIDE, openmsx::MSXMusicWX, openmsx::RomFSA1FM2, openmsx::ADVram, openmsx::Carnivore2, openmsx::MSXAudio, openmsx::MSXMemoryMapperBase, openmsx::MSXRS232, openmsx::MusicalMemoryMapper, openmsx::MegaFlashRomSCCPlusSD, openmsx::RomManbow2, openmsx::ChakkariCopy, openmsx::MSXMultiMemDevice, openmsx::NowindInterface, openmsx::PioneerLDControl, openmsx::SunriseIDE, openmsx::ColecoSuperGameModule, openmsx::ESE_SCC, openmsx::MSXMegaRam, openmsx::RomBlocks< BANK_SIZE_ >, openmsx::RomMitsubishiMLTS2, openmsx::MSXSCCPlusCart, openmsx::MegaFlashRomSCCPlus, openmsx::ReproCartridgeV1, openmsx::ReproCartridgeV2, openmsx::KonamiUltimateCollection, openmsx::RomFSA1FM1, openmsx::TurboRFDC, openmsx::MegaSCSI, openmsx::MSXRam, openmsx::MSXFmPac, openmsx::MSXYamahaSFG, openmsx::MSXFDC, openmsx::GoudaSCSI, openmsx::ESE_RAM, openmsx::RomKonamiSCC, openmsx::RomPanasonic, openmsx::RomRamFile, openmsx::MSXMusicBase, openmsx::FraelSwitchableROM, openmsx::RomAscii8_8, openmsx::RomDooly, openmsx::ROMHunterMk2, openmsx::RomMatraInk, openmsx::RomPlayBall, openmsx::MSXBunsetsu, openmsx::SpectravideoFDC, openmsx::MSXMirrorDevice, openmsx::MSXPac, openmsx::RomAscii16_2, openmsx::RomDRAM, openmsx::RomHolyQuran2, openmsx::RomNational, openmsx::PhilipsFDC, openmsx::VictorFDC, openmsx::YamahaFDC, openmsx::RomColecoMegaCart, openmsx::RomHalnote, openmsx::RomMSXtra, openmsx::NationalFDC, openmsx::SanyoFDC, openmsx::ToshibaFDC, and openmsx::MSXVictorHC9xSystemControl.

Definition at line 425 of file MSXDevice.cc.

Referenced by openmsx::MSXMultiMemDevice::readMem(), and openmsx::MSXCPUInterface::readMem().

◆ reset()

void openmsx::MSXDevice::reset ( EmuTime::param  time)
virtual

This method is called on reset.

Default implementation does nothing.

Reimplemented in openmsx::VDP, openmsx::MSXDeviceSwitch, openmsx::BeerIDE, openmsx::MSXMusicWX, openmsx::MSXPPI, openmsx::RomFSA1FM2, openmsx::V9990, openmsx::MSXTurboRPause, openmsx::Carnivore2, openmsx::MSXS1985, openmsx::MSXAudio, openmsx::Video9000, openmsx::MSXMemoryMapperBase, openmsx::MSXMatsushita, openmsx::MSXRS232, openmsx::ADVram, openmsx::MegaFlashRomSCCPlusSD, openmsx::RomManbow2, openmsx::MSXE6Timer, openmsx::NowindInterface, openmsx::PioneerLDControl, openmsx::MSXPSG, openmsx::SVIPPI, openmsx::MusicalMemoryMapper, openmsx::ChakkariCopy, openmsx::SunriseIDE, openmsx::MSXMegaRam, openmsx::MSXPrinterPort, openmsx::MSXS1990, openmsx::MSXSCCPlusCart, openmsx::SNPSG, openmsx::ESE_SCC, openmsx::RomMitsubishiMLTS2, openmsx::MSXResetStatusRegister, openmsx::MSXMidi, openmsx::MSXTurboRPCM, openmsx::SVIPSG, openmsx::SVIPrinterPort, openmsx::ColecoJoystickIO, openmsx::MegaFlashRomSCCPlus, openmsx::ReproCartridgeV1, openmsx::ReproCartridgeV2, openmsx::TurboRFDC, openmsx::ColecoSuperGameModule, openmsx::KonamiUltimateCollection, openmsx::RomFSA1FM1, openmsx::MSXKanji, openmsx::MSXMoonSound, openmsx::MSXYamahaSFG, openmsx::MegaSCSI, openmsx::MSXHBI55, openmsx::RomRamFile, openmsx::RomSuperLodeRunner, openmsx::MSXKanji12, openmsx::MSXFacMidiInterface, openmsx::MusicModuleMIDI, openmsx::MSXFmPac, openmsx::DebugDevice, openmsx::GoudaSCSI, openmsx::ESE_RAM, openmsx::RomAscii8_8, openmsx::RomKonamiKeyboardMaster, openmsx::RomKonamiSCC, openmsx::RomMultiRom, openmsx::RomPanasonic, openmsx::MSXRTC, openmsx::JVCMSXMIDI, openmsx::SpectravideoFDC, openmsx::WD2793BasedFDC, openmsx::FraelSwitchableROM, openmsx::MSXPac, openmsx::RomArc, openmsx::RomAscii16_2, openmsx::RomDooly, openmsx::RomHolyQuran2, openmsx::ROMHunterMk2, openmsx::RomMajutsushi, openmsx::RomMatraInk, openmsx::RomNettouYakyuu, openmsx::RomPlayBall, openmsx::RomSynthesizer, openmsx::RomZemina90in1, openmsx::MSXBunsetsu, openmsx::MSXCielTurbo, openmsx::MSXHiResTimer, openmsx::SensorKid, openmsx::MSXMusicBase, openmsx::MSXOPL3Cartridge, openmsx::MSXMultiDevice, openmsx::PhilipsFDC, openmsx::VictorFDC, openmsx::YamahaFDC, openmsx::RomAscii16kB, openmsx::RomAscii8kB, openmsx::RomColecoMegaCart, openmsx::RomCrossBlaim, openmsx::RomGameMaster2, openmsx::RomGeneric16kB, openmsx::RomGeneric8kB, openmsx::RomHalnote, openmsx::RomHarryFox, openmsx::RomHolyQuran, openmsx::RomKonami, openmsx::RomMatraCompilation, openmsx::RomMSXDOS2, openmsx::RomMSXWrite, openmsx::RomNational, openmsx::RomPadial16kB, openmsx::RomPadial8kB, openmsx::RomRType, openmsx::RomSuperSwangi, openmsx::RomZemina126in1, openmsx::RomZemina80in1, openmsx::PasswordCart, and openmsx::DummyDevice.

Definition at line 361 of file MSXDevice.cc.

Referenced by openmsx::MSXMapperIO::MSXMapperIO(), and powerUp().

◆ serialize()

template<typename Archive >
void openmsx::MSXDevice::serialize ( Archive &  ar,
unsigned  version 
)

Definition at line 532 of file MSXDevice.cc.

◆ testRemove()

void openmsx::MSXDevice::testRemove ( Devices  alreadyRemoved) const

Checks whether this device can be removed (no other device has a reference to it).

Throws an exception if it can't be removed.

Definition at line 80 of file MSXDevice.cc.

References ranges::set_difference(), ranges::sort(), and strAppend().

◆ writeIO()

void openmsx::MSXDevice::writeIO ( word  port,
byte  value,
EmuTime::param  time 
)
virtual

Write a byte to a given IO port at a certain time to this device.

The default implementation ignores the write (does nothing)

Reimplemented in openmsx::MSXMemoryMapperBase, openmsx::VDP, openmsx::MSXDeviceSwitch, openmsx::BeerIDE, openmsx::MSXPPI, openmsx::V9990, openmsx::Carnivore2, openmsx::MSXTurboRPause, openmsx::ADVram, openmsx::RomManbow2, openmsx::MegaFlashRomSCCPlusSD, openmsx::MSXMapperIO, openmsx::MSXMegaRam, openmsx::MSXAudio, openmsx::MSXMatsushita, openmsx::MSXRS232, openmsx::Video9000, openmsx::MSXMultiIODevice, openmsx::MSXPSG, openmsx::MegaFlashRomSCCPlus, openmsx::ReproCartridgeV1, openmsx::ReproCartridgeV2, openmsx::MSXE6Timer, openmsx::SVIPPI, openmsx::MusicalMemoryMapper, openmsx::MSXPrinterPort, openmsx::MSXS1990, openmsx::SVIPSG, openmsx::MSXResetStatusRegister, openmsx::MSXMidi, openmsx::MSXTurboRPCM, openmsx::SVIPrinterPort, openmsx::ChakkariCopy, openmsx::ColecoJoystickIO, openmsx::SNPSG, openmsx::GoudaSCSI, openmsx::ColecoSuperGameModule, openmsx::MSXMoonSound, openmsx::VDPIODelay, openmsx::FraelSwitchableROM, openmsx::MSXHBI55, openmsx::MSXFacMidiInterface, openmsx::MusicModuleMIDI, openmsx::MSXRTC, openmsx::JVCMSXMIDI, openmsx::PanasonicRam, openmsx::MSXCielTurbo, openmsx::MSXFmPac, openmsx::MSXOPL3Cartridge, openmsx::DebugDevice, openmsx::RomKonamiKeyboardMaster, openmsx::MSXHiResTimer, openmsx::MSXKanji, openmsx::AVTFDC, openmsx::MicrosolFDC, openmsx::SVIFDC, openmsx::RomArc, openmsx::RomZemina90in1, openmsx::SensorKid, openmsx::MSXMusicBase, openmsx::PasswordCart, and openmsx::MSXMemoryMapper.

Definition at line 414 of file MSXDevice.cc.

Referenced by openmsx::VDPIODelay::writeIO(), and openmsx::MSXCPUInterface::writeIO().

◆ writeMem()

void openmsx::MSXDevice::writeMem ( word  address,
byte  value,
EmuTime::param  time 
)
virtual

Write a given byte to a given location at a certain time to this device.

The default implementation ignores the write (does nothing).

Reimplemented in openmsx::MSXMusicWX, openmsx::ADVram, openmsx::RomFSA1FM2, openmsx::Carnivore2, openmsx::MSXAudio, openmsx::MSXRS232, openmsx::MSXMemoryMapperBase, openmsx::ChakkariCopy, openmsx::MegaFlashRomSCCPlusSD, openmsx::MusicalMemoryMapper, openmsx::MSXMultiMemDevice, openmsx::RomManbow2, openmsx::NowindInterface, openmsx::PioneerLDControl, openmsx::SunriseIDE, openmsx::ColecoSuperGameModule, openmsx::ESE_SCC, openmsx::MSXMegaRam, openmsx::MSXSCCPlusCart, openmsx::MegaFlashRomSCCPlus, openmsx::ReproCartridgeV1, openmsx::ReproCartridgeV2, openmsx::KonamiUltimateCollection, openmsx::RomFSA1FM1, openmsx::MSXYamahaSFG, openmsx::TurboRFDC, openmsx::MegaSCSI, openmsx::RomMitsubishiMLTS2, openmsx::RomRamFile, openmsx::MSXRam, openmsx::RomKonamiSCC, openmsx::RomPanasonic, openmsx::MSXFmPac, openmsx::ESE_RAM, openmsx::ROMHunterMk2, openmsx::RomPlayBall, openmsx::SpectravideoFDC, openmsx::RomAscii16_2, openmsx::RomAscii8_8, openmsx::RomDooly, openmsx::RomHolyQuran2, openmsx::RomMatraInk, openmsx::RomNational, openmsx::MSXBunsetsu, openmsx::PhilipsFDC, openmsx::VictorFDC, openmsx::YamahaFDC, openmsx::MSXMirrorDevice, openmsx::MSXPac, openmsx::RomHalnote, openmsx::RomMSXtra, openmsx::NationalFDC, openmsx::SanyoFDC, openmsx::ToshibaFDC, openmsx::PanasonicRam, openmsx::RomMajutsushi, openmsx::RomNettouYakyuu, openmsx::RomSynthesizer, openmsx::MSXVictorHC9xSystemControl, openmsx::RomAscii16kB, openmsx::RomAscii8kB, openmsx::RomCrossBlaim, openmsx::RomGameMaster2, openmsx::RomGeneric16kB, openmsx::RomGeneric8kB, openmsx::RomHarryFox, openmsx::RomHolyQuran, openmsx::RomKonami, openmsx::RomMatraCompilation, openmsx::RomMSXDOS2, openmsx::RomMSXWrite, openmsx::RomRType, openmsx::RomSuperSwangi, openmsx::RomZemina126in1, openmsx::RomZemina80in1, and openmsx::MSXRom.

Definition at line 436 of file MSXDevice.cc.

Referenced by openmsx::MSXMultiMemDevice::writeMem(), openmsx::MSXCPUInterface::writeMem(), and openmsx::MSXCPUInterface::writeSlottedMem().

Friends And Related Function Documentation

◆ DeviceFactory

friend class DeviceFactory
friend

Constructing a MSXDevice is a 2-step process, after the constructor is called this init() method must be called.

The reason is exception safety (init() might throw and we use the destructor to clean up some stuff, this is more difficult when everything is done in the constructor). This is also a non-public method. This means you can only construct MSXDevices via DeviceFactory. In rare cases you need to override this method, for example when you need to access the referenced devices already during construction of this device (e.g. ADVram)

Definition at line 275 of file MSXDevice.hh.

Member Data Documentation

◆ unmappedRead

byte openmsx::MSXDevice::unmappedRead[0x10000]
inlinestatic

◆ unmappedWrite

byte openmsx::MSXDevice::unmappedWrite[0x10000]
inlinestatic

Definition at line 301 of file MSXDevice.hh.

Referenced by openmsx::MSXRom::getWriteCacheLine(), openmsx::RomAscii16kB::getWriteCacheLine(), openmsx::RomHarryFox::getWriteCacheLine(), openmsx::RomHolyQuran::getWriteCacheLine(), openmsx::RomKonami::getWriteCacheLine(), openmsx::RomMatraCompilation::getWriteCacheLine(), openmsx::RomMSXDOS2::getWriteCacheLine(), openmsx::RomMSXWrite::getWriteCacheLine(), openmsx::RomRType::getWriteCacheLine(), openmsx::RomAscii8kB::getWriteCacheLine(), openmsx::RomSuperSwangi::getWriteCacheLine(), openmsx::RomZemina126in1::getWriteCacheLine(), openmsx::RomZemina80in1::getWriteCacheLine(), openmsx::RomGameMaster2::getWriteCacheLine(), openmsx::RomGeneric16kB::getWriteCacheLine(), openmsx::RomGeneric8kB::getWriteCacheLine(), openmsx::PanasonicRam::getWriteCacheLine(), openmsx::RomSynthesizer::getWriteCacheLine(), openmsx::RomZemina90in1::getWriteCacheLine(), openmsx::NationalFDC::getWriteCacheLine(), openmsx::RomMSXtra::getWriteCacheLine(), openmsx::SanyoFDC::getWriteCacheLine(), openmsx::ToshibaFDC::getWriteCacheLine(), openmsx::RomHalnote::getWriteCacheLine(), openmsx::MSXPac::getWriteCacheLine(), openmsx::RomNational::getWriteCacheLine(), openmsx::PhilipsFDC::getWriteCacheLine(), openmsx::RomDooly::getWriteCacheLine(), openmsx::VictorFDC::getWriteCacheLine(), openmsx::YamahaFDC::getWriteCacheLine(), openmsx::RomHolyQuran2::getWriteCacheLine(), openmsx::MSXBunsetsu::getWriteCacheLine(), openmsx::RomPlayBall::getWriteCacheLine(), openmsx::SpectravideoFDC::getWriteCacheLine(), openmsx::RomAscii8_8::getWriteCacheLine(), openmsx::RomPanasonic::getWriteCacheLine(), openmsx::RomKonamiSCC::getWriteCacheLine(), openmsx::ESE_RAM::getWriteCacheLine(), openmsx::RomRamFile::getWriteCacheLine(), openmsx::MSXFmPac::getWriteCacheLine(), openmsx::MSXYamahaSFG::getWriteCacheLine(), openmsx::TurboRFDC::getWriteCacheLine(), openmsx::MegaSCSI::getWriteCacheLine(), openmsx::RomFSA1FM1::getWriteCacheLine(), openmsx::RomMitsubishiMLTS2::getWriteCacheLine(), openmsx::MSXMegaRam::getWriteCacheLine(), openmsx::MSXSCCPlusCart::getWriteCacheLine(), openmsx::ColecoSuperGameModule::getWriteCacheLine(), openmsx::NowindInterface::getWriteCacheLine(), openmsx::PioneerLDControl::getWriteCacheLine(), openmsx::MegaFlashRomSCCPlusSD::getWriteCacheLine(), openmsx::RomManbow2::getWriteCacheLine(), openmsx::ChakkariCopy::getWriteCacheLine(), openmsx::MusicalMemoryMapper::getWriteCacheLine(), openmsx::MSXRS232::getWriteCacheLine(), openmsx::RomFSA1FM2::getWriteCacheLine(), openmsx::Y8950Periphery::getWriteCacheLine(), openmsx::MSXMusicWX::getWriteCacheLine(), openmsx::PanasonicAudioPeriphery::getWriteCacheLine(), and openmsx::PanasonicRam::writeIO().


The documentation for this class was generated from the following files: