summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/addrmap.c
Commit message (Collapse)AuthorAgeFilesLines
* small cleanup (nw) Miodrag Milanovic2015-04-221-2/+1
|
* some astring to std::string conversion (nw) Miodrag Milanovic2015-04-181-1/+1
|
* There is no implicit conversion to char* in std::string (nw) Miodrag Milanovic2015-04-121-1/+1
|
* cstr() - > c_str() as preparation for move to std::string (nw) Miodrag Milanovic2015-04-111-1/+1
|
* fixed signed integer overflow in address_map::uplift_submaps() - by O. ↵ Oliver Stöneberg2014-10-231-4/+4
| | | | Galibert (nw)
* addrmap.c: Only install the default device address map if the owner didn't ↵ Alex W. Jackson2014-09-191-8/+10
| | | | provide one [Alex Jackson]
* Memory system and Namco improvements: [Alex Jackson] Alex W. Jackson2014-09-181-141/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* removed lot of legacy code in memory system and removed corresponding macros ↵ Miodrag Milanovic2014-05-051-132/+0
| | | | (nw)
* next: Add mouse [O. Galibert] Olivier Galibert2014-04-191-1/+1
|
* device_gfx_interface and memory system improvements: [Alex Jackson] Alex W. Jackson2014-04-081-1/+2
| | | | | | | | | | | 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.
* h8: Rewrite [O. Galibert] Olivier Galibert2014-03-251-0/+4
| | | (mess) mu100: Main screen turn on [O. Galibert]
* 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-2/+17
|
* Allow AM_NOP in device address maps, there may be others that should be ↵ smf-2013-06-011-1/+1
| | | | allowed. [smf]
* Fixed clipping of device address maps if the size of the map caused the end ↵ smf-2013-05-311-1/+1
| | | | address to wrap. Added a proof of concept implementation of a address map bank device, which allows you to bank memory maps. Hooked it up to Taito GNET as an example [smf]
* Cleanups and version bumpmame0148 Miodrag Milanovic2013-01-111-30/+30
|
* addrmap: Yes, we can have a map for 8bits on 8bits, and that's not the end ↵ Olivier Galibert2012-10-201-1/+1
| | | | of the world [O. Galibert]
* memory: Fix dynamic recursive device mapping [O. Galibert] Olivier Galibert2012-10-101-5/+7
| | | | | | | | | | | Situation: - you have a device (pc-fdc) with a memory map on it - you map it dynamically into a cpu (maincpu) address space with install_device (isa-fdc does that) - the device pc-fdc has a subdevice (upd765) - the subdevice upd765 has its own memory map - the pc-fdc memory map includes the upd765 memory map through AM_DEVICE("upd765", ...) Before the fix, the code would search for upd765 as a subdevice of maincpu and not of pc-fdc.
* Moved device_delegates into their own files. Employed a Aaron Giles2012-09-261-53/+59
| | | | | | | | | | | | | non-templatized helper class so that the code can live co-located, rather than invading device.h. Changed the read/write delegates to derive from device_delegate. Updated the address map macros to create these properly. Removed remnants of the old AM_BASE/SIZE macros from the memory system.
* Memory handler normalization, part 1. Aaron Giles2012-09-171-140/+0
| | | | | | | | | | | | | READ/WRITE_DEVICE*_HANDLERs are now passed an address_space &, and the 8-bit variants get a mem_mask as well. This means they are now directly compatible with the member function delegates. Added a generic address space to the driver_device that can be used when no specific address space is available. Also added DECLARE_READ/WRITE_DEVICE*_HANDLER macros to declare device callbacks with default mem_mask parameters. [Aaron Giles]
* addrmap: Fix device mapping on big-endian systems [O. Galibert] Olivier Galibert2012-08-141-1/+1
|
* memory: Add support for dynamically mapping devices [O. Galibert] Olivier Galibert2012-08-031-0/+32
| | | | | | | | | | | | | | | | | | Just call install_device on the space with as parameters: - start and end of the mapping zone - device (not pointer to the device) - map method and optionally, if the device data width is not the same than the space data width: - device data width (for consistency checking) - unit mask For instance, the static mapping: AM_RANGE(0x02114100, 0x02114107) AM_DEVICE8("fdc", n82077aa_device, amap, 0xffffffff) can be converted to a dynamic mapping (where fdc is a pointer to the device): machine().device("maincpu")->memory().space(AS_PROGRAM)-> install_device(0x02114100, 0x02114107, *fdc, &n82077aa_device::amap, 8, 0xffffffff);
* Moved all drivers to using the paletteram helpers defined in the Aaron Giles2012-04-051-2/+0
| | | | | | | | | | | | | | | | | | driver_device base class. The palette base is now specified via an AM_SHARE of "paletteram" or "paletteram2". The driver_device base class now finds these pointers and places them in m_generic_paletteram_8/_16/_32 and m_generic_paletteram2_8/_16/_32. Removed machine.generic.paletteram*, and machine.generic entirely. Removed AM_BASE_GENERIC/AM_SIZE_GENERIC as they don't apply anymore. Changed required_/optional_shared_ptr to support set_target with base and size for manually configuring a shared pointer, and a new allocate method for dynamically allocating (and registering the memory for save states). A few subsequent cleanups are coming related to this, but wanted to get this in before the next modern push.
* Move devices into a proper hierarchy and handle naming Aaron Giles2012-01-241-49/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and paths consistently for devices, I/O ports, memory regions, memory banks, and memory shares. [Aaron Giles] NOTE: there are likely regressions lurking here, mostly due to devices not being properly found. I have temporarily added more logging to -verbose to help understand what's going on. Please let me know ASAP if anything that is being actively worked on got broken. As before, the driver device is the root device and all other devices are owned by it. Previously all devices were kept in a single master list, and the hierarchy was purely logical. With this change, each device owns its own list of subdevices, and the hierarchy is explicitly manifest. This means when a device is removed, all of its subdevices are automatically removed as well. A side effect of this is that walking the device list is no longer simple. To address this, a new set of iterator classes is provided, which walks the device tree in a depth first manner. There is a general device_iterator class for walking all devices, plus templates for a device_type_iterator and a device_interface_iterator which are used to build iterators for identifying only devices of a given type or with a given interface. Typedefs for commonly-used cases (e.g., screen_device_iterator, memory_interface_iterator) are provided. Iterators can also provide counts, and can perform indexed lookups. All device name lookups are now done relative to another device. The maching_config and running_machine classes now have a root_device() method to get the root of the hierarchy. The existing machine->device("name") is now equivalent to machine->root_device().subdevice("name"). A proper and normalized device path structure is now supported. Device names that start with a colon are treated as absolute paths from the root device. Device names can also use a caret (^) to refer to the owning device. Querying the device's tag() returns the device's full path from the root. A new method basetag() returns just the final tag. The new pathing system is built on top of the device_t::subtag() method, so anyone using that will automatically support the new pathing rules. Each device has its own internal map to cache successful lookups so that subsequent lookups should be very fast. Updated every place I could find that referenced devices, memory regions, I/O ports, memory banks and memory shares to leverage subtag/subdevice (or siblingtag/siblingdevice which are built on top). Removed the device_list class, as it doesn't apply any more. Moved some of its methods into running_machine instead. Simplified the device callback system since the new pathing can describe all of the special-case devices that were previously handled manually. Changed the core output function callbacks to be delegates. Completely rewrote the validity checking mechanism. The validity checker is now a proper C++ class, and temporarily takes over the error and warning outputs. All errors and warnings are collected during a session, and then output in a consistent manner, with an explicit driver and source file listed for each one, as well as additional device and/or I/O port contexts where appropriate. Validity checkers should no longer explicitly output this information, just the error, assuming that the context is provided. Rewrote the software_list_device as a modern device, getting rid of the software_list_config abstraction and simplifying things. Changed the way FLAC compiles so that it works like other external libraries, and also compiles successfully for MSVC builds.
* memory: Fix an endianness issue when doing a device mapping on a big endian ↵ Olivier Galibert2011-08-051-3/+4
| | | | bus [O. Galibert]
* Clean-ups and version bumpmame0143u1 Angelo Salese2011-07-111-2/+2
|
* addrmap: Add a useful error detection [O. Galibert] Olivier Galibert2011-07-051-1/+4
|
* addrmap: Allow adding device-sourced memory maps in the main map. [O. Galibert] Olivier Galibert2011-07-051-1/+173
| | | | | | | | | | | | | | | | | Device-side, it only works for modern device. Declare the map with DECLARE_ADDRESS_MAP(name, width). It's a method which can be virtual but not static. In the implementation, define ADDRESS_MAP_MODERN, and define the map starting with DEVICE_ADDRESS_MAP_START(name, width, device_class). Rest is like a normal modern map. To include it in the memory map use: AM_DEVICE( "device tag", devicea_class, name ) Or for device with differing widths: AM_DEVICE8( "device tag", devicea_class, name, unitmask ) AM_DEVICE16( "device tag", devicea_class, name, unitmask ) AM_DEVICE32( "device tag", devicea_class, name, unitmask )
* - Removed difference between handling driver and device address maps Miodrag Milanovic2011-05-081-11/+9
| | | | - Updated modern macros to propagate device so it is possible to make modern maps for devices too - Updated bsmt2000.c and mie.c as examples of modern address map devices
* reapplied change until someone can actually explain where it causes a problem. smf-2011-05-081-2/+2
|
* Reverting back addrmap changes and adding AM_SUBDEVICE macro to help ↵ Miodrag Milanovic2011-05-081-2/+2
| | | | addressing cpu sub devices in address maps (no whatsnew)
* "You have taken your first step into a larger world." ―Obi-Wan Kenobi smf-2011-05-061-2/+2
| | | | | | | | | | | | | Converted PlayStation DMA to an internal device to the CPU core. DMA to external devices can be set in the machine config, the old calls are still there until the rest of the code is converted. [smf] The following MAME core changes have been required to allow internal devices to be configurable by the main machine config & to work with internal memory maps. device.machine_config_additions() are now processed as soon as the device is added, so sub devices can be configured straight away. replacing or removing a device removes any devices owned by the device being removed, as now they are added straight away. device_t::subdevice() uses the machine config device list instead of the machine to find the device as the machine is not created until after all the devices have been created. devices in an internal address map are assumed to be owned by the CPU, while devices in a standard address maps are assumed to be siblings of the CPU. A code review and regression test would be a good idea.
* Collapsed device_config and device_t into one class. Updated all Aaron Giles2011-04-271-84/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | existing modern devices and the legacy wrappers to work in this environment. This in general greatly simplifies writing a modern device. [Aaron Giles] General notes: * some more cleanup probably needs to happen behind this change, but I needed to get it in before the next device modernization or import from MESS :) * new template function device_creator which automatically defines the static function that creates the device; use this instead of creating a static_alloc_device_config function * added device_stop() method which is called at around the time the previous device_t's destructor was called; if you auto_free anything, do it here because the machine is gone when the destructor is called * changed the static_set_* calls to pass a device_t & instead of a device_config * * for many devices, the static config structure member names over- lapped the device's names for devcb_* functions; in these cases the members in the interface were renamed to have a _cb suffix * changed the driver_enumerator to only cache 100 machine_configs because caching them all took a ton of memory; fortunately this implementation detail is completely hidden behind the driver_enumerator interface * got rid of the macros for creating derived classes; doing it manually is now clean enough that it isn't worth hiding the details in a macro
* Delegates 2.0 implementation. Resdesigned how delegates work to make Aaron Giles2011-04-161-12/+12
| | | | | | | | | | | | | | | | | | | | | them more flexible and simpler to use. Got rid of the proto_delegates altogether in favor of supporting delegates that are bound to NULL objects. Added a front-end template that supports "natural" syntax favored by libraries like boost. Added support for static functions that take reference parameters instead of pointer parameters for the object type. Updated all delegate users in the system to the new syntax. [Aaron Giles] Changed the DIRECT_UPDATE_HANDLER to take a machine reference like everything else in the system. Updated all users. [Aaron Giles] Changed the FUNC() macro to automatically put an & in front of the item passed. In general this works transparently, however it does have the nice side-effect of catching situations where a variable is passed instead of a function name. Fixed those cases to push the naming upstream so that the name is now provided properly. Also added a FUNC_NULL macro since FUNC(NULL) no longer works. [Aaron Giles]
* Created new enum type address_spacenum for specifying an address Aaron Giles2011-03-271-2/+2
| | | | | | | | | | | | space by index. Update functions and methods that accepted an address space index to take an address_spacenum instead. Note that this means you can't use a raw integer in ADDRESS_SPACE macros, so instead of 0 use the enumerated AS_0. Standardized the project on the shortened constants AS_* over the older ADDRESS_SPACE_*. Removed the latter to prevent confusion. Also centralized the location of these definitions to memory.h.
* Add DEVICE_SELF_OWNER which allows an address map to refer to the Aaron Giles2010-12-201-0/+5
| | | | | owner of its owning device. Useful for CPU address map handlers for CPU's that are part of a device.
* Cleanups and version bump.mame0139u2 Aaron Giles2010-08-301-2/+2
|
* Massive memory system change. This is another step along the path toward Aaron Giles2010-08-191-381/+286
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | supporting cleaner implementations of drivers in the explicitly OO world. Expect a follow-on of several more changes to clean up from this one, which deliberately tried to avoid touching much driver code. Converted address_space to a class, and moved most members behind accessor methods, apart from space->machine and space->cpu. Removed external references to 8le/8be/16le/16be/32le/32be/64le/64be. All external access is now done via virtual functions read_byte()/read_word()/etc. Moved differentiation between the endianness and the bus width internal to memory.c, and also added a new axis to support small/large address spaces, which allows for faster lookups on spaces smaller than 18 bits. Provided methods for most global memory operations within the new address_space class. These will be bulk converted in a future update, but for now there are inline wrappers to hide this change from existing callers. Created new module delegate.h which implements C++ delegates in a form that works for MAME. Details are in the opening comment. Delegates allow member functions of certain classes to be used as callbacks, which will hopefully be the beginning of the end of fetching the driver_data field in most callbacks. All classes that host delegates must derive from bindable_object. Today, all devices and driver_data do implicitly via their base class. Defined delegates for read/write handlers. The new delegates are always passed an address_space reference, along with offset, data, and mask. Delegates can refer to methods either in the driver_data class or in a device class. To specify a callback in an address map, just use AM_READ_MEMBER(class, member). In fact, all existing AM_ macros that take read/write handlers can now accept delegates in their place. Delegates that are specified in an address map are proto-delegates which have no object; they are bound to their object when the corresponding address_space is created. Added machine->m_nonspecific_space which can be passed as the required address_space parameter to the new read/write methods in legacy situations where the space is not provided. Eventually this can go away but we will need it for a while yet. Added methods to the new address_space class to dynamically install delegates just like you can dynamically install handlers today. Delegates installed this way must be pre-bound to their object. Moved beathead's read/write handlers into members of beathead_state as an example of using the new delegates. This provides examples of both static (via an address_map) and dynamic (via install_handler calls) mapping using delegates. Added read/write member functions to okim6295_device as an example of using delegates to call devices. Updated audio/williams.c as a single example of calling the device via its member function callbacks. These will be bulk updated in a future update, and the old global callbacks removed. Changed the DIRECT_UPDATE_CALLBACKs into delegates as well. Updated all users to the new function format. Added methods on direct_read_data for configuring the parameters in a standard way to make the implementation clearer. Created a simple_list template container class for managing the common singly-linked lists we use all over in the project. Many other internal changes in memory.c, mostly involving restructuring the code into proper classes.
* Cleanups and version bump.mame0139u1 Aaron Giles2010-08-121-7/+7
|
* Return to type safety. Changed address maps back into functions that build Aaron Giles2010-08-011-0/+891
up the definition, rather than the whole tokenizing system, which lost type checking. Added a new module addrmap.c which implements the address map classes, and changed the macros to call methods on the address_map and address_map_entry classes which are strongly typed. Fixed a few incorrectly specified memory map entries along the way. Please double-check to make sure the behavior is expected in: twincobr.c, lordgun.c, galaxold.c. This change also means that since the address_maps are now constructor functions, they are detected when not used, so a number of #ifdef UNUSED_CODE were added around dangling address map definitions. Also included with this change: - removed cputag_clocks_to_attotime() and cputag_attotime_to_clocks() in favor of just expanding the class - same for cputag_suspend() and cputag_resume()