openMSX
MSXDevice.cc
Go to the documentation of this file.
1 #include "MSXDevice.hh"
2 #include "XMLElement.hh"
3 #include "MSXMotherBoard.hh"
4 #include "HardwareConfig.hh"
6 #include "MSXCPUInterface.hh"
7 #include "MSXCPU.hh"
8 #include "CacheLine.hh"
9 #include "TclObject.hh"
10 #include "Math.hh"
11 #include "MSXException.hh"
12 #include "one_of.hh"
13 #include "ranges.hh"
14 #include "serialize.hh"
15 #include "stl.hh"
16 #include "unreachable.hh"
17 #include "view.hh"
18 #include <cassert>
19 #include <cstring>
20 #include <iterator> // for back_inserter
21 
22 using std::string;
23 
24 namespace openmsx {
25 
26 MSXDevice::MSXDevice(const DeviceConfig& config, const string& name)
27  : deviceConfig(config)
28 {
29  initName(name);
30 }
31 
33  : deviceConfig(config)
34 {
35  initName(getDeviceConfig().getAttribute("id"));
36 }
37 
38 void MSXDevice::initName(const string& name)
39 {
40  deviceName = name;
41  if (getMotherBoard().findDevice(deviceName)) {
42  unsigned n = 0;
43  do {
44  deviceName = strCat(name, " (", ++n, ')');
45  } while (getMotherBoard().findDevice(deviceName));
46  }
47 }
48 
50 {
51  staticInit();
52 
53  lockDevices();
54  registerSlots();
55  registerPorts();
56 }
57 
59 {
60  unregisterPorts();
61  unregisterSlots();
62  unlockDevices();
63  assert(referencedBy.empty());
64 }
65 
66 void MSXDevice::staticInit()
67 {
68  static bool alreadyInit = false;
69  if (alreadyInit) return;
70  alreadyInit = true;
71 
72  memset(unmappedRead, 0xFF, sizeof(unmappedRead));
73 }
74 
76 {
78 }
79 
80 void MSXDevice::testRemove(Devices removed) const
81 {
82  auto all = referencedBy;
83  ranges::sort(all);
84  ranges::sort(removed);
85  Devices rest;
86  ranges::set_difference(all, removed, back_inserter(rest));
87  if (!rest.empty()) {
88  string msg = "Still in use by";
89  for (auto& d : rest) {
90  strAppend(msg, ' ', d->getName());
91  }
92  throw MSXException(std::move(msg));
93  }
94 }
95 
96 void MSXDevice::lockDevices()
97 {
98  // This code can only handle backward references: the thing that is
99  // referenced must already be instantiated, we don't try to change the
100  // instantiation order. For the moment this is good enough (only ADVRAM
101  // (an extension) uses it to refer to the VDP (inside a machine)). If
102  // needed we can implement something more sophisticated later without
103  // changing the format of the config files.
104  for (auto& c : getDeviceConfig().getChildren("device")) {
105  const auto& name = c->getAttribute("idref");
106  auto* dev = getMotherBoard().findDevice(name);
107  if (!dev) {
108  throw MSXException(
109  "Unsatisfied dependency: '", getName(),
110  "' depends on unavailable device '",
111  name, "'.");
112  }
113  references.push_back(dev);
114  dev->referencedBy.push_back(this);
115  }
116 }
117 
118 void MSXDevice::unlockDevices()
119 {
120  for (auto& r : references) {
121  move_pop_back(r->referencedBy, rfind_unguarded(r->referencedBy, this));
122  }
123 }
124 
126 {
127  // init() must already be called
128  return references;
129 }
130 
131 EmuTime::param MSXDevice::getCurrentTime() const
132 {
133  return getMotherBoard().getCurrentTime();
134 }
136 {
137  return getMotherBoard().getCPU();
138 }
140 {
141  return getMotherBoard().getCPUInterface();
142 }
144 {
145  return getMotherBoard().getScheduler();
146 }
148 {
149  return getMotherBoard().getMSXCliComm();
150 }
152 {
153  return getMotherBoard().getReactor();
154 }
156 {
158 }
160 {
161  return getMotherBoard().getLedStatus();
162 }
164 {
166 }
167 
168 void MSXDevice::registerSlots()
169 {
170  MemRegions tmpMemRegions;
171  unsigned align = getBaseSizeAlignment();
172  assert(Math::ispow2(align));
173  for (auto& m : getDeviceConfig().getChildren("mem")) {
174  unsigned base = m->getAttributeAsInt("base");
175  unsigned size = m->getAttributeAsInt("size");
176  if ((base >= 0x10000) || (size > 0x10000) || ((base + size) > 0x10000)) {
177  throw MSXException(
178  "Invalid memory specification for device ",
179  getName(), " should be in range "
180  "[0x0000,0x10000).");
181  }
182  if (((base & (align - 1)) || (size & (align - 1))) &&
183  !allowUnaligned()) {
184  throw MSXException(
185  "invalid memory specification for device ",
186  getName(), " should be aligned on at least 0x",
187  hex_string<4>(align), '.');
188  }
189  tmpMemRegions.emplace_back(base, size);
190  }
191  if (tmpMemRegions.empty()) {
192  return;
193  }
194 
195  // find primary and secondary slot specification
196  auto& slotManager = getMotherBoard().getSlotManager();
197  auto* primaryConfig = getDeviceConfig2().getPrimary();
198  auto* secondaryConfig = getDeviceConfig2().getSecondary();
199  if (primaryConfig) {
200  ps = slotManager.getSlotNum(primaryConfig->getAttribute("slot"));
201  } else {
202  throw MSXException("Invalid memory specification");
203  }
204  if (secondaryConfig) {
205  const auto& ss_str = secondaryConfig->getAttribute("slot");
206  ss = slotManager.getSlotNum(ss_str);
207  if ((-16 <= ss) && (ss <= -1) && (ss != ps)) {
208  throw MSXException(
209  "Invalid secondary slot specification: \"",
210  ss_str, "\".");
211  }
212  } else {
213  ss = 0;
214  }
215 
216  // This is only for backwards compatibility: in the past we added extra
217  // attributes "primary_slot" and "secondary_slot" (in each MSXDevice
218  // config) instead of changing the 'any' value of the slot attribute of
219  // the (possibly shared) <primary> and <secondary> tags. When loading
220  // an old savestate these tags can still occur, so keep this code. Also
221  // remove these attributes to convert to the new format.
222  const auto& config = getDeviceConfig();
223  if (config.hasAttribute("primary_slot")) {
224  auto& mutableConfig = const_cast<XMLElement&>(config);
225  const auto& primSlot = config.getAttribute("primary_slot");
226  ps = slotManager.getSlotNum(primSlot);
227  mutableConfig.removeAttribute("primary_slot");
228  if (config.hasAttribute("secondary_slot")) {
229  const auto& secondSlot = config.getAttribute("secondary_slot");
230  ss = slotManager.getSlotNum(secondSlot);
231  mutableConfig.removeAttribute("secondary_slot");
232  }
233  }
234 
235  // decode special values for 'ss'
236  if ((-128 <= ss) && (ss < 0)) {
237  if ((0 <= ps) && (ps < 4) &&
238  getCPUInterface().isExpanded(ps)) {
239  ss += 128;
240  } else {
241  ss = 0;
242  }
243  }
244 
245  // decode special values for 'ps'
246  if (ps == -256) {
247  slotManager.getAnyFreeSlot(ps, ss);
248  } else if (ps < 0) {
249  // specified slot by name (carta, cartb, ...)
250  slotManager.getSpecificSlot(-ps - 1, ps, ss);
251  } else {
252  // numerical specified slot (0, 1, 2, 3)
253  }
254  assert((0 <= ps) && (ps <= 3));
255 
256  if (!getCPUInterface().isExpanded(ps)) {
257  ss = -1;
258  }
259 
260  // Store actual slot in config. This has two purposes:
261  // - Make sure that devices that are grouped under the same
262  // <primary>/<secondary> tags actually use the same slot. (This
263  // matters when the value of some of the slot attributes is "any").
264  // - Fix the slot number so that it remains the same after a
265  // savestate/loadstate.
266  assert(primaryConfig);
267  primaryConfig->setAttribute("slot", strCat(ps));
268  if (secondaryConfig) {
269  string slot = (ss == -1) ? "X" : strCat(ss);
270  secondaryConfig->setAttribute("slot", slot);
271  } else {
272  if (ss != -1) {
273  throw MSXException(
274  "Missing <secondary> tag for device", getName());
275  }
276  }
277 
278  int logicalSS = (ss == -1) ? 0 : ss;
279  for (auto& r : tmpMemRegions) {
281  *this, ps, logicalSS, r.first, r.second);
282  memRegions.push_back(r);
283  }
284 
285  // Mark the slot as 'in-use' so that future searches for free external
286  // slots don't return this slot anymore. If the slot was not an
287  // external slot, this call has no effect. Multiple MSXDevices from the
288  // same extension (the same HardwareConfig) can all allocate the same
289  // slot (later they should also all free this slot).
290  slotManager.allocateSlot(ps, ss, getHardwareConfig());
291 }
292 
293 void MSXDevice::unregisterSlots()
294 {
295  if (memRegions.empty()) return;
296 
297  int logicalSS = (ss == -1) ? 0 : ss;
298  for (const auto& [base, size] : memRegions) {
300  *this, ps, logicalSS, base, size);
301  }
302 
303  // See comments above about allocateSlot() for more details:
304  // - has no effect for non-external slots
305  // - can be called multiple times for the same slot
307 }
308 
309 void MSXDevice::getVisibleMemRegion(unsigned& base, unsigned& size) const
310 {
311  // init() must already be called
312  if (memRegions.empty()) {
313  base = 0;
314  size = 0;
315  return;
316  }
317 
318  auto lowest = min_value(view::transform(memRegions,
319  [](auto& r) { return r.first; }));
320  auto highest = max_value(view::transform(memRegions,
321  [](auto& r) { return r.first + r.second; }));
322  assert(lowest <= highest);
323  base = lowest;
324  size = highest - lowest;
325 }
326 
327 void MSXDevice::registerPorts()
328 {
329  for (auto& i : getDeviceConfig().getChildren("io")) {
330  unsigned base = i->getAttributeAsInt("base");
331  unsigned num = i->getAttributeAsInt("num");
332  const auto& type = i->getAttribute("type", "IO");
333  if (((base + num) > 256) || (num == 0) ||
334  (type != one_of("I", "O", "IO"))) {
335  throw MSXException("Invalid IO port specification");
336  }
337  for (unsigned port = base; port < base + num; ++port) {
338  if (type == one_of("I", "IO")) {
339  getCPUInterface().register_IO_In(port, this);
340  inPorts.push_back(port);
341  }
342  if (type == one_of("O", "IO")) {
343  getCPUInterface().register_IO_Out(port, this);
344  outPorts.push_back(port);
345  }
346  }
347  }
348 }
349 
350 void MSXDevice::unregisterPorts()
351 {
352  for (auto& p : inPorts) {
354  }
355  for (auto& p : outPorts) {
357  }
358 }
359 
360 
361 void MSXDevice::reset(EmuTime::param /*time*/)
362 {
363  // nothing
364 }
365 
367 {
368  return 0xFF;
369 }
370 
371 void MSXDevice::powerDown(EmuTime::param /*time*/)
372 {
373  // nothing
374 }
375 
376 void MSXDevice::powerUp(EmuTime::param time)
377 {
378  reset(time);
379 }
380 
381 string MSXDevice::getName() const
382 {
383  return deviceName;
384 }
385 
387 {
388  result.addListElement(getName());
389 }
390 
392 {
393  result.addDictKeyValue("type", getDeviceConfig().getName());
394  getExtraDeviceInfo(result);
395 }
396 
398 {
399  // nothing
400 }
401 
403 {
404  return CacheLine::SIZE;
405 }
406 
407 
408 byte MSXDevice::readIO(word /*port*/, EmuTime::param /*time*/)
409 {
410  // read from unmapped IO
411  return 0xFF;
412 }
413 
414 void MSXDevice::writeIO(word /*port*/, byte /*value*/, EmuTime::param /*time*/)
415 {
416  // write to unmapped IO, do nothing
417 }
418 
419 byte MSXDevice::peekIO(word /*port*/, EmuTime::param /*time*/) const
420 {
421  return 0xFF;
422 }
423 
424 
425 byte MSXDevice::readMem(word /*address*/, EmuTime::param /*time*/)
426 {
427  // read from unmapped memory
428  return 0xFF;
429 }
430 
431 const byte* MSXDevice::getReadCacheLine(word /*start*/) const
432 {
433  return nullptr; // uncacheable
434 }
435 
436 void MSXDevice::writeMem(word /*address*/, byte /*value*/,
437  EmuTime::param /*time*/)
438 {
439  // write to unmapped memory, do nothing
440 }
441 
442 byte MSXDevice::peekMem(word address, EmuTime::param /*time*/) const
443 {
444  word base = address & CacheLine::HIGH;
445  if (const byte* cache = getReadCacheLine(base)) {
446  word offset = address & CacheLine::LOW;
447  return cache[offset];
448  } else {
449  // peek not supported for this device
450  return 0xFF;
451  }
452 }
453 
454 void MSXDevice::globalWrite(word /*address*/, byte /*value*/,
455  EmuTime::param /*time*/)
456 {
457  UNREACHABLE;
458 }
459 
460 void MSXDevice::globalRead(word /*address*/, EmuTime::param /*time*/)
461 {
462  UNREACHABLE;
463 }
464 
465 byte* MSXDevice::getWriteCacheLine(word /*start*/) const
466 {
467  return nullptr; // uncacheable
468 }
469 
470 
471 // calls 'action(<start2>, <size2>, args..., ps, ss)'
472 // with 'start', 'size' clipped to each of the ranges in 'memRegions'
473 template<typename Action, typename... Args>
474 void MSXDevice::clip(unsigned start, unsigned size, Action action, Args... args)
475 {
476  int ss2 = (ss != -1) ? ss : 0;
477  unsigned end = start + size;
478  for (auto [base, fullBsize] : memRegions) {
479  // split on 16kB boundaries
480  while (fullBsize > 0) {
481  unsigned bsize = std::min(fullBsize, ((base + 0x4000) & ~0x3fff) - base);
482 
483  unsigned baseEnd = base + bsize;
484  // intersect [start, end) with [base, baseEnd) -> [clipStart, clipEnd)
485  unsigned clipStart = std::max(start, base);
486  unsigned clipEnd = std::min(end, baseEnd);
487  if (clipStart < clipEnd) { // non-empty
488  unsigned clipSize = clipEnd - clipStart;
489  action(clipStart, clipSize, args..., ps, ss2);
490  }
491 
492  base += bsize;
493  fullBsize -= bsize;
494  }
495  }
496 }
497 
498 void MSXDevice::invalidateDeviceRWCache(unsigned start, unsigned size)
499 {
500  clip(start, size, [&](auto... args) { getCPUInterface().invalidateRWCache(args...); });
501 }
502 void MSXDevice::invalidateDeviceRCache(unsigned start, unsigned size)
503 {
504  clip(start, size, [&](auto... args) { getCPUInterface().invalidateRCache(args...); });
505 }
506 void MSXDevice::invalidateDeviceWCache(unsigned start, unsigned size)
507 {
508  clip(start, size, [&](auto... args) { getCPUInterface().invalidateWCache(args...); });
509 }
510 
511 void MSXDevice::fillDeviceRWCache(unsigned start, unsigned size, byte* rwData)
512 {
513  fillDeviceRWCache(start, size, rwData, rwData);
514 }
515 void MSXDevice::fillDeviceRWCache(unsigned start, unsigned size, const byte* rData, byte* wData)
516 {
517  assert(!allowUnaligned());
518  clip(start, size, [&](auto... args) { getCPUInterface().fillRWCache(args...); }, rData, wData);
519 }
520 void MSXDevice::fillDeviceRCache(unsigned start, unsigned size, const byte* rData)
521 {
522  assert(!allowUnaligned());
523  clip(start, size, [&](auto... args) { getCPUInterface().fillRCache(args...); }, rData);
524 }
525 void MSXDevice::fillDeviceWCache(unsigned start, unsigned size, byte* wData)
526 {
527  assert(!allowUnaligned());
528  clip(start, size, [&](auto... args) { getCPUInterface().fillWCache(args...); }, wData);
529 }
530 
531 template<typename Archive>
532 void MSXDevice::serialize(Archive& ar, unsigned /*version*/)
533 {
534  // When this method is called, the method init() has already been
535  // called (thus also registerSlots() and registerPorts()).
536  ar.serialize("name", deviceName);
537 }
539 
540 } // namespace openmsx
openmsx::MSXDevice
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:32
openmsx::MSXMotherBoard::getReactor
Reactor & getReactor()
Definition: MSXMotherBoard.hh:135
one_of.hh
HardwareConfig.hh
openmsx::MSXDevice::MSXDevice
MSXDevice(const MSXDevice &)=delete
openmsx::MSXMotherBoard::getSlotManager
CartridgeSlotManager & getSlotManager()
Definition: MSXMotherBoard.hh:121
openmsx::Scheduler
Definition: Scheduler.hh:34
min_value
auto min_value(InputIterator first, InputIterator last)
Definition: stl.hh:248
openmsx::MSXDevice::fillDeviceRCache
void fillDeviceRCache(unsigned start, unsigned size, const byte *rData)
Definition: MSXDevice.cc:520
gl::min
vecN< N, T > min(const vecN< N, T > &x, const vecN< N, T > &y)
Definition: gl_vec.hh:274
openmsx::MSXMotherBoard::getCurrentTime
EmuTime::param getCurrentTime()
Convenience method: This is the same as getScheduler().getCurrentTime().
Definition: MSXMotherBoard.cc:490
openmsx::MSXDevice::writeIO
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.
Definition: MSXDevice.cc:414
openmsx::MSXDevice::getReadCacheLine
virtual const byte * getReadCacheLine(word start) const
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition: MSXDevice.cc:431
openmsx::CommandController
Definition: CommandController.hh:18
serialize.hh
ranges::sort
void sort(RandomAccessRange &&range)
Definition: ranges.hh:35
TclObject.hh
openmsx::MSXDevice::readMem
virtual byte readMem(word address, EmuTime::param time)
Read a byte from a location at a certain time from this device.
Definition: MSXDevice.cc:425
openmsx::MSXDevice::globalRead
virtual void globalRead(word address, EmuTime::param time)
Global reads.
Definition: MSXDevice.cc:460
openmsx::MSXDevice::~MSXDevice
virtual ~MSXDevice()=0
Definition: MSXDevice.cc:58
openmsx::MSXDevice::getWriteCacheLine
virtual byte * getWriteCacheLine(word start) const
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: MSXDevice.cc:465
openmsx::MSXDevice::getScheduler
Scheduler & getScheduler() const
Definition: MSXDevice.cc:143
openmsx::DeviceConfig
Definition: DeviceConfig.hh:20
utf8::unchecked::size
size_t size(std::string_view utf8)
Definition: utf8_unchecked.hh:227
openmsx::MSXCPUInterface::register_IO_Out
void register_IO_Out(byte port, MSXDevice *device)
Devices can register their Out ports.
Definition: MSXCPUInterface.cc:350
ranges::set_difference
auto set_difference(InputRange1 &&range1, InputRange2 &&range2, OutputIter out)
Definition: ranges.hh:221
MSXCPU.hh
openmsx::XMLElement
XMLElement
Definition: XMLElement.cc:350
openmsx::DeviceConfig::getPrimary
XMLElement * getPrimary() const
Definition: DeviceConfig.hh:51
openmsx::MSXCPUInterface::isExpanded
bool isExpanded(int ps) const
Definition: MSXCPUInterface.hh:248
ranges.hh
openmsx::MSXDevice::serialize
void serialize(Archive &ar, unsigned version)
Definition: MSXDevice.cc:532
MSXException.hh
openmsx::MSXException
Definition: MSXException.hh:10
openmsx::MSXCPUInterface::invalidateRCache
void invalidateRCache(word start, unsigned size, int ps, int ss)
Definition: MSXCPUInterface.cc:621
openmsx::MSXDevice::globalWrite
virtual void globalWrite(word address, byte value, EmuTime::param time)
Global writes.
Definition: MSXDevice.cc:454
Math::ispow2
constexpr bool ispow2(T x) noexcept
Is the given number an integral power of two? That is, does it have exactly one 1-bit in binary repre...
Definition: Math.hh:57
openmsx::MSXCPUInterface::invalidateWCache
void invalidateWCache(word start, unsigned size, int ps, int ss)
Definition: MSXCPUInterface.cc:626
XMLElement.hh
openmsx::MSXDevice::Devices
std::vector< MSXDevice * > Devices
Definition: MSXDevice.hh:37
openmsx::MSXDevice::getCPUInterface
MSXCPUInterface & getCPUInterface() const
Definition: MSXDevice.cc:139
openmsx::CacheLine::HIGH
constexpr unsigned HIGH
Definition: CacheLine.hh:10
openmsx::MSXDevice::allowUnaligned
virtual bool allowUnaligned() const
By default we don't allow unaligned <mem> specifications in the config file.
Definition: MSXDevice.hh:290
openmsx::MSXDevice::writeMem
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.
Definition: MSXDevice.cc:436
strAppend
void strAppend(std::string &result, Ts &&...ts)
Definition: strCat.hh:644
openmsx::MSXMotherBoard::findDevice
MSXDevice * findDevice(std::string_view name)
Find a MSXDevice by name.
Definition: MSXMotherBoard.cc:649
openmsx::MSXMotherBoard::getCommandController
CommandController & getCommandController()
Definition: MSXMotherBoard.cc:480
openmsx::MSXCPUInterface
Definition: MSXCPUInterface.hh:64
openmsx::MSXDevice::peekMem
virtual byte peekMem(word address, EmuTime::param time) const
Read a byte from a given memory location.
Definition: MSXDevice.cc:442
openmsx::MSXDevice::readIRQVector
virtual byte readIRQVector()
Gets IRQ vector used in IM2.
Definition: MSXDevice.cc:366
openmsx::MSXDevice::reset
virtual void reset(EmuTime::param time)
This method is called on reset.
Definition: MSXDevice.cc:361
openmsx::Reactor
Contains the main loop of openMSX.
Definition: Reactor.hh:67
openmsx::MSXCPUInterface::registerMemDevice
void registerMemDevice(MSXDevice &device, int ps, int ss, int base, int size)
Devices can register themself in the MSX slotstructure.
Definition: MSXCPUInterface.cc:513
openmsx::MSXMotherBoard::getPluggingController
PluggingController & getPluggingController()
Definition: MSXMotherBoard.cc:375
move_pop_back
void move_pop_back(VECTOR &v, typename VECTOR::iterator it)
Erase the pointed to element from the given vector.
Definition: stl.hh:177
view::transform
auto transform(Range &&range, UnaryOp op)
Definition: view.hh:306
UNREACHABLE
#define UNREACHABLE
Definition: unreachable.hh:38
openmsx::TclObject::addListElement
void addListElement(T t)
Definition: TclObject.hh:121
max_value
auto max_value(InputIterator first, InputIterator last)
Definition: stl.hh:267
openmsx::LedStatus
Definition: LedStatus.hh:17
openmsx::MSXDevice::fillDeviceWCache
void fillDeviceWCache(unsigned start, unsigned size, byte *wData)
Definition: MSXDevice.cc:525
openmsx::MSXDevice::invalidateDeviceWCache
void invalidateDeviceWCache()
Definition: MSXDevice.hh:210
openmsx::MSXDevice::getVisibleMemRegion
void getVisibleMemRegion(unsigned &base, unsigned &size) const
Returns the range where this device is visible in memory.
Definition: MSXDevice.cc:309
openmsx::MSXDevice::getCurrentTime
EmuTime::param getCurrentTime() const
Definition: MSXDevice.cc:131
openmsx::MSXDevice::getDeviceInfo
void getDeviceInfo(TclObject &result) const
Get device info.
Definition: MSXDevice.cc:391
openmsx::MSXMotherBoard
Definition: MSXMotherBoard.hh:60
one_of
Definition: one_of.hh:7
openmsx::MSXCPU
Definition: MSXCPU.hh:29
MSXDevice.hh
INSTANTIATE_SERIALIZE_METHODS
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:981
openmsx::MSXDevice::getMotherBoard
MSXMotherBoard & getMotherBoard() const
Get the mother board this device belongs to.
Definition: MSXDevice.cc:75
openmsx::CacheLine::SIZE
constexpr unsigned SIZE
Definition: CacheLine.hh:7
openmsx::MSXMotherBoard::getScheduler
Scheduler & getScheduler()
Definition: MSXMotherBoard.hh:118
CacheLine.hh
openmsx::MSXCPUInterface::fillWCache
void fillWCache(unsigned start, unsigned size, byte *wData, int ps, int ss)
Definition: MSXCPUInterface.cc:642
view.hh
openmsx::TclObject::addDictKeyValue
void addDictKeyValue(const Key &key, const Value &value)
Definition: TclObject.hh:135
openmsx::MSXCPUInterface::register_IO_In
void register_IO_In(byte port, MSXDevice *device)
Devices can register their In ports.
Definition: MSXCPUInterface.cc:338
openmsx::MSXDevice::getLedStatus
LedStatus & getLedStatus() const
Definition: MSXDevice.cc:159
openmsx::MSXDevice::getDeviceConfig2
const DeviceConfig & getDeviceConfig2() const
Definition: MSXDevice.hh:233
openmsx::MSXDevice::getCliComm
CliComm & getCliComm() const
Definition: MSXDevice.cc:147
openmsx::MSXDevice::invalidateDeviceRCache
void invalidateDeviceRCache()
Definition: MSXDevice.hh:209
openmsx::MSXDevice::invalidateDeviceRWCache
void invalidateDeviceRWCache()
Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is lo...
Definition: MSXDevice.hh:208
openmsx::MSXCPUInterface::unregister_IO_In
void unregister_IO_In(byte port, MSXDevice *device)
Definition: MSXCPUInterface.cc:344
openmsx::CacheLine::LOW
constexpr unsigned LOW
Definition: CacheLine.hh:9
openmsx::MSXDevice::powerDown
virtual void powerDown(EmuTime::param time)
This method is called when MSX is powered down.
Definition: MSXDevice.cc:371
openmsx::MSXDevice::getBaseSizeAlignment
virtual unsigned getBaseSizeAlignment() const
The 'base' and 'size' attribute values need to be at least aligned to CacheLine::SIZE.
Definition: MSXDevice.cc:402
openmsx::MSXDevice::getReferences
const Devices & getReferences() const
Get the device references that are specified for this device.
Definition: MSXDevice.cc:125
openmsx::MSXDevice::getCommandController
CommandController & getCommandController() const
Definition: MSXDevice.cc:155
openmsx::MSXCPUInterface::fillRWCache
void fillRWCache(unsigned start, unsigned size, const byte *rData, byte *wData, int ps, int ss)
Definition: MSXCPUInterface.cc:632
openmsx::MSXDevice::getPluggingController
PluggingController & getPluggingController() const
Definition: MSXDevice.cc:163
openmsx::MSXDevice::getName
virtual std::string getName() const
Returns a human-readable name for this device.
Definition: MSXDevice.cc:381
openmsx::MSXDevice::readIO
virtual byte readIO(word port, EmuTime::param time)
Read a byte from an IO port at a certain time from this device.
Definition: MSXDevice.cc:408
openmsx::MSXMotherBoard::getLedStatus
LedStatus & getLedStatus()
Definition: MSXMotherBoard.cc:468
openmsx::CartridgeSlotManager::freeSlot
void freeSlot(int ps, int ss, const HardwareConfig &hwConfig)
Definition: CartridgeSlotManager.cc:248
openmsx::MSXMotherBoard::getCPUInterface
MSXCPUInterface & getCPUInterface()
Definition: MSXMotherBoard.cc:391
openmsx::MSXDevice::unmappedRead
static byte unmappedRead[0x10000]
Definition: MSXDevice.hh:300
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::MSXDevice::init
virtual void init()
Definition: MSXDevice.cc:49
MSXCPUInterface.hh
openmsx::CliComm
Definition: CliComm.hh:11
gl::max
vecN< N, T > max(const vecN< N, T > &x, const vecN< N, T > &y)
Definition: gl_vec.hh:292
stl.hh
openmsx::MSXDevice::getHardwareConfig
const HardwareConfig & getHardwareConfig() const
Returns the hardwareconfig this device belongs to.
Definition: MSXDevice.hh:43
openmsx::TclObject
Definition: TclObject.hh:22
CartridgeSlotManager.hh
openmsx::MSXCPUInterface::unregister_IO_Out
void unregister_IO_Out(byte port, MSXDevice *device)
Definition: MSXCPUInterface.cc:356
unreachable.hh
openmsx::DeviceConfig::getSecondary
XMLElement * getSecondary() const
Definition: DeviceConfig.hh:55
openmsx::MSXDevice::getNameList
virtual void getNameList(TclObject &result) const
Returns list of name(s) of this device.
Definition: MSXDevice.cc:386
Math.hh
openmsx::MSXCPUInterface::invalidateRWCache
void invalidateRWCache(word start, unsigned size, int ps, int ss)
Definition: MSXCPUInterface.cc:616
openmsx::MSXCPUInterface::unregisterMemDevice
void unregisterMemDevice(MSXDevice &device, int ps, int ss, int base, int size)
Definition: MSXCPUInterface.cc:543
openmsx::MSXDevice::peekIO
virtual byte peekIO(word port, EmuTime::param time) const
Read a byte from a given IO port.
Definition: MSXDevice.cc:419
openmsx::MSXDevice::testRemove
void testRemove(Devices alreadyRemoved) const
Checks whether this device can be removed (no other device has a reference to it).
Definition: MSXDevice.cc:80
openmsx::PluggingController
Central administration of Connectors and Pluggables.
Definition: PluggingController.hh:22
strCat
std::string strCat(Ts &&...ts)
Definition: strCat.hh:573
rfind_unguarded
auto rfind_unguarded(RANGE &range, const VAL &val)
Similar to the find(_if)_unguarded functions above, but searches from the back to front.
Definition: stl.hh:152
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::MSXDevice::getReactor
Reactor & getReactor() const
Definition: MSXDevice.cc:151
openmsx::MSXCPUInterface::fillRCache
void fillRCache(unsigned start, unsigned size, const byte *rData, int ps, int ss)
Definition: MSXCPUInterface.cc:637
MSXMotherBoard.hh
openmsx::MSXMotherBoard::getMSXCliComm
CliComm & getMSXCliComm()
Definition: MSXMotherBoard.cc:370
openmsx::MSXDevice::getExtraDeviceInfo
virtual void getExtraDeviceInfo(TclObject &result) const
Definition: MSXDevice.cc:397
openmsx::MSXMotherBoard::getCPU
MSXCPU & getCPU()
Definition: MSXMotherBoard.cc:384
openmsx::MSXDevice::powerUp
virtual void powerUp(EmuTime::param time)
This method is called when MSX is powered up.
Definition: MSXDevice.cc:376
openmsx::MSXDevice::getCPU
MSXCPU & getCPU() const
Definition: MSXDevice.cc:135
openmsx::MSXDevice::getDeviceConfig
const XMLElement & getDeviceConfig() const
Get the configuration section for this device.
Definition: MSXDevice.hh:230
openmsx::HardwareConfig::getMotherBoard
MSXMotherBoard & getMotherBoard() const
Definition: HardwareConfig.hh:41
openmsx::MSXDevice::fillDeviceRWCache
void fillDeviceRWCache(unsigned start, unsigned size, byte *rwData)
Calls MSXCPUInterface::fillXXCache() for the specific (part of) the slot that this device is located ...
Definition: MSXDevice.cc:511