summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/emumem.cpp
Commit message (Collapse)AuthorAgeFilesLines
* emu/romload.cpp: Resolve tags for ROM_COPY relative to current device properly. Vas Crabb2024-11-231-58/+0
| | | | | Tags can contain multiple colon-separated parts. Also, we really don't need tag manipulation code proliferating throughout the codebase.
* fixed ROM_COPY to use a relative region name, so it can be used in a device. ↵ smf-2024-11-221-0/+58
| | | | [smf]
* emumem: Fix delegates on delay methods Olivier Galibert2023-02-221-6/+12
| | | | | m68000: Fix the vpa timings mac128: Use vpa for the via
* emumem: First try at wait states Olivier Galibert2023-02-221-0/+26
|
* Patched up some gaps in functionality and fixed some bugs. Vas Crabb2022-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ui: Added some missing functionality: * Added an option to copy input device IDs to the relevant menus. * Added an item for setting the software lists files path (-hashpath) to the folder setup menu. * Allow pasting text from clipboard in most places that allow typing (searching, entering filenames, entering barcodes). * Changed the software selection menu heading to be a bit less misleading. * Made barcode menu less eager to rebuild itself unnecessarily, and removed some confusing and apparently pointless code. Exposed more Lua bindings: * Added low-level palette objects. * Added indexed bitmap types. * Added a bitmap method for extracting pixels from a rectangular area as a packed binary string. * Changed screen device pixels method to return width and height in addition to the pixels. osd: Added some functionality and cleaned up a little: * Added a function for copying text to the clipboard. * Moved function for converting Windows error codes to standard error conditions to winutil.cpp so it can be used from more places. * Removed duplicate declaration of osd_get_clipboard_text and made the function noexcept (including fixing implementations). * Made macOS implementation of osd_get_clipboard_text skip the encoding conversion if it finds UTF-8 text first. * Changed the default -uimodekey setting so it doesn't lose the "not shift" that stops the default from interfering with UI paste. Various bug fixes: * util/unicode.cpp: Fixed the version of utf8_from_uchar that returns std::string blowing up on invalid codepoints. * util/bitmap.h: Fixed wrapping constructors for indexed bitmaps taking the wrong parameter type (nothing was using them before). * util/bitmap.cpp: Fixed potential use-after-free issues with bitmap palettes. * emu/input.cpp, emu/inputdev.cpp: Log 1-based device numbers, matching what's shown in the internal UI and used in tokens in CFG files. * emu/emumem.cpp: Added the bank tag to a fatal error message where it was missing. docs: Reworked and expanded documentation on configuring stable controller IDs. For translators, the changes are quite minor: * There's a menu item for copying a device ID to the clipboard, and associated success/failure messages. * There's the menu item for setting the software list file search path. * One of the lines in the software selection menu heading has changes as it could be interpreted as implying it showed a software list name.
* Addressed some Lua scripting pitfalls. (#9294) Vas Crabb2022-02-121-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Addressed pure virtual function call crash on end of emulation session if you haven't explicitly removed all address space taps, memory corruption on end of emulation session if you haven't explicitly removed all address space change notifiers, and symbol being garbage-collected out from under you while you have parsed expressions or other symbol tables that depend on them. Removed the copy constructor for parsed expressions as the underlying C++ copy constructor appears to be broken, and simplified symbol table constructors. Also made symbol table add methods return the new entry to avoid the need for an extra lookup. Fixed breakpoint/watchpoint objects being inappropriately copied into the tables returned by bplist() and wplist(), allowing the enabled property to be modifiable for breakpoint and watchpoint objects in Lua. Fixed drivers and devices causing a new memory pass-through handler to be allocated on each soft reset, and fixed multiple instances of taps being installed in the event the machine is reset before the tap is removed. Added classes for managing broadcast subscriptions, and adapted address spaces to use this for change notifications.
* Fun with flags: Allows handlers to have user-defined flags set on Olivier Galibert2021-11-281-53/+53
| | | | | | them, which can them be picked up on access with the {read,write}_*_flags variants of the accessors. Example use with the i960 and its burstable rom/ram.
* views: Fix a number of problems with specific boundaries. Olivier Galibert2021-09-111-2/+7
|
* emu/emumem*: Removed endianness template parameter from handler_entry_read, ↵ ajrhacker2021-07-091-77/+51
| | | | | handler_entry_write and closely related classes. (#8255) This appears to substantially reduce compilation time and binary size without too much impact on critical paths. The only critical-path parts really touched by this are probably handler_entry_read_units<Width, AddrShift, Endian>::read and handler_entry_write_units<Width, AddrShift, Endian>::write, which no longer need a branch on descriptor endianness for the downcast. The other instances of where the endianness now needs to be fetched from the address space are practically all in constructors, which probably don't get called too often except in drivers where the memory map is regularly rewritten (e.g. segas16b.cpp); even then the performance impact probably isn't huge.
* vt1682: probably fix fullrom read buffer overflow hap2021-05-101-1/+1
|
* emu/machine.cpp: Get rid of the dummy space device. Vas Crabb2021-05-051-2/+0
|
* 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.