openMSX
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
openmsx::MSXCPUInterface Class Reference

#include <MSXCPUInterface.hh>

Inheritance diagram for openmsx::MSXCPUInterface:
Inheritance graph
[legend]
Collaboration diagram for openmsx::MSXCPUInterface:
Collaboration graph
[legend]

Public Types

using BreakPoints = std::vector< BreakPoint >
 
using WatchPoints = std::vector< std::shared_ptr< WatchPoint > >
 
using Conditions = std::vector< DebugCondition >
 

Public Member Functions

 MSXCPUInterface (const MSXCPUInterface &)=delete
 
MSXCPUInterfaceoperator= (const MSXCPUInterface &)=delete
 
 MSXCPUInterface (MSXMotherBoard &motherBoard)
 
 ~MSXCPUInterface ()
 
void register_IO_In (byte port, MSXDevice *device)
 Devices can register their In ports.
 
void unregister_IO_In (byte port, MSXDevice *device)
 
void register_IO_Out (byte port, MSXDevice *device)
 Devices can register their Out ports.
 
void unregister_IO_Out (byte port, MSXDevice *device)
 
bool replace_IO_In (byte port, MSXDevice *oldDevice, MSXDevice *newDevice)
 These methods replace a previously registered device with a new one.
 
bool replace_IO_Out (byte port, MSXDevice *oldDevice, MSXDevice *newDevice)
 
void registerMemDevice (MSXDevice &device, int ps, int ss, unsigned base, unsigned size)
 Devices can register themself in the MSX slot structure.
 
void unregisterMemDevice (MSXDevice &device, int ps, int ss, unsigned base, unsigned size)
 
void registerGlobalWrite (MSXDevice &device, word address)
 (Un)register global writes.
 
void unregisterGlobalWrite (MSXDevice &device, word address)
 
void registerGlobalRead (MSXDevice &device, word address)
 (Un)register global read.
 
void unregisterGlobalRead (MSXDevice &device, word address)
 
void reset ()
 Reset (the slot state)
 
byte readMem (word address, EmuTime::param time)
 This reads a byte from the currently selected device.
 
void writeMem (word address, byte value, EmuTime::param time)
 This writes a byte to the currently selected device.
 
byte readIO (word port, EmuTime::param time)
 This read a byte from the given IO-port.
 
void writeIO (word port, byte value, EmuTime::param time)
 This writes a byte to the given IO-port.
 
const bytegetReadCacheLine (word start) const
 Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
 
bytegetWriteCacheLine (word start) const
 Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
 
byte readIRQVector ()
 CPU uses this method to read 'extra' data from the data bus used in interrupt routines.
 
void setPrimarySlots (byte value)
 
void invalidateRWCache (word start, unsigned size, int ps, int ss)
 
void invalidateRCache (word start, unsigned size, int ps, int ss)
 
void invalidateWCache (word start, unsigned size, int ps, int ss)
 
void fillRWCache (unsigned start, unsigned size, const byte *rData, byte *wData, int ps, int ss)
 
void fillRCache (unsigned start, unsigned size, const byte *rData, int ps, int ss)
 
void fillWCache (unsigned start, unsigned size, byte *wData, int ps, int ss)
 
byte peekMem (word address, EmuTime::param time) const
 Peek memory location.
 
byte peekSlottedMem (unsigned address, EmuTime::param time) const
 
byte readSlottedMem (unsigned address, EmuTime::param time)
 
void writeSlottedMem (unsigned address, byte value, EmuTime::param time)
 
void setExpanded (int ps)
 
void unsetExpanded (int ps)
 
void testUnsetExpanded (int ps, std::span< const std::unique_ptr< MSXDevice > > allowed) const
 
bool isExpanded (int ps) const
 
void changeExpanded (bool newExpanded)
 
auto getPrimarySlot (int page) const
 
auto getSecondarySlot (int page) const
 
DummyDevicegetDummyDevice ()
 
void insertBreakPoint (BreakPoint bp)
 
void removeBreakPoint (const BreakPoint &bp)
 
void removeBreakPoint (unsigned id)
 
void setWatchPoint (const std::shared_ptr< WatchPoint > &watchPoint)
 
void removeWatchPoint (std::shared_ptr< WatchPoint > watchPoint)
 
void removeWatchPoint (unsigned id)
 
const WatchPointsgetWatchPoints () const
 
void setCondition (DebugCondition cond)
 
void removeCondition (const DebugCondition &cond)
 
void removeCondition (unsigned id)
 
void doBreak ()
 
void doStep ()
 
void doContinue ()
 
bool checkBreakPoints (unsigned pc)
 
void setFastForward (bool fastForward_)
 
bool isFastForward () const
 
MSXDevicegetMSXDevice (int ps, int ss, int page)
 
MSXDevicegetVisibleMSXDevice (int page)
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 
- Public Member Functions inherited from ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >
 ~ProfileCounters ()
 
void tick (CacheLineCounters e) const
 

Static Public Member Functions

static const BreakPointsgetBreakPoints ()
 
static const ConditionsgetConditions ()
 
static bool isBreaked ()
 
static bool anyBreakPoints ()
 
static void cleanup ()
 

Detailed Description

Definition at line 56 of file MSXCPUInterface.hh.

Member Typedef Documentation

◆ BreakPoints

Definition at line 253 of file MSXCPUInterface.hh.

◆ Conditions

Definition at line 266 of file MSXCPUInterface.hh.

◆ WatchPoints

using openmsx::MSXCPUInterface::WatchPoints = std::vector<std::shared_ptr<WatchPoint> >

Definition at line 260 of file MSXCPUInterface.hh.

Constructor & Destructor Documentation

◆ MSXCPUInterface() [1/2]

openmsx::MSXCPUInterface::MSXCPUInterface ( const MSXCPUInterface )
delete

◆ MSXCPUInterface() [2/2]

openmsx::MSXCPUInterface::MSXCPUInterface ( MSXMotherBoard motherBoard)
explicit

◆ ~MSXCPUInterface()

openmsx::MSXCPUInterface::~MSXCPUInterface ( )

Member Function Documentation

◆ anyBreakPoints()

static bool openmsx::MSXCPUInterface::anyBreakPoints ( )
inlinestatic

Definition at line 275 of file MSXCPUInterface.hh.

◆ changeExpanded()

void openmsx::MSXCPUInterface::changeExpanded ( bool  newExpanded)

◆ checkBreakPoints()

bool openmsx::MSXCPUInterface::checkBreakPoints ( unsigned  pc)
inline

◆ cleanup()

void openmsx::MSXCPUInterface::cleanup ( )
static

Definition at line 1064 of file MSXCPUInterface.cc.

Referenced by openmsx::Interpreter::~Interpreter().

◆ doBreak()

void openmsx::MSXCPUInterface::doBreak ( )

◆ doContinue()

void openmsx::MSXCPUInterface::doContinue ( )

◆ doStep()

void openmsx::MSXCPUInterface::doStep ( )

Definition at line 1041 of file MSXCPUInterface.cc.

References doContinue(), isFastForward(), and setCondition().

◆ fillRCache()

void openmsx::MSXCPUInterface::fillRCache ( unsigned  start,
unsigned  size,
const byte rData,
int  ps,
int  ss 
)

◆ fillRWCache()

void openmsx::MSXCPUInterface::fillRWCache ( unsigned  start,
unsigned  size,
const byte rData,
byte wData,
int  ps,
int  ss 
)

◆ fillWCache()

void openmsx::MSXCPUInterface::fillWCache ( unsigned  start,
unsigned  size,
byte wData,
int  ps,
int  ss 
)

◆ getBreakPoints()

static const BreakPoints & openmsx::MSXCPUInterface::getBreakPoints ( )
inlinestatic

Definition at line 254 of file MSXCPUInterface.hh.

◆ getConditions()

static const Conditions & openmsx::MSXCPUInterface::getConditions ( )
inlinestatic

Definition at line 267 of file MSXCPUInterface.hh.

◆ getDummyDevice()

DummyDevice & openmsx::MSXCPUInterface::getDummyDevice ( )
inline

Definition at line 248 of file MSXCPUInterface.hh.

Referenced by openmsx::VDPIODelay::VDPIODelay().

◆ getMSXDevice()

MSXDevice * openmsx::MSXCPUInterface::getMSXDevice ( int  ps,
int  ss,
int  page 
)

Definition at line 1075 of file MSXCPUInterface.cc.

◆ getPrimarySlot()

auto openmsx::MSXCPUInterface::getPrimarySlot ( int  page) const
inline

Definition at line 245 of file MSXCPUInterface.hh.

◆ getReadCacheLine()

const byte * openmsx::MSXCPUInterface::getReadCacheLine ( word  start) const
inline

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. An interval will never cross a 16KB border. An interval will never contain the address 0xffff.

Definition at line 178 of file MSXCPUInterface.hh.

References openmsx::CacheLine::BITS, openmsx::GetReadCacheLine, and ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick().

◆ getSecondarySlot()

auto openmsx::MSXCPUInterface::getSecondarySlot ( int  page) const
inline

Definition at line 246 of file MSXCPUInterface.hh.

◆ getVisibleMSXDevice()

MSXDevice * openmsx::MSXCPUInterface::getVisibleMSXDevice ( int  page)
inline

Definition at line 300 of file MSXCPUInterface.hh.

◆ getWatchPoints()

const WatchPoints & openmsx::MSXCPUInterface::getWatchPoints ( ) const
inline

Definition at line 261 of file MSXCPUInterface.hh.

Referenced by openmsx::Debugger::transfer().

◆ getWriteCacheLine()

byte * openmsx::MSXCPUInterface::getWriteCacheLine ( word  start) const
inline

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. An interval will never cross a 16KB border. An interval will never contain the address 0xffff.

Definition at line 198 of file MSXCPUInterface.hh.

References openmsx::CacheLine::BITS, openmsx::GetWriteCacheLine, and ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick().

◆ insertBreakPoint()

void openmsx::MSXCPUInterface::insertBreakPoint ( BreakPoint  bp)

◆ invalidateRCache()

void openmsx::MSXCPUInterface::invalidateRCache ( word  start,
unsigned  size,
int  ps,
int  ss 
)

◆ invalidateRWCache()

void openmsx::MSXCPUInterface::invalidateRWCache ( word  start,
unsigned  size,
int  ps,
int  ss 
)

◆ invalidateWCache()

void openmsx::MSXCPUInterface::invalidateWCache ( word  start,
unsigned  size,
int  ps,
int  ss 
)

◆ isBreaked()

static bool openmsx::MSXCPUInterface::isBreaked ( )
inlinestatic

Definition at line 269 of file MSXCPUInterface.hh.

Referenced by checkBreakPoints().

◆ isExpanded()

bool openmsx::MSXCPUInterface::isExpanded ( int  ps) const
inline

◆ isFastForward()

bool openmsx::MSXCPUInterface::isFastForward ( ) const
inline

Definition at line 297 of file MSXCPUInterface.hh.

Referenced by doBreak(), doContinue(), and doStep().

◆ operator=()

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

◆ peekMem()

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

Peek memory location.

See also
MSXDevice::peekMem()

Definition at line 737 of file MSXCPUInterface.cc.

References isExpanded().

Referenced by openmsx::dasm(), and openmsx::instructionLength().

◆ peekSlottedMem()

byte openmsx::MSXCPUInterface::peekSlottedMem ( unsigned  address,
EmuTime::param  time 
) const

Definition at line 746 of file MSXCPUInterface.cc.

References isExpanded().

Referenced by openmsx::MSXMirrorDevice::peekMem().

◆ readIO()

byte openmsx::MSXCPUInterface::readIO ( word  port,
EmuTime::param  time 
)
inline

This read a byte from the given IO-port.

See also
MSXDevice::readIO()

Definition at line 154 of file MSXCPUInterface.hh.

◆ readIRQVector()

byte openmsx::MSXCPUInterface::readIRQVector ( )

CPU uses this method to read 'extra' data from the data bus used in interrupt routines.

In MSX this returns always 255.

Definition at line 671 of file MSXCPUInterface.cc.

References openmsx::MSXMotherBoard::readIRQVector().

◆ readMem()

byte openmsx::MSXCPUInterface::readMem ( word  address,
EmuTime::param  time 
)
inline

This reads a byte from the currently selected device.

Definition at line 130 of file MSXCPUInterface.hh.

References openmsx::CacheLine::BITS, openmsx::SlowRead, and ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick().

◆ readSlottedMem()

byte openmsx::MSXCPUInterface::readSlottedMem ( unsigned  address,
EmuTime::param  time 
)

Definition at line 763 of file MSXCPUInterface.cc.

References isExpanded().

Referenced by openmsx::MSXMirrorDevice::readMem().

◆ register_IO_In()

void openmsx::MSXCPUInterface::register_IO_In ( byte  port,
MSXDevice device 
)

◆ register_IO_Out()

void openmsx::MSXCPUInterface::register_IO_Out ( byte  port,
MSXDevice device 
)

◆ registerGlobalRead()

void openmsx::MSXCPUInterface::registerGlobalRead ( MSXDevice device,
word  address 
)

◆ registerGlobalWrite()

void openmsx::MSXCPUInterface::registerGlobalWrite ( MSXDevice device,
word  address 
)

◆ registerMemDevice()

void openmsx::MSXCPUInterface::registerMemDevice ( MSXDevice device,
int  ps,
int  ss,
unsigned  base,
unsigned  size 
)

Devices can register themself in the MSX slot structure.

This is normally done in their constructor. Once devices are registered their readMem() / writeMem() methods can get called.

Definition at line 528 of file MSXCPUInterface.cc.

References isExpanded().

◆ removeBreakPoint() [1/2]

void openmsx::MSXCPUInterface::removeBreakPoint ( const BreakPoint bp)

◆ removeBreakPoint() [2/2]

void openmsx::MSXCPUInterface::removeBreakPoint ( unsigned  id)

◆ removeCondition() [1/2]

void openmsx::MSXCPUInterface::removeCondition ( const DebugCondition cond)

◆ removeCondition() [2/2]

void openmsx::MSXCPUInterface::removeCondition ( unsigned  id)

◆ removeWatchPoint() [1/2]

void openmsx::MSXCPUInterface::removeWatchPoint ( std::shared_ptr< WatchPoint watchPoint)

◆ removeWatchPoint() [2/2]

void openmsx::MSXCPUInterface::removeWatchPoint ( unsigned  id)

◆ replace_IO_In()

bool openmsx::MSXCPUInterface::replace_IO_In ( byte  port,
MSXDevice oldDevice,
MSXDevice newDevice 
)

These methods replace a previously registered device with a new one.

This method checks whether the current device is the same as the 'oldDevice' parameter.

  • If it's the same, the current device is replace with 'newDevice' and this method returns true.
  • If it's not the same, then no changes are made and this method returns false.

The intention is that devices using these methods extend (=wrap) the functionality of a previously registered device. Typically the destructor of the wrapping device will perform the inverse replacement.

Definition at line 422 of file MSXCPUInterface.cc.

◆ replace_IO_Out()

bool openmsx::MSXCPUInterface::replace_IO_Out ( byte  port,
MSXDevice oldDevice,
MSXDevice newDevice 
)

Definition at line 433 of file MSXCPUInterface.cc.

◆ reset()

void openmsx::MSXCPUInterface::reset ( )

Reset (the slot state)

Definition at line 663 of file MSXCPUInterface.cc.

References setPrimarySlots(), and xrange().

Referenced by openmsx::MSXMotherBoard::doReset(), MSXCPUInterface(), and openmsx::MSXMotherBoard::powerUp().

◆ serialize()

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

Definition at line 1284 of file MSXCPUInterface.cc.

References setPrimarySlots(), and xrange().

◆ setCondition()

void openmsx::MSXCPUInterface::setCondition ( DebugCondition  cond)

◆ setExpanded()

void openmsx::MSXCPUInterface::setExpanded ( int  ps)

Definition at line 252 of file MSXCPUInterface.cc.

References changeExpanded(), isExpanded(), and xrange().

◆ setFastForward()

void openmsx::MSXCPUInterface::setFastForward ( bool  fastForward_)
inline

Definition at line 296 of file MSXCPUInterface.hh.

◆ setPrimarySlots()

void openmsx::MSXCPUInterface::setPrimarySlots ( byte  value)

Definition at line 676 of file MSXCPUInterface.cc.

References changeExpanded(), and isExpanded().

Referenced by reset(), and serialize().

◆ setWatchPoint()

void openmsx::MSXCPUInterface::setWatchPoint ( const std::shared_ptr< WatchPoint > &  watchPoint)

◆ testUnsetExpanded()

void openmsx::MSXCPUInterface::testUnsetExpanded ( int  ps,
std::span< const std::unique_ptr< MSXDevice > >  allowed 
) const

◆ unregister_IO_In()

void openmsx::MSXCPUInterface::unregister_IO_In ( byte  port,
MSXDevice device 
)

◆ unregister_IO_Out()

void openmsx::MSXCPUInterface::unregister_IO_Out ( byte  port,
MSXDevice device 
)

◆ unregisterGlobalRead()

void openmsx::MSXCPUInterface::unregisterGlobalRead ( MSXDevice device,
word  address 
)

◆ unregisterGlobalWrite()

void openmsx::MSXCPUInterface::unregisterGlobalWrite ( MSXDevice device,
word  address 
)

◆ unregisterMemDevice()

void openmsx::MSXCPUInterface::unregisterMemDevice ( MSXDevice device,
int  ps,
int  ss,
unsigned  base,
unsigned  size 
)

Definition at line 558 of file MSXCPUInterface.cc.

◆ unsetExpanded()

void openmsx::MSXCPUInterface::unsetExpanded ( int  ps)

◆ writeIO()

void openmsx::MSXCPUInterface::writeIO ( word  port,
byte  value,
EmuTime::param  time 
)
inline

This writes a byte to the given IO-port.

See also
MSXDevice::writeIO()

Definition at line 162 of file MSXCPUInterface.hh.

◆ writeMem()

void openmsx::MSXCPUInterface::writeMem ( word  address,
byte  value,
EmuTime::param  time 
)
inline

This writes a byte to the currently selected device.

Definition at line 141 of file MSXCPUInterface.hh.

References openmsx::CacheLine::BITS, openmsx::SlowWrite, and ProfileCounters< PROFILE_CACHELINES, CacheLineCounters >::tick().

◆ writeSlottedMem()

void openmsx::MSXCPUInterface::writeSlottedMem ( unsigned  address,
byte  value,
EmuTime::param  time 
)

Definition at line 780 of file MSXCPUInterface.cc.

References isExpanded().

Referenced by openmsx::MSXMirrorDevice::writeMem().


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