summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/addrmap.h
Commit message (Collapse)AuthorAgeFilesLines
* Make submaps work with address-shifted spaces (nw) AJR2019-06-091-1/+1
| | | | Note that submaps are now assumed to use an address shift of 0. It is possible, though unlikely, for this to cause some breakage.
* memory,devcb: Put capabilities at parity [O. Galibert] Olivier Galibert2018-08-101-1/+37
|
* memory: Allow simplified versions of handlers [O. Galibert] Olivier Galibert2018-08-021-22/+72
| | | | | | | | | | | | | | | | | | | | | | | 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.
* emumem: Backend modernization [O. Galibert] Olivier Galibert2018-06-291-32/+0
|
* lift some stuff needed by devcb3 out of address map entry (nw) Vas Crabb2018-06-131-59/+15
|
* as if millions of this pointers suddenly cried out in terror, and were ↵ Vas Crabb2018-06-081-155/+148
| | | | | | | suddenly silenced * streamline templates in addrmap.h * get rid of overloads on read/write member names - this will become even more important in the near future
* Next-gen config: make address map config not look like arse Vas Crabb2018-06-061-13/+9
|
* addrmap.h: reduce code duplication and add support for device finders in ↵ Vas Crabb2018-06-011-74/+47
| | | | more places in memory maps
* addrmap: Remove the now-unused macros [Vas Crabb, Robbbert] Olivier Galibert2018-04-211-162/+0
|
* Rename some memory stuff (nw) Olivier Galibert2018-03-141-46/+157
|
* Generalized support for byte-smeared accesses (nw) (#3207) ajrhacker2018-02-151-1/+5
| | | The new cswidth address map constructor method overrides the masking normally performed on narrow-width accesses. This entailed a lot of reconfiguration to make the shifting and masking of subunits independent operations. There is unlikely to have any significant performance impact on drivers that don't frequently reconfigure their memory handlers.
* API change: Memory maps are now methods of the owner class [O. Galibert] Olivier Galibert2018-02-121-180/+209
| | | | | Also, a lot more freedom happened, that's going to be more visible soon.
* srcclean and regenerate localisations (nw) Vas Crabb2018-01-281-5/+5
|
* memory: Deambiguate handlers, also a hint of things to come (nw) Olivier Galibert2018-01-191-54/+119
|
* emumem: API change [O. Galibert] Olivier Galibert2017-11-291-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * direct_read_data is now a template which takes the address bus shift as a parameter. * address_space::direct<shift>() is now a template method that takes the shift as a parameter and returns a pointer instead of a reference * the address to give to {read|write}_* on address_space or direct_read_data is now the address one wants to access Longer explanation: Up until now, the {read|write}_* methods required the caller to give the byte offset instead of the actual address. That's the same on byte-addressing CPUs, e.g. the ones everyone knows, but it's different on the word/long/quad addressing ones (tms, sharc, etc...) or the bit-addressing one (tms340x0). Changing that required templatizing the direct access interface on the bus addressing granularity, historically called address bus shift. Also, since everybody was taking the address of the reference returned by direct(), and structurally didn't have much choice in the matter, it got changed to return a pointer directly. Longest historical explanation: In a cpu core, the hottest memory access, by far, is the opcode fetching. It's also an access with very good locality (doesn't move much, tends to stay in the same rom/ram zone even when jumping around, tends not to hit handlers), which makes efficient caching worthwhile (as in, 30-50% faster core iirc on something like the 6502, but that was 20 years ago and a number of things changed since then). In fact, opcode fetching was, in the distant past, just an array lookup indexed by pc on an offset pointer, which was updated on branches. It didn't stay that way because more elaborate access is often needed (handlers, banking with instructions crossing a bank...) but it still ends up with a frontend of "if the address is still in the current range read from pointer+address otherwise do the slowpath", e.g. two usually correctly predicted branches plus the read most of the time. Then the >8 bits cpus arrived. That was ok, it just required to do the add to a u8 *, then convert to a u16/u32 * and do the read. At the asm level, it was all identical except for the final read, and read_byte/word/long being separate there was no test (and associated overhead) added in the path. Then the word-addressing CPUs arrived with, iirc, the tms cpus used in atari games. They require, to read from the pointer, to shift the address, either explicitely, or implicitely through indexing a u16 *. There were three possibilities: 1- create a new read_* method for each size and granularity. That amounts to a lot of copy/paste in the end, and functions with identical prototypes so the compiler can't detect you're using the wrong one. 2- put a variable shift in the read path. That was too expensive especially since the most critical cpus are byte-addressing (68000 at the time was the key). Having bit-adressing cpus which means the shift can either be right or left depending on the variable makes things even worse. 3- require the caller to do the shift himself when needed. The last solution was chosen, and starting that day the address was a byte offset and not the real address. Which is, actually, quite surprising when writing a new cpu core or, worse, when using the read/write methods from the driver code. But since then, C++ happened. And, in particular, templates with non-type parameters. Suddendly, solution 1 can be done without the copy/paste and with different types allowing to detect (at runtime, but systematically and at startup) if you got it wrong, while still generating optimal code. So it was time to switch to that solution and makes the address parameter sane again. Especially since it makes mucking in the rest of the memory subsystem code a lot more understandable.
* Improved way to transform offsets for AM_DEVREAD/_DEVWRITE (nw) AJR2017-08-231-29/+50
| | | | | | In the past few hours AM_DEVREADWRITE_RSHIFT was created. This has made a lot of MAMEdevs (well, mostly R. Belmont) very angry and has widely been regarded as a bad move. This patch replaces AM_DEVREADWRITE_RSHIFT with a similar but more functional-looking interface (now known as AM_DEVREADWRITE_MOD), which also now supports address line inversion as well as shifting.
* Add address-shifted versions of AM_DEVREAD/_DEVWRITE/_DEVREADWRITE (nw) (#2586) ajrhacker2017-08-221-0/+32
| | | These new macros make it easy to map devices addressed using higher address lines (which on actual HW helps to reduce loads on the lowest address lines) without needing to set up custom handlers and associated device finders. The implementation should not impact the efficiency of the core memory system (which Olivier Galibert is trying to improve) since the semantic details are contained within C++11 lambdas.
* dimemory: Lift the cap on the number of address spaces per device [O. Galibert] Olivier Galibert2017-07-031-4/+4
|
* general cleanup: Vas Crabb2017-05-231-4/+0
| | | | | | | | | | | * move rarely-used output and pty interfaces out of emu.h * consolidate and de-duplicate forward declarations, also remove some obsolete ones * clean up more #include guard macros * scope down a few more things (nw) Everyone, please keep forward declarations for src/emu in src/emu/emufwd.h - this will make it far easier to keep them in sync with declarations than having them scattered through all the other files.
* Perform unitmask checking during validation in non-debug builds (nw) AJR2017-04-261-1/+3
|
* Introduce u8/u16/u32/u64/s8/s16/s32/s64 Vas Crabb2016-11-191-28/+28
| | | | | | | | | | | | * New abbreviated types are in osd and util namespaces, and also in global namespace for things that #include "emu.h" * Get rid of import of cstdint types to global namespace (C99 does this anyway) * Remove the cstdint types from everything in emu * Get rid of U64/S64 macros * Fix a bug in dps16 caused by incorrect use of macro * Fix debugcon not checking for "do " prefix case-insensitively * Fix a lot of messed up tabulation * More constexpr * Fix up many __names
* addrmem: Obvious renames and helpers [O. Galibert] Olivier Galibert2016-11-101-43/+61
|
* addrmap: Dotify [O. Galibert] Olivier Galibert2016-11-101-79/+79
|
* addrmap: Stream it [O. Galibert] Olivier Galibert2016-11-101-67/+60
|
* addrmap: Change setters into passthroughs [O. Galibert] Olivier Galibert2016-11-091-27/+27
|
* addrmap: De-hand-templatize address_map_entry, remove then unneeded entry ↵ Olivier Galibert2016-11-091-118/+23
| | | | parameter [O. Galibert]
* addrmap: Remove device parameter [O. Galibert] Olivier Galibert2016-11-091-13/+14
|
* NOTICE (TYPE NAME CONSOLIDATION) Miodrag Milanovic2016-10-221-39/+39
| | | | | Use standard uint64_t, uint32_t, uint16_t or uint8_t instead of UINT64, UINT32, UINT16 or UINT8 also use standard int64_t, int32_t, int16_t or int8_t instead of INT64, INT32, INT16 or INT8
* Fix GCC6 warnings Vas Crabb2016-06-161-2/+0
|
* Memory fun [O.Galibert] Olivier Galibert2016-06-141-0/+4
| | | | | | | | | | | | | | | | | | | | | - Added AM_SELECT/addrselect field. Replaces the old AM_MIRROR/AM_MASK combo used to mirror a handler and get the mirrored bits in the offset. - Removed mask and/or mirror from where it didn't belong. Simplified a lot of instances of mask that just weren't needed, especially in bus handlers. Used the short forms of install handlers where possible. - Replaced the 60s hippy, "It's cool man" range parameter handling in map_range that tried to guess what was meant when the values passed were not entirely sensible, by a cranky, diner waitress-turned IRS auditor curmudgeon. Main control function has a series of 14 tests just to find a reason to fatalerror out your requests. You have been warned. Some drivers, hopefully not many, will fail the gate-guarding bureaucrat trials. Should be easy to fix actually, I worked on the error messages. A full regression test would be welcome.
* NULL->nullptr, instead of DEVCB_NULL use always DEVCB_NOOP to prevent ↵ Miodrag Milanovic2016-04-241-30/+30
| | | | confusion (nw)
* Various cleanups suggested by static analyzer (nw) Miodrag Milanovic2016-04-241-3/+3
|
* Devfind revision phase 1, cleaning out some legacy stuff AJR2016-04-071-11/+0
| | | | | | | | - Eliminate the cached device_t::m_region pointer and its region() getter method. Devices that need to bind to a region with the same tag should use optional/required_memory_region or optional/required_region_ptr with DEVICE_SELF as the subtag; this improves error checking. (DEVICE_SELF has been moved to device.h for greater visibility in the source.) - Allow required/optional_region_ptr to specify a specific length which must match that of the region found. - Implement finder_base::finder_tag() getter for diagnostic purposes. - Perform some (not very efficient) validity checks on memory region finders instead of allowing them to automatically pass. - Privatize device_memory_interface::m_addrspace.
* reverting: Miodrag Milanovic2016-01-201-13/+14
| | | | | | | SHA-1: 1f90ceab075c4869298e963bf0a14a0aac2f1caa * tags are now strings (nw) fix start project for custom builds in Visual Studio (nw)
* tags are now strings (nw) Miodrag Milanovic2016-01-161-14/+13
| | | | fix start project for custom builds in Visual Studio (nw)
* Refactoring memory map validity checking AJR2015-12-191-0/+7
|
* clang-modernize part 1 (nw) Miodrag Milanovic2015-12-031-2/+2
|
* fixed -Wunused-local-typedefs warnings with ATTR_UNUSED and enabled it again ↵ Oliver Stöneberg2015-02-051-6/+6
| | | | (nw)
* Memory system and Namco improvements: [Alex Jackson] Alex W. Jackson2014-09-181-104/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Explicit regions in address maps (AM_REGION) are now looked up relative to the device rather than as siblings when in an internal address map (similar to devices and shared pointers) Besides being more orthogonal than before, this allows internal ROMs of MCUs and similar devices to be hooked up in a nicer and more foolproof way. Updated the m37710 and m5074x (m6502 derivative) to take advantage of this. Divided the M37702/M37710 into specific models, with each model having its own internal address map containing the correct amounts of internal RAM and ROM. M37702 MCUs found on various Namco PCBs are now all unique devices and have their respective internal ROMs loaded as device ROMs. (nw) Also did some spring (fall) cleaning in addrmap.c/memory.c/dimemory.c m_devbase (the base device used for tagmap lookup when late-binding handlers and finding memory regions and shares) is now a reference rather than a pointer, since we know what it is when the address_map_entry is constructed and it doesn't change (it depends solely on whether it's an entry in an MCFG-provided address map or an internal one) And for the same reason, there's now only one m_devbase per address_map_entry rather than individual copies for read/write/setoffset/sharedptr. Removed mysterious unused address_map_entry member "m_region_string", along with a silly assert probably left over from when Aaron was replacing AM_BASE with AM_SHARE years ago. Added a comment noting that "make sure all devices exist" in device_memory_interface::interface_validity_check() actually does nothing, like the proverbial goggles. The reason there's just a comment and not a fix is I haven't figured out how to fix it yet (is it possible to extract the original device tag that was given to a proto-delegate? Sorry, the template hell in devdelegate.h and lib/util/delegate.h makes me want to run screaming like a little girl)
* More cleanups, there is issue with srcclean that needs to be taken care as ↵ Miodrag Milanovic2014-07-221-1/+1
| | | | well, just doing now what we can
* removed lot of legacy code in memory system and removed corresponding macros ↵ Miodrag Milanovic2014-05-051-72/+1
| | | | (nw)
* Removed some not used macros (nw) Miodrag Milanovic2014-04-281-4/+0
|
* removed some unused AM_*_LEGACY macros (nw) Oliver Stöneberg2014-04-211-8/+0
|
* device_gfx_interface and memory system improvements: [Alex Jackson] Alex W. Jackson2014-04-081-3/+4
| | | | | | | | | | | Added macros to facilitate declaring gfxdecode info arrays as members of a device class. AM_SHAREs in a device's internal address map or its default address map are now tagmapped as children of that device rather than siblings (analogous to how handlers in internal/default address maps are scoped). Converted the Namco C45 to device_gfx_interface.
* Bulk convert files that already had standard BSD license in my name Aaron Giles2013-10-161-31/+2
| | | | to new license tagged form.
* New AM_(DEV)SETOFFSET feature for address maps. Michael Zapf2013-09-211-0/+15
|
* removed unused AM_DEVWRITE8_LEGACY macro (nw) Oliver Stöneberg2013-09-121-2/+0
|
* removed unused macro AM_DEVREAD8_LEGACY (nw) Oliver Stöneberg2013-07-251-6/+0
|
* Cleanups and version bumpmame0149u1 Miodrag Milanovic2013-07-231-1/+1
|
* removed unused AM_RAM_WRITE_LEGACY macro (nw) Oliver Stöneberg2013-07-121-4/+0
|