summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/memory.c
Commit message (Collapse)AuthorAgeFilesLines
* fix winrun missing 3D Michaël Banaan Ananas2014-10-041-1/+1
| | | (this changes STATIC_COUNT from 0x100 to 0xff)
* Memory system and Namco improvements: [Alex Jackson] Alex W. Jackson2014-09-181-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* memory.c: fix memdump output for nop/unmapped/watchpoint entries, broken by ↵ Alex W. Jackson2014-09-161-47/+11
| | | | r31731 (nw)
* fm77av: converted various MMU functions to use bankdev. Dragon Buster is now mahlemiut2014-08-221-1/+1
| | | | | | almost 3 times faster than it was. memory.c: increased static handler limit, so that having a larger number of address map bank devices don't hit it.
* Cleanups and version bump Miodrag Milanovic2014-07-221-1/+0
|
* Grrrrr (nw) Olivier Galibert2014-05-181-1/+1
|
* removed lot of legacy code in memory system and removed corresponding macros ↵ Miodrag Milanovic2014-05-051-561/+76
| | | | (nw)
* finished comment in previous commit (nw) Oliver Stöneberg2014-05-031-1/+1
|
* disable logging of unmapped memory accesses when neither -log nor -debug is ↵ Oliver Stöneberg2014-05-031-10/+21
| | | | specified (nw)
* memory: Stop the watchpoints from messing with the opcode decryption [O. ↵ Olivier Galibert2014-04-171-2/+13
| | | | Galibert]
* Moved eminline and related files into /src/osd since it's system related (nw) Miodrag Milanovic2014-04-161-1/+1
| | | | | | | | Moved delegates into /src/lib/util to enable usage of delegates in other project parts Moved mame_printf_* calls into /src/osd/osdcore.c and renamed them to osd_printf_* Changed mess.mak to display compilation of ymmu100.ppm nicely
* device_gfx_interface and memory system improvements: [Alex Jackson] Alex W. Jackson2014-04-081-12/+12
| | | | | | | | | | | 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.
* use ARRAY_LENGTH (nw) Oliver Stöneberg2014-04-031-1/+1
|
* Moved core template container classes up from emutempl.h to coretmpl.h: Aaron Giles2014-03-111-26/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [Aaron Giles] * these classes now no longer take a resource_pool; everything is managed globally -- this means that objects added to lists must be allocated with global_alloc * added new auto_pointer<> template which wraps a pointer and auto-frees it upon destruction; it also defaults to NULL so it doesn't need to be explicitly initialized * moved tagged_list template to tagmap.h Redo of the low-level memory tracking system: [Aaron Giles] * moved low-level tracking out of emu\emualloc into lib\util\corealloc so it can be shared among all components and used by core libraries * global_alloc and friends no longer use a resource pool to track allocations; turns out this was a wholly redundant system that wasted a lot of memory * removed global_resource_pool entirely * added global_free_array to delete arrays allocated with global_alloc_array * added tracking of object versus array allocation; we will now error if you use global_free on an array, or global_free_array on an object Added new utility helper const_string_pool which can be used to efficiently accumulate strings that are not intended to be modified. Used by updated makelist and software list code. [Aaron Giles] Updated png2bdc and makelist tools to not leak memory and use more modern techniques (no more MAX_DRIVERS in makelist, for example). [Aaron Giles] Deprecated auto_strdup and removed all uses by way of caller-managed astrings and the software list rewrite. [Aaron Giles] Rewrote software list management: [Aaron Giles] * removed the notion of a software_list that is separate from a software_list_device; they are one and the same now * moved several functions into device_image_interface since they really didn't belong in the core software list class * lots of simplification as a result of the above changes Additional notes (no whatsnew): Moved definition of FPTR to osdcomm.h. Some changes happened in the OSD code to fix issues, especially regarding freeing arrays. SDL folks may need to fix up some of these. The following devices still are using tokens and should be modernized (I found them because they kept their token as void * and tried to delete it, which you can't): namco_52xx_device (mame/audio/namco52.c) namco_54xx_device (mame/audio/namco54.c) namco_06xx_device (mame/machine/namco06.c) namco_50xx_device (mame/machine/namco50.c) namco_51xx_device (mame/machine/namco51.c) namco_53xx_device (mame/machine/namco53.c) voodoo_device (emu/video/voodoo.c) mos6581_device (emu/sound/mos6581.c) aica_device (emu/sound/aica.c) scsp_device (emu/sound/scsp.c) dmadac_sound_device (emu/sound/dmadac.c) s3c2440_device (emu/machine/s3c2440.c) wd1770_device (emu/machine/wd17xx.c) latch8_device (emu/machine/latch8.c) duart68681_device (emu/machine/68681.c) s3c2400_device (emu/machine/s3c2400.c) s3c2410_device (emu/machine/s3c2410.c) strataflash_device (mess/machine/strata.c) hd63450_device (mess/machine/hd63450.c) tap_990_device (mess/machine/ti99/990_tap.c) omti8621_device (mess/machine/omti8621.c) vdt911_device (mess/video/911_vdt.c) apollo_graphics_15i (mess/video/apollo.c) asr733_device (mess/video/733_asr.c)
* Fix gcc 4.8 compile (nw) Alex W. Jackson2014-02-201-2/+1
|
* Another round of auto_alloc_array conversions. Aaron Giles2014-02-201-35/+20
| | | | | Some minor enhancements to dynamic_array, including clearing to specific values and expanding and clearing newly allocated values.
* 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-1/+142
|
* Memory system: added endianness to the memory_share class. Aaron Giles2013-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tilemap system: numerous changes: * Moved remaining legacy macros and typedefs to tilelgcy.h. This revealed a few drivers mixing and matching modern & legcy, which have now been fixed. * Changed get info callback signature to no longer pass the user_data pointer, but instead pass a reference to the tilemap object itself. Updated those few drivers using user_data to pull it out of the tilemap object with the new user_data() getter method. * Changed get info and mapping callbacks to be device_delegates so that they can be described at config time. * Added tilemap_memory object that is used internally for reading/ writing to memory that backs a tilemap. This object is used to track a memory pointer that backs tilemap memory, and also is designed to transparently handle all bus width and endianness associated with reading and writing data in a tilemap. * Incorporated two tilemap_memory objects (basemem and extmem) into the tilemap object and added accessors to them, as well as read/write handlers for reading/writing to entries stored in the memory. This means that tilemap get info callbacks can now easily read data out of the tilemap in a generic way. * Rejiggered the initialization sequence for tilemap objects so that the tilemap_manager is not required to be present at instantiation. * Created a new tilemap_device, which can be used to declare a tilemap in the machine config, and which also is a tilemap object itself. The tilemap device will look for shared memory regions called "<tag>" and "<tag>_ext" and automatically plug them into the tilemap. The device also provides write handlers that can be used to write to the tilemap memory and mark tiles dirty, saving the need for each driver to write their own. Device system: moved required/optional device finders to a new header devfind.h. Atari drivers: removed all playfield and alpha memory and tilemap variables, apart from those needed by atarivc-using games (this will become a device in a future update). Updated all Atari 16-bit drivers to use the new tilemap_device instead, which provides all the needed functionality in a more generic way.
* memory: Need moar tables [O. Galibert] Olivier Galibert2013-06-151-80/+82
|
* memory: Fix subunit reconfiguration [O. Galibert] Olivier Galibert2013-06-121-3/+3
| | | | | | | | | | | | To hit this bug you need to have two subsized handlers on the same address with a different starting address. Something like, in a 64-bits address map: AM_RANGE(0x00, 0x1f) AM_READ32(r1_r, 0xffffffff00000000) AM_RANGE(0x10, 0x1f) AM_READ32(r2_r, 0x00000000ffffffff) Then r2_r (last entry) was called with an incorrect offset. To say that this configuration does not happen often is an understatement.
* Fix address_space_specific::get_write_ptr() -nw- Phil Bennett2013-05-281-1/+1
|
* use proper free function for address_space.m_direct (nw) Oliver Stöneberg2013-02-211-1/+1
|
* memory: Add another missing 32->64 bits conversion when building the ↵ Oliver Stöneberg2013-02-111-1/+1
| | | | invsubmask (nw)
* memory: Add missing 32->64 bits conversion when building the invsubmask ↵ Olivier Galibert2013-02-101-1/+1
| | | | [Oliver Stöneberg]
* replaced bogus memcpy in handler_entry_{read|write} - fixes Visual ↵ Oliver Stöneberg2013-02-031-2/+30
| | | | Studio-only issues/crashes in paso1600, multi16, x68030 and t1000* sets (MT05124,MT05110,MT05112) [Olivier Galibert]
* Cleanups and version bumpmame0148 Miodrag Milanovic2013-01-111-246/+246
|
* memory: Map from the cpu's owner, not the root device, otherwise siblings of ↵ Olivier Galibert2012-10-121-1/+1
| | | | cpus coming from config fragments aren't happy. [O. Galibert]
* memory: Fix dynamic recursive device mapping [O. Galibert] Olivier Galibert2012-10-101-2/+2
| | | | | | | | | | | 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-36/+14
| | | | | | | | | | | | | 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.
* Remove all traces of read/write*_device_func from memory.c. Aaron Giles2012-09-181-216/+0
| | | | | | All legacy device callbacks are now promoted to delegates and handed off to the modern read/write handler managers. Fixed ibm5150 and surely many other broken systems. (nw)
* Memory handler cleanup 3. Add mem_mask parameter Aaron Giles2012-09-171-8/+8
| | | | | | | | to 8-bit handlers to match the others. To ease pain, added DECLARE_READ/WRITE_HANDLER macros that set up a default parameter. Also updated devcb so that the handlers can be called with or without the mem_mask. [Aaron Giles]
* Memory handler normalization, part 2. Change legacy Aaron Giles2012-09-171-48/+48
| | | | | | | read/write handlers to take an address_space & instead of an address_space *. Also update pretty much all other functions to take a reference where appropriate. [Aaron Giles]
* Memory handler normalization, part 1. Aaron Giles2012-09-171-23/+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]
* added missing \n to even more fatalerror() calls (no whatsnew) Oliver Stöneberg2012-09-081-7/+7
|
* memory: Add support for dynamically mapping devices [O. Galibert] Olivier Galibert2012-08-031-4/+22
| | | | | | | | | | | | | | | | | | 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);
* ioport.c C++ conversion. Mostly internal changes, with no Aaron Giles2012-05-031-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | intended differences from previous behavior. For drivers, the main change is that input_port_read() no longer exists. Instead, the port must be fetched from the appropriate device, and then read() is called. For member functions, this is actually simpler/cleaner: value = ioport("tag")->read() For legacy functions which have a driver_data state, it goes: value = state->ioport("tag")->read() For other legacy functions, they need to fetch the root device: value = machine.root_device().ioport("tag")->read() The other big change for drivers is that IPT_VBLANK is gone. Instead, it has been replaced by a device line callback on the screen device. There's a new macro PORT_VBLANK("tag") which automatically points things to the right spot. Here's a set of imperfect search & replace strings to convert the input_port_read calls and fix up IPT_VBLANK: input_port_read( *\( *)(machine\(\)) *, *([^)]+ *\)) ioport\1\3->read\(\) input_port_read( *\( *)(.*machine[()]*) *, *([^)]+ *\)) \2\.root_device\(\)\.ioport\1\3->read\(\) (state = .*driver_data[^}]+)space->machine\(\)\.root_device\(\)\. \1state-> (state = .*driver_data[^}]+)device->machine\(\)\.root_device\(\)\. \1state-> input_port_read_safe( *\( *)(machine\(\)) *, *([^,]+), *([^)]+\)) ioport\1\3->read_safe\(\4\) IPT_VBLANK( *\)) IPT_CUSTOM\1 PORT_VBLANK("screen")
* Use a tagged_list for memory_banks. Aaron Giles2012-04-241-6/+5
|
* Clean-ups and version bumpmame0145u7 Angelo Salese2012-04-221-2/+2
|
* Created ioport_manager and moved the port list to it. Aaron Giles2012-04-221-4/+2
| | | | | | Removed global port lookups, now all lookups must be done through device_t::ioport().
* Make memory shares follow the same pattern as memory Aaron Giles2012-04-201-17/+0
| | | | regions and memory banks, accessible only via the device.
* Changed device->subregion to device->memregion. Moved Aaron Giles2012-04-201-16/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | memory_region management into the memory manager instead of directly in the machine. Hid the global region method; now all regions must be looked up relative to a device. If you're a member function, you can just use memregion("tag") directly. If you're a global function or a device referencing global regions, use machine().root_device().memregion("tag") to look up regions relative to the root. S&R to convert all references: machine([()]*)\.region machine\1\.root_device\(\).subregion Then remove redundant machine().root_device() within src/mame: ([ \t])machine\(\)\.root_device\(\)\. \1 And use state->memregion() if we have a state variable present: (state *= *[^;]+driver_data[^}]+)([^ \t]*)machine[()]*\.root_device\(\)\. \1state-> Finally some cleanup: screen.state-> state-> device->state-> state-> space->state-> state-> And a few hand-tweaks.
* Remove global memory banking functions in favor of referencing Aaron Giles2012-04-191-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subbanks of a device and directly acting on them. First round S&R: memory_configure_bank( *)\(( *)([^,]+), *([^,]+), * \3.root_device().subbank\1\(\2\4\2\)->configure_entries\1\(\2 memory_configure_bank_decrypted( *)\(( *)([^,]+), *([^,]+), * \3.root_device().subbank\1\(\2\4\2\)->configure_decrypted_entries\1\(\2 memory_set_bank( *)\(( *)([^,]+), *([^,]+), * \3.root_device().subbank\1\(\2\4\2\)->set_entry\1\(\2 memory_set_bankptr( *)\(( *)([^,]+), *([^,]+), * \3.root_device().subbank\1\(\2\4\2\)->set_base\1\(\2 Then convert single entries to simpler form: configure_entries( *\( *[^,]+, *)1 *, *([^,]+),[^)]+\) configure_entry\1\2\) configure_decrypted_entries( *\( *[^,]+, *)1 *, *([^,]+),[^)]+\) configure_decrypted_entry\1\2\) Remove renundant root_device lookup for methods: ([ \t])machine\(\)\.root_device\(\)\. \1 Use state-> instead of root_device lookup where available (this one must be done by hand unfortunately): ([^ \t]*)machine[()]*\.root_device\(\)\. state->
* Now that memory_bank is exposed as an object, removed all the global Aaron Giles2012-04-181-144/+45
| | | | | | | | | | | | | | | | | | | bank manipulation APIs from memory_manager, and instead added a memory_manager::bank("tag") function which will return a pointer to the representative memory_bank. Operations can then be performed as expected directly on the memory_bank. Most code did not need an update yet, as I haven't done the search/replace to move away from global functions (which still exist for now). Added device_t::subbank("tag") to return a bank that is owned by the given device. Switched YM2151 interfaces over to devcb callbacks. Created proper sound devices for the Williams NARC, CVSD and ADPCM sound boards. Updated midyunit, midtunit, williams(joust2), and mcr68(archrivl/pigskin/trisport) to use the new devices.
* Remove AM_BASE in favor of AM_SHARED + required_shared_ptr. Aaron Giles2012-04-151-4/+0
| | | | | | | | This update passes validity checks but will certainly have a number of drivers failing at startup because all pointers are defaulted to required by the automated scripts used. Will fix problems once we get a regression run to find out which drivers need attention.
* Remove AM_SIZE entirely. AM_BASE_SIZE still exists, though. Aaron Giles2012-04-111-16/+0
|
* Clean-ups and version bumpmame0145u6 Angelo Salese2012-04-081-4/+4
|
* Converted memory_private to memory_manager and moved global memory Aaron Giles2012-04-051-346/+129
| | | | | | operations into methods on it. Converted the less-popular cases over in drivers that used them, leaving the bank management APIs global for now.
* Moved all drivers to using the paletteram helpers defined in the Aaron Giles2012-04-051-5/+1
| | | | | | | | | | | | | | | | | | 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.
* Some cleanup of some observed #include redundancy from source files which ↵ Scott Stone2012-02-061-1/+0
| | | | use emu.h (nw)