summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/generic.h
Commit message (Collapse)AuthorAgeFilesLines
* Created memcard as device and removed it from machine/generic (nw) Miodrag Milanovic2014-04-171-24/+0
| | | | This should be image device instead but did not wish to change behavior for now
* Let running_machine handle nvram save/load (nw) Miodrag Milanovic2014-02-021-11/+0
|
* removed few legacy calls (nw) Miodrag Milanovic2014-02-021-9/+0
|
* removed some unused legacy functions / flagged a few more things as ↵ Oliver Stöneberg2013-08-221-5/+2
| | | | deprecated / reduced the DEPRECATED noise a bit for now nw)
* removed legacy trampoline generic_pulse_irq_line_and_vector() (nw) Oliver Stöneberg2013-07-241-2/+2
|
* removed some legacy interrupt trampolines (nw) Oliver Stöneberg2013-07-241-32/+1
|
* Cleanups and version bumpmame0148 Miodrag Milanovic2013-01-111-5/+5
|
* Renamed device_irq_callback to device_irq_acknowledge_callback to Aaron Giles2012-04-101-3/+0
| | | | | | | | make its purpose clearer. Added delegate support for interrupt callbacks, and made driver_device variants of the generic interrupt helper callbacks. Did not convert existing callers yet due to logistical issues.
* modernization of some CUSTOM_INPUT's part 5 (no whatsnew) Miodrag Milanovic2012-04-091-7/+0
|
* Moved all drivers to using the audio/watchdog helpers defined in the ↵ Miodrag Milanovic2012-04-051-16/+0
| | | | driver_device base class. (no whatsnew)
* allow generic_pulse_irq_line to be longer than 1 cycle. Michaël Banaan Ananas2012-02-111-2/+2
| | | | | | | message to messdev: just change all callers: generic_pulse_irq_line(x, y); to generic_pulse_irq_line(x, y, 1);
* Removed ugly function cpu_interrupt_enable() from the core, and updated all ↵ Angelo Salese2011-11-301-1/+0
| | | | the drivers that used it accordingly [Angelo Salese]
* Removed ugly function interrupt_enable_w from the core, and updated all the ↵ Angelo Salese2011-11-291-2/+0
| | | | | | | | | | | | | | | | drivers that used it accordingly [Angelo Salese] Fixed scratchy sound in Birdiy, unlike all other Pac-Man HW games irq mask is at $5001 instead of $5000, so fixing that fixed the sound as well [Angelo Salese] Fixed bogus irq/nmi mask bit in Yie Ar Kung-Fu (IRQ mask bit was masking BOTH lines before) [Angelo Salese] Fixed bogus irq mask to sound CPU in Syusse Oozumou [Angelo Salese] Fixed bogus irq mask bit in SNK6502 HW games (IRQ mask bit was masking BOTH lines before) [Angelo Salese] Marked Truco Clemente as GNW since it never really worked (coin chutes stops working after one play), nw Out of whatsnew: And then I've realized that there's also cpu_interrupt_enable() function, another 19 instances to kill ... -.-"
* BIG update. Aaron Giles2011-03-291-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove redundant machine items from address_space and device_t. Neither machine nor m_machine are directly accessible anymore. Instead a new getter machine() is available which returns a machine reference. So: space->machine->xxx ==> space->machine().xxx device->machine->yyy ==> device->machine().yyy Globally changed all running_machine pointers to running_machine references. Any function/method that takes a running_machine takes it as a required parameter (1 or 2 exceptions). Being consistent here gets rid of a lot of odd &machine or *machine, but it does mean a very large bulk change across the project. Structs which have a running_machine * now have that variable renamed to m_machine, and now have a shiny new machine() method that works like the space and device methods above. Since most of these are things that should eventually be devices anyway, consider this a step in that direction. 98% of the update was done with regex searches. The changes are architected such that the compiler will catch the remaining errors: // find things that use an embedded machine directly and replace // with a machine() getter call S: ->machine-> R: ->machine\(\)\. // do the same if via a reference S: \.machine-> R: \.machine\(\)\. // convert function parameters to running_machine & S: running_machine \*machine([^;]) R: running_machine \&machine\1 // replace machine-> with machine. S: machine-> R: machine\. // replace &machine() with machine() S: \&([()->a-z0-9_]+machine\(\)) R: \1 // sanity check: look for this used as a cast (running_machine &) // and change to this: *(running_machine *)
* mame_file is now emu_file and is a class. It is required Aaron Giles2011-02-121-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | to pass a core_options object to the constructor, along with a search path. This required pushing either a running_machine or a core_options through some code that wasn't previously ready to handle it. emu_files can be reused over multiple open/close sessions, and a lot of core code cleaned up nicely as things were converted to them. Also created a file_enumerator class for iterating over files in a searchpath. This replaces the old mame_openpath functions. Changed machine->options() to return a reference. Removed public nvram_open() and fixed jchan/kaneko16 to stop directly saving NVRAM. Removed most of the mame_options() calls; this will soon go away entirely, so don't add any more. Added core_options to device_validity_check() so they can be used to validate things.
* running_device -> device_t Aaron Giles2010-12-311-3/+3
| | | | | They both already existed. No sense in having two names for the same object type.
* Added templates required_shared_ptr<> and optional_shared_ptr<> which Aaron Giles2010-09-041-9/+0
| | | | | | | | | | | | | | | | | | | | | | work just like required_device<> and optional_device<> for retrieving a pointer by tag from an address space that specifies AM_SHARE("tag"). Also added templates required_shared_size<> and optional_shared_size<> for retrieving the size of the AM_SHARE region. Created a new generic NVRAM device. It can be configured to default to 0-fill, 1-fill, random-fill, or custom fill. In all cases, a same-named memory region overrides the default fill. The address range where the NVRAM can be found is now identified by an AM_SHARE() region of the same tag as the NVRAM device. Drivers can also explicitly configure a separately-allocated NVRAM region via nvram_device::set_base(). Replaced all instances of MDRV_NVRAM_HANDLER(generic_*) with MDRV_NVRAM_ADD_*("nvram"). Replaced all AM_BASE_GENERIC/AM_SIZE_GENERIC(nvram) with AM_SHARE("nvram"). For all remaining drivers that referenced the generic.nvram directly, changed them to hold a required_shared_ptr<UINTx> to the NVRAM in their driver state, and use that instead. Removed nvram and nvram_size from the generic_ptrs.
* Split mame.c into mame.c and machine.c, the latter containing the Aaron Giles2010-06-301-1/+1
| | | | | | | | | | | | | | | | | | | running_machine definition and implementation. Moved global machine-level operations and accessors into methods on the running_machine class. For the most part, this doesn't affect drivers except for a few occasional bits: mame_get_phase() == machine->phase() add_reset_callback() == machine->add_notifier(MACHINE_NOTIFY_RESET, ...) add_exit_callback() == machine->add_notifier(MACHINE_NOTIFY_EXIT, ...) mame_get_base_datetime() == machine->base_datetime() mame_get_current_datetime() == machine->current_datetime() Cleaned up the region_info class, removing most global region accessors except for memory_region() and memory_region_length(). Again, this doesn't generally affect drivers.
* Correct a long-standing design flaw: device configuration state Aaron Giles2010-01-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is now separate from runtime device state. I have larger plans for devices, so there is some temporary scaffolding to hold everything together, but this first step does separate things out. There is a new class 'running_device' which represents the state of a live device. A list of these running_devices sits in machine->devicelist and is created when a running_machine is instantiated. To access the configuration state, use device->baseconfig() which returns a reference to the configuration. The list of running_devices in machine->devicelist has a 1:1 correspondance with the list of device configurations in machine->config->devicelist, and most navigation options work equally on either (scanning by class, type, etc.) For the most part, drivers will now deal with running_device objects instead of const device_config objects. In fact, in order to do this patch, I did the following global search & replace: const device_config -> running_device device->static_config -> device->baseconfig().static_config device->inline_config -> device->baseconfig().inline_config and then fixed up the compiler errors that fell out. Some specifics: Removed device_get_info_* functions and replaced them with methods called get_config_*. Added methods for get_runtime_* to access runtime state from the running_device. DEVICE_GET_INFO callbacks are only passed a device_config *. This means they have no access to the token or runtime state at all. For most cases this is fine. Added new DEVICE_GET_RUNTIME_INFO callback that is passed the running_device for accessing data that is live at runtime. In the future this will go away to make room for a cleaner mechanism. Cleaned up the handoff of memory regions from the memory subsystem to the devices.
* First round of an attempted cleanup of header files in the system. Aaron Giles2010-01-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Created new central header "emu.h"; this should be included by pretty much any driver or device as the first include. This file in turn includes pretty much everything a driver or device will need, minus any other devices it references. Note that emu.h should *never* be included by another header file. - Updated all files in the core (src/emu) to use emu.h. - Removed a ton of redundant and poorly-tracked header includes from within other header files. - Temporarily changed driver.h to map to emu.h until we update files outside of the core. Added class wrapper around tagmap so it can be directly included and accessed within objects that need it. Updated all users to embed tagmap objects and changed them to call through the class. Added nicer functions for finding devices, ports, and regions in a machine: machine->device("tag") -- return the named device, or NULL machine->port("tag") -- return the named port, or NULL machine->region("tag"[, &length[, &flags]]) -- return the named region and optionally its length and flags Made the device tag an astring. This required touching a lot of code that printed the device to explicitly fetch the C-string from it. (Thank you gcc for flagging that issue!)
* NOTE: This change requires two new osd functions: osd_malloc() and Aaron Giles2010-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | osd_free(). They take the same parameters as malloc() and free(). Renamed mamecore.h -> emucore.h. New C++-aware memory manager, implemented in emualloc.*. This is a simple manager that allows you to add any type of object to a resource pool. Most commonly, allocated objects are added, and so a set of allocation macros is provided to allow you to manage objects in a particular pool: pool_alloc(p, t) = allocate object of type 't' and add to pool 'p' pool_alloc_clear(p, t) = same as above, but clear the memory first pool_alloc_array(p, t, c) = allocate an array of 'c' objects of type 't' and add to pool 'p' pool_alloc_array_clear(p, t, c) = same, but with clearing pool_free(p, v) = free object 'v' and remove it from the pool Note that pool_alloc[_clear] is roughly equivalent to "new t" and pool_alloc_array[_clear] is roughly equivalent to "new t[c]". Also note that pool_free works for single objects and arrays. There is a single global_resource_pool defined which should be used for any global allocations. It has equivalent macros to the pool_* macros above that automatically target the global pool. In addition, the memory module defines global new/delete overrides that access file and line number parameters so that allocations can be tracked. Currently this tracking is only done if MAME_DEBUG is enabled. In debug builds, any unfreed memory will be printed at the end of the session. emualloc.h also has #defines to disable malloc/free/realloc/calloc. Since emualloc.h is included by emucore.h, this means pretty much all code within the emulator is forced to use the new allocators. Although straight new/delete do work, their use is discouraged, as any allocations made with them will not be tracked. Changed the familar auto_alloc_* macros to map to the resource pool model described above. The running_machine is now a class and contains a resource pool which is automatically destructed upon deletion. If you are a driver writer, all your allocations should be done with auto_alloc_*. Changed all drivers and files in the core using malloc/realloc or the old alloc_*_or_die macros to use (preferably) the auto_alloc_* macros instead, or the global_alloc_* macros if necessary. Added simple C++ wrappers for astring and bitmap_t, as these need proper constructors/destructors to be used for auto_alloc_astring and auto_alloc_bitmap. Removed references to the winalloc prefix file. Most of its functionality has moved into the core, save for the guard page allocations, which are now implemented in osd_alloc and osd_free.
* Introduced a generic_pointers structure within machine that is Aaron Giles2009-11-261-20/+21
| | | | | | | | | | | | | | | | | | | | | | | | designed to hold generic pointers that are commonly used. For now, only generic_nvram has moved there. Added AM_BASE_GENERIC and AM_SIZE_GENERIC macros for initializing generic pointers in memory maps. Also added AM_BASE_SIZE_GENERIC to set both base and size in one step. Moved global variables out of machine/generic and into a private data structure hanging off of the running_machine. Added newly- needed machine parameters to coin_counter_w, coin_lockout_w, and coin_lockout_global_w. Also added machine parameter to set_led_state. Added interface functions to get the number of dispensed tickets and to increment the count, to remove the need for direct access to these global variables. Also added functions to get the current count on a particular coin counter and to determine the lockout state. Future checkins will move the remaining generic pointers (for paletteram, videoram, spriteram, colorram, etc.) into the new generic_pointers structure.
* adds guilty gear xx slash set. davidhay2009-03-171-1/+1
|
* Converted the following drivers to the new device-based 6821 PIA: Aaron Giles2009-03-021-103/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - qix - mcr/williams - coinmstr - funworld - goldnpkr - jokrwild - nyny - r2dtank - spiders - tugboat Added new function memory_install_read_port_handler() to more easily allow you to install read handlers for ports based on tag. Removed input_port_read_handler8/16/32/64 functions, since they were really only used for getting a memory handler for a port by tag, and this is no longer necessary. Moved input port handlers to internal code in the memory system. Added port names to the taito8741 device pending its proper devicification. Removed all remaining uses of input_port_n_r() functions, and purged them from src/emu/machine/generic.
* Made CPUs into proper devices. CPUs are now added in the Aaron Giles2008-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | machine configuration just as any other device, and the standard CPU configuration is performed via the inline configuration macros. Change cpu_type from an enumeration into a pointer to the CPU's get_info function, very similar to device behavior. For now all CPUs are declared in cpuintrf.h, but eventually they should be declared in the CPU's header file, and the driver should #include that header. Added function cpu_get_type() to return the CPU type. Changed several cpu_* functions into macros that call through to the equivalent device_* function. The device system now maintains a parallel list of devices based on type, for faster iteration through all devices of a given type. Cleaned up code that looped over CPUs via the machine->cpu array to now loop using the type-based device list. Removed start/stop/reset/nvram functions from the device_config in favor of grabbing them as needed. Cleaned up the generic interrupt_enable code to work with CPU devices instead of numbers. Mapped the devtag_* functions to device_* functions via macros instead of parallel implementations.
* Re-routed empty get/set context calls to the dummy CPU's, and removed them Aaron Giles2008-12-091-0/+2
| | | | | | | | | from the CPU cores. Disabled the use of PULSE_LINE for any input lines except NMI and RESET. Added a helper function generic_pulse_irq_line() for doing a single-cycle assert/deassert for those few drivers remaining that were trying to use PULSE_LINE directly.
* From: Fabio Priuli [mailto:doge.fabio@gmail.com] Aaron Giles2008-09-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Subject: a few patches Hi, enclosed please find a few patches that finally conclude my input_port cleanups. I will still probably change some bit here and there, but there will be no more massive changes which could collide with current developments. Notice that, after applying these patches, indexed input reads remain only present in CPU interfaces (e.g. all the yamaha interfaces when the sound cpu is used to read inputs) and no more 16bit/32bit indexed read are present at all in MAME or MESS source. Therefore, you may consider the removal of input_port_N_word_r & input_port_N_dword_r, if you think you don't need them anymore. More in detail: * patch01.diff & patch02.diff: conclude the cleanup for drivers W -> Z * primrage.diff: changes the start buttons with input buttons in primrage, as per the test mode (no start button is reported) and the control panel (see http://www.mameworld.info/ubbthreads/showthreaded.php?Cat=&Number=161107 ) * drivedge.diff: makes drivedge ports fully 32bit and removes the protection bit (which seems not to be used in this game, or at least not in the port where it was tested since at least MAME 0.100) * duplicate.diff: introduces a PORT_CUSTOM which returns a tagged input (like a input_port_read). this could be useful for those games which require to read the same 8bit (resp. 16bit) input in both the upper and lower half of a 16bit (resp. 32bit) port. you can see its use for this purpose in the modified drivers (fuukifg3, dreamwld, cojag etc.) Regards, Fabio Priuli
* From: Oliver Stoeneberg [mailto:oliverst@online.de] Aaron Giles2008-06-261-4/+4
| | | | | | | Subject: another Machine -> machine cleanup This cleans up most of the Machine stuff in src/emu/machine. There is a bit left to clean up, but it's mostly stuck at some interfaces now.
* removed meaningless service_coin_lockout_w function Nicola Salmoria2008-05-291-4/+0
| | | | updated the zaxxon driver to correctly handle the coin enable lines
* Copyright cleanup: Aaron Giles2008-01-061-1/+1
| | | | | | - removed years from copyright notices - removed redundant (c) from copyright notices - updated "the MAME Team" to be "Nicola Salmoria and the MAME Team"
* Initial checkin of MAME 0.121.mame0121 Aaron Giles2007-12-171-0/+292