summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/emumem.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove final cases where people directly registered state data with the core ↵ Aaron Giles2021-04-141-2/+16
| | | | manager. Fixed array stride calculations in registration. Removed old registration mechanism entirely.
* srcclean in preparation for release Vas Crabb2021-03-281-1/+1
|
* pmac6100: Move it to a new driver Olivier Galibert2021-03-121-1/+50
|
* Eliminate many unnecessary c_str calls AJR2020-12-211-1/+1
|
* view: Save their state Olivier Galibert2020-12-211-1/+0
|
* Fairly significant overhaul of Lua engine and some cleanup. Vas Crabb2020-11-251-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The things that were previously called device iterators are not iterators in the C++ sense of the word. This is confusing for newcomers. These have been renamed to be device enumerators. Several Lua methods and properties that previously returned tables now return lightweight wrappers for the underlying objects. This means creating them is a lot faster, but you can't modify them, and the performance characteristics of different operations varies. The render manager's target list uses 1-based indexing to be more like idiomatic Lua. It's now possible to create a device enumerator on any device, and then get subdevices (or sibling devices) using a relative tag. Much more render/layout functionality has been exposed to Lua. Layout scripts now have access to the layout file and can directly set the state of an item with no bindings, or register callbacks to obtain state. Some things that were previously methods are now read-only properties. Layout files are no longer required to supply a "name". This was problematic because the same layout file could be loaded for multiple instances of the same device, and each instance of the layout file should use the correct inputs (and in the future outputs) for the device instance it's associated with. This should also fix video output with MSVC builds by avoiding delegates that return things that don't fit in a register.
* Work around GNU libstdc++ wanting to stack large temporaries when vector ↵ Vas Crabb2020-11-231-1/+1
| | | | elements can be trivially constructed.
* Implement views, which are essentially bankdevs integrated into the Olivier Galibert2020-11-221-1218/+109
| | | | memory map system. [O. Galibert]
* Don't reject re-loading an unused bank [O. Galibert] Olivier Galibert2020-11-171-0/+3
|
* Fix memory leak on address_space_specific destruction and add a missing init ↵ Olivier Galibert2020-11-151-0/+5
| | | | [O. Galibert]
* emu/emumem.cpp: Use if constexpr to make code clearer Vas Crabb2020-11-151-160/+97
|
* -Switch to building MAME as C++17. Vas Crabb2020-11-151-2/+2
| | | | | | | * Updated sol2 to 3.2.2 * Updated pugixml to 1.10 * Increased minimum clang version to 6 * Cleaned up some stuff that can use new features
* Clean-up and consistency fixes after memory system changes. Vas Crabb2020-11-031-6/+3
|
* emumem: Simplify memory management. [O. Galibert] Olivier Galibert2020-11-021-585/+202
| | | | | | | | | | | | | | | | | | | | API impact: - install_ram/rom/writeonly now requires a non-null pointer. If you want automatically managed ram, add it to a memory map, not in machine_start - install_*_bank now requires a memory_bank *, not a string - one can create memory banks outside of memory maps with memory_bank_creator - one can create memory shares outside of memory maps with memory_share_creator Memory maps impact: - ram ranges with overlapping addresses are not shared anymore. Use .share() - ram ranges touching each other are not merged anymore. Stay in your range Extra note: - there is no need to create a bank just to dynamically map some memory/rom. Just use install_rom/ram/writeonly
* TMS340X0 updates AJR2020-08-191-0/+5
| | | | | | | - tms34020: Upgrade data bus to 32 bits and add preliminary masking for 16-bit operations - tms34010, tms34020: Eliminate pure 8-bit read/write bus accesses (these are always read-modify-write, even if aligned) - btoads, midxunit: Use 8-bit handlers for NVRAM, reducing size to 8192 bytes - midwunit, midxunit: Eliminate dependencies on midtunit driver
* various devices and drivers: removed superfluous semicolons (nw) Ivan Vangelista2020-06-291-3/+3
|
* emu: correct some file headers (nw) hap2020-06-191-1/+1
|
* Last memory change fixes (nw) Olivier Galibert2020-05-251-4/+4
|
* emumem: A little more speedup. cache and specific change syntax, and are ↵ Olivier Galibert2020-05-251-205/+112
| | | | | | | | | | | | | | | | not pointers anymore [O. Galibert] The last(?) two changes are: - Add a template parameter to everything (theoretically the address space width, in practice a level derived from it to keep as much compatibility between widths as possible) so that the shift size becomes a constant. - Change the syntax of declaring and initializing the caches and specifics so that they're embedded in the owner device. Solves lifetime issues and also removes one indirection (looking up the base dispatch pointer through the cache/specific pointer).
* emumem: Mask address where absolutely necessary (nw) AJR2020-05-231-45/+45
| | | | This change fixes the edge case of an unaligned accesses to the top of the space not wrapping around, which was causing at least one driver (alpinesa) to crash.
* emumem: Another slight speedup. masking before dispatch at top level is not ↵ Olivier Galibert2020-05-211-11/+9
| | | | needed because it's already done at the global mask level. [O. Galibert]
* emumem: Another slight speedup, implemented on the 680x0 for now [O. Galibert] Olivier Galibert2020-05-191-20/+6
| | | | | | | | | | | memory_access_specific is declared and used exactly like memory_access_cache, but does not cache. It does, however, shortcut the virtual call into address_space, so that's one layer of call less. Gives another nice speedup for accesses with bad locality (e.g. anything that's not opcodes), at the expense of having a specifically typed object in the class. Should do well for cpus in general, drivers can keep using the address_space access calls for easier logistics.
* emumem: Slight speedup [O. Galibert] Olivier Galibert2020-05-191-4/+24
|
* fixed some clang-tidy warnings (nw) (#6236) Oliver Stöneberg2020-01-301-2/+2
| | | | | | | | | | | | | | | | * fixed some modernize-redundant-void-arg clang-tidy warnings (nw) * fixed some modernize-use-bool-literals clang-tidy warnings (nw) * fixed some modernize-use-emplace clang-tidy warnings (nw) * fixed some performance-move-const-arg clang-tidy warnings (nw) * fixed some readability-redundant-control-flow clang-tidy warnings (nw) * fixed some readability-redundant-string-cstr clang-tidy warnings (nw) * fixed some performance-unnecessary-value-param clang-tidy warnings (nw)
* fixed some clang-tidy warnings (nw) (#6229) Oliver Stöneberg2020-01-291-1/+1
| | | | | | | | | | | | | | | | * fixed some readability-static-accessed-through-instance clang-tidy warnings (nw) * fixed some readability-redundant-string-cstr clang-tidy warnings (nw) * fixed some readability-redundant-control-flow clang-tidy warnings (nw) * fixed some modernize-use-nullptr clang-tidy warnings (nw) * fixed some performance-faster-string-find clang-tidy warnings (nw) * fixed some performance-for-range-copy clang-tidy warnings (nw) * fixed some performance-unnecessary-value-param clang-tidy warnings (nw)
* fixed some clang-tidy warnings (nw) (#6197) Oliver Stöneberg2020-01-221-6/+6
| | | | | | | | | | | | | | * fixed some bugprone-throw-keyword-missing clang-tidy warnings (nw) * fixed some modernize-use-nullptr clang-tidy warnings (nw) * fixed some readability-delete-null-pointer clang-tidy warnings (nw) * fixed some performance-faster-string-find clang-tidy warnings (nw) * fixed some performance-for-range-copy clang-tidy warnings (nw) * fixed some readability-redundant-string-cstr clang-tidy warnings (nw)
* (nw) move some stuff to an anonymous namespace, and fully specialise ↵ Vas Crabb2019-10-261-50/+54
| | | | templates that are no longer member classes
* Make devdelegate more like devcb for configuration. This is a Vas Crabb2019-10-261-521/+298
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fundamental change to show device delegates are configured. Device delegates are now aware of the current device during configuration and will resolve string tags relative to it. This means that device delegates need a device to be supplied on construction so they can find the machine configuration object. There's a one-dimensional array helper to make it easier to construct arrays of device delegates with the same owner. (I didn't make an n-dimensional one because I didn't hit a use case, but it would be a simple addition.) There's no more bind_relative_to member - just call resolve() like you would for a devcb. There's also no need to cast nullptr when creating a late bind device delegate. The flip side is that for an overloaded or non-capturing lambda you'll need to cast to the desired type. There is one less conditional branch in the hot path for calls for delegates bound to a function pointer of member function pointer. This comes at the cost of one additional unconditional branch in the hot path for calls to delegates bound to functoids (lambdas, functions that don't take an object reference, other callable objects). This applies to all delegates, not just device delegates. Address spaces will now print an error message if a late bind error is encountered while installing a handler. This will give the range and address range, hopefully making it easier to guess which memory map is faulty. For the simple case of allowing a device_delegate member to be configured, use a member like this: template <typename... T> void set_foo(T &&...args) { m_foo_cb.set(std::forward<T>(args)...); } For a case where different delegates need to be used depending on the function signature, see src/emu/screen.h (the screen update function setters). Device delegates now take a target specification and function pointer. The target may be: * Target omitted, implying the current device being configured. This can only be used during configuration. It will work as long as the current device is not removed/replaced. * A tag string relative to the current device being configured. This can only be used during configuration. It will not be callable until .resolve() is called. It will work as long as the current device is not removed/replaced. * A device finder (required_device/optional_device). The delegate will late bind to the current target of the device finder. It will not be callable until .resolve() is called. It will work properly if the target device is replaced, as long as the device finder's base object isn't removed/replaced. * A reference to an object. It will be callable immediately. It will work as long as the target object is not removed/replaced. The target types and restrictions are pretty similar to what you already have on object finders and devcb, so it shouldn't cause any surprises. Note that dereferencing a device finder will changes the effect. To illustrate this: ... required_device<some_device> m_dev; ... m_dev(*this, "dev") ... // will late bind to "dev" relative to *this // will work if "dev" hasn't been created yet or is replaced later // won't work if *this is removed/replaced // won't be callable until resolve() is called cb1.set(m_dev, FUNC(some_device::w)); ... // will bind to current target of m_dev // will not work if m_dev is not resolved // will not work if "dev" is replaced later // will be callable immediately cb2.set(*m_dev, FUNC(some_device::w)); ... The order of the target and name has been reversed for functoids (lambdas and other callable objects). This allows the NAME macro to be used on lambdas and functoids. For example: foo.set_something(NAME([this] (u8 data) { m_something = data; })); I realise the diagnostic messages get ugly if you use NAME on a large lambda. You can still give a literal name, you just have to place it after the lambda rather than before. This is uglier, but it's intentional. I'm trying to drive developers away from a certain style. While it's nice that you can put half the driver code in the memory map, it detracts from readability. It's hard to visualise the memory range mappings if the memory map functions are punctuated by large lambdas. There's also slightly higher overhead for calling a delegate bound to a functoid. If the code is prettier for trivial lambdas but uglier for non-trivial lambdas in address maps, it will hopefully steer people away from putting non-trivial lambdas in memory maps. There were some devices that were converted from using plain delegates without adding bind_relative_to calls. I fixed some of them (e.g. LaserDisc) but I probably missed some. These will likely crash on unresolved delegate calls. There are some devices that reset delegates at configuration complete or start time, preventing them from being set up during configuration (e.g. src/devices/video/ppu2c0x.cpp and src/devices/machine/68307.cpp). This goes against the design principles of how device delegates should be used, but I didn't change them because I don't trust myself to find all the places they're used. I've definitely broken some stuff with this (I know about asterix), so report issues and bear with me until I get it all fixed.
* disable VALIDATE_REFCOUNTS, due to nforcepc installing a device map while a ↵ smf-2019-10-251-1/+1
| | | | handler is being temporarily ref counted to prevent it being deleted. (nw)
* Make submaps work with address-shifted spaces (nw) AJR2019-06-091-2/+2
| | | | Note that submaps are now assumed to use an address shift of 0. It is possible, though unlikely, for this to cause some breakage.
* emumem: Remove obsolete alignement limit Olivier Galibert2019-04-061-19/+0
| | | | | | emumem_mud: Correct start/end on big endian apollo, fccpu20, fccpu30: Correct vector lookup address pic8259: Avoid reacting to debugger reads [O. Galibert]
* (nw) Clean up the mess on master Vas Crabb2019-03-261-9/+14
| | | | | | | | | | | | | This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at 598cd5227223c3b04ca31f0dbc1981256d9ea3ff. Before pushing, please check that what you're about to push is sane. Check your local commit log and ensure there isn't anything out-of-place before pushing to mainline. When things like this happen, it wastes everyone's time. I really don't need this in a week when real work™ is busting my balls and I'm behind where I want to be with preparing for MAME release.
* Revert "conflict resolution (nw)" andreasnaive2019-03-251-14/+9
| | | | | This reverts commit c24473ddff715ecec2e258a6eb38960cf8c8e98e, reversing changes made to 009cba4fb8102102168ef32870892438327f3705.
* emumem: Allow an address shift of 1 (to the right) for 8-bit spaces (nw) AJR2019-03-011-0/+9
|
* Eliminate the default address map member of address_space_config (nw) AJR2019-02-171-9/+5
| | | | | | Since all device address maps are now class methods defined in ordinary C++, default RAM maps can be provided more simply with an explicit has_configured_map check in an internal map definition. A number of default address maps that probably weren't meant to be overridden have also been changed to ordinary internal maps.
* emumem: remove m_baseptr, may fix the save state issues [O. Galibert] Olivier Galibert2018-12-201-9/+1
|
* -keyboard/a1200, changela, goldnpkr, m68705prg, mexico86, pipeline, pitnrun, ↵ mooglyguy2018-12-141-1/+1
| | | | | | | | | | qix, quizpun2, stfight, tigeroad: Removed MACHINE_CONFIG. [Ryan Holtz] -m68705, m68hc05: Removed MCFG. [Ryan Holtz] -qix: First-pass cleanup. [Ryan Holtz] -core: Fixed spelling of "nonexistent". [Ryan Holtz]
* Invalidate memory access caches when removing watchpoints to prevent crashes ↵ AJR2018-10-231-0/+1
| | | | on subsequent accesses to the same memory areas
* srcclean (nw) Vas Crabb2018-09-231-2/+2
|
* emumem: Fix ioports/membanks in internal maps [O. Galibert] Olivier Galibert2018-08-261-18/+18
| | | | PS: That may break things, we'll see.
* Apply logical address mask properly in debug disassembly view AJR2018-08-241-8/+68
| | | | | | Associated core changes (nw) - Move definition of address_space_config from dimemory.cpp to emumem.cpp (declaration was already in emumem.h) - Add getters for more members of address_space_config with future privatization in mind (nw)
* memory,devcb: Put capabilities at parity [O. Galibert] Olivier Galibert2018-08-101-1/+185
|
* memory: Allow simplified versions of handlers [O. Galibert] Olivier Galibert2018-08-021-31/+308
| | | | | | | | | | | | | | | | | | | | | | | A standard memory handler has as a prototype (where uX = u8, u16, u32 or u64): uX device::read(address_space &space, offs_t offset, uX mem_mask); void device::write(address_space &space, offs_t offset, uX data, uX mem_mask); We now allow simplified versions which are: uX device::read(offs_t offset, uX mem_mask); void device::write(offs_t offset, uX data, uX mem_mask); uX device::read(offs_t offset); void device::write(offs_t offset, uX data); uX device::read(); void device::write(uX data); Use them at will. Also consider (DECLARE_)(READ|WRITE)(8|16|32|64)_MEMBER on the way out, use the explicit prototypes. Same for lambdas in the memory map, the parameters are now optional following the same combinations.
* (nw) srcclean and some cleanup: Vas Crabb2018-07-221-17/+17
| | | | | | * Make more #include guards follow standard format - using MAME_ as the prefix makes it easy to see which ones come from our code in a preprocessor dump, and having both src/devices/machine/foo.h and src/mame/machine/foo.h causes issues anyway * Get #include "emu.h" out of headers - it should only be the first thing in a complilation unit or we get differences in behaviour with PCH on/off * Add out-of-line destructors to some devices - it forces the compiler to instantiate the vtable in a certain location and avoids some non-deterministic compiler behaviours
* A better way to make friends (nw) AJR2018-06-291-3/+0
|
* emumem: Backend modernization [O. Galibert] Olivier Galibert2018-06-291-3685/+869
|
* emumem: Rename direct_read_handler to memory_access_cache. Parametrize the ↵ Olivier Galibert2018-05-111-345/+177
| | | | template on more information (data width, endianness) to make it possible to turn it into an handler cache eventually, and not just a memory block cache. Make it capable of large and unaligned accesses. [O. Galibert]
* Relax constraints on address mirroring/global mask combinations. Mirror bits ↵ AJR2018-04-111-3/+1
| | | | | | are now allowed to fall outside the driver-specified global mask, though memory map validation requires that they cover the entire masked-out portions of the address space if any do. This change is intended to expedite debugging of software written for the TMPZ84C015 or similar Z80-based controllers which use 8-bit I/O addressing for the on-chip peripherals but may use either 8-bit or 16-bit addressing externally.
* Fix fencepost in memory_manager::region_containing, which caused regions to ↵ smf-2018-04-071-1/+1
| | | | be registered for state saving. [smf]
* Now that was a subtle one... (nw) Olivier Galibert2018-04-051-0/+2
|