summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/devcb.h
Commit message (Collapse)AuthorAgeFilesLines
* devcb.h: Revert unnecessary change from ↵ AJR2019-06-271-10/+6
| | | | | | ed0202220a5243537f5ba7dbc0a38e52a8390d79 (nw) isnull() checks the list of unresolved functions along with the list of resolved ones, so resolve_safe() doesn't really need a return value as long as it is called second.
* screenless: make it a device (nw) hap2019-06-141-6/+10
|
* devcb: Eliminate legacy callback syntax (nw) AJR2019-06-061-99/+0
|
* GCC 9 fix (nw) arbee2019-05-031-1/+1
|
* added devcb workround to allow mitsumi keyboard to build with visual studio (nw) smf-2018-08-261-0/+2
|
* memory,devcb: Put capabilities at parity [O. Galibert] Olivier Galibert2018-08-101-24/+315
|
* memory: Allow simplified versions of handlers [O. Galibert] Olivier Galibert2018-08-021-20/+20
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Allow per-device internal layouts and remove some more MCFG_ macros. Vas Crabb2018-07-161-2/+0
| | | | | | | | | | | Input and screen tags are now resolved relative to a layout's owner device. Easy way to demonstrate is with: mame64 intlc440 -tty ie15 Previously you'd only get the IE15 terminal's layout and you'd be unable to use the INTELLEC 4/40 front panel. Now you'll get the choice of layouts from both the system and the terminal device in video options.
* I give in, GCC is screwed (nw) Vas Crabb2018-07-091-6/+30
|
* Hand the delegate mask down the line (nw) Vas Crabb2018-07-081-16/+23
|
* if this doesn't work around GCC 8, file a bug with GNU (nw) Vas Crabb2018-07-081-7/+17
|
* and again (nw) smf-2018-07-071-1/+1
|
* where did that come from (nw) smf-2018-07-071-1/+1
|
* remove typename which MSVC wanted, will try to find another way (nw) smf-2018-07-071-2/+2
|
* devcb.h: Looks like GCC does require typename (nw) AJR2018-07-071-2/+2
|
* devcb.h: Further attempted GCC build fixing (nw) AJR2018-07-071-1/+1
|
* devcb.h: Attempted fix for GCC build (nw) AJR2018-07-071-1/+1
|
* Fixes for building with Microsoft Visual Studio 2015. (nw) smf-2018-07-071-2/+16
|
* (nw) well that was dumb - fix crashing ATA devices, slightly modernise some code Vas Crabb2018-07-071-2/+2
|
* devcb3 Vas Crabb2018-07-071-493/+2487
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are multiple issues with the current device callbacks: * They always dispatch through a pointer-to-member * Chained callbacks are a linked list so the branch unit can't predict the early * There's a runtime decision made on the left/right shift direction * There are runtime NULL checks on various objects * Binding a lambda isn't practical * Arbitrary transformations are not supported * When chaining callbacks it isn't clear what the MCFG_DEVCB_ modifiers apply to * It isn't possible to just append to a callback in derived configuration * The macros need a magic, hidden local called devcb * Moving code that uses the magic locals around is error-prone * Writing the MCFG_ macros to make a device usable is a pain * You can't discover applicable MCFG_ macros with intellisense * Macros are not scoped * Using an inappropriate macro isn't detected at compile time * Lots of other things This changeset overcomes the biggest obstacle to remving MCFG_ macros altogether. Essentially, to allow a devcb to be configured, call .bind() and expose the result (a bind target for the callback). Bind target methods starting with "set" repace the current callbacks; methods starting with "append" append to them. You can't reconfigure a callback after resolving it. There's no need to use a macro matching the handler signatures - use FUNC for everything. Current device is implied if no tag/finder is supplied (no need for explicit this). Lambdas are supported, and the memory space and offset are optional. These kinds of things work: * .read_cb().set([this] () { return something; }); * .read_cb().set([this] (offs_t offset) { return ~offset; }); * .write_cb().set([this] (offs_t offset, u8 data) { m_array[offset] = data; }); * .write_cb().set([this] (int state) { some_var = state; }); Arbitrary transforms are allowed, and they can modify offset/mask for example: * .read_cb().set(FUNC(my_state::handler)).transform([] (u8 data) { return bitswap<4>(data, 1, 3, 0, 2); }); * .read_cb().set(m_dev, FUNC(some_device::member)).transform([] (offs_t &offset, u8 data) { offset ^= 3; return data; }); It's possible to stack arbitrary transforms, at the cost of compile time (the whole transform stack gets inlined at compile time). Shifts count as an arbitrary transform, but mask/exor does not. Order of mask/shift/exor now matters. Modifications are applied in the specified order. These are NOT EQUIVALENT: * .read_cb().set(FUNC(my_state::handler)).mask(0x06).lshift(2); * .read_cb().set(FUNC(my_state::handler)).lshift(2).mask(0x06); The bit helper no longer reverses its behaviour for read callbacks, and I/O ports are no longer aware of the field mask. Binding a read callback to no-op is not supported - specify a constant. The GND and VCC aliases have been removed intentionally - they're TTL-centric, and were already being abused. Other quirks have been preserved, including write logger only logging when the data is non-zero (quite unhelpful in many of the cases where it's used). Legacy syntax is still supported for simple cases, but will be phased out. New devices should not have MCFG_ macros. I don't think I've missed any fundamental issues, but if I've broken something, let me know.
* srcclean (nw) Vas Crabb2018-05-271-1/+1
|
* Streamline machine configuration macros - everyone's a device edition. Vas Crabb2018-05-061-27/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Start replacing special device macros with additional constructors, starting with ISA, INTELLEC 4 and RS-232 buses. Allow an object finder to take on the target of another object finder. (For a combination of the previous two things in action, see either the INTELLEC 4 driver, or the Apple 2 PC Exporter card. Also check out looping over a device finder array to instantiate devices in some places. Lots of things no longer need to pass tags around.) Start supplying default clocks for things that have a standard clock or have all clocks internal. Eliminate the separate DEV versions of the DEVCB_ macros. Previously, the plain versions were a shortcut for DEVICE_SELF as the target. You can now supply a string tag (relative to current device being configured), an object finder (takes on the base and relative tag), or a reference to a device/interface (only do this if you know the device won't be replaced out from under it, but that's a safe assumption for your subdevices). In almost all cases, you can get the effect you want by supplying *this as the target. Eliminate sound and CPU versions of macros. They serve no useful purpose, provide no extra checks, make error messages longer, add indirection, and mislead newbies into thinking there's a difference. Remove a lot of now-unnecessary ":" prefixes binding things relative to machine root. Clean up some miscellaneous rot. Examples of new functionality in use in (some more subtle than others): * src/mame/drivers/intellec4.cpp * src/mame/drivers/tranz330.cpp * src/mame/drivers/osboren1.cpp * src/mame/drivers/zorba.cpp * src/mame/devices/smioc.cpp * src/devices/bus/a2bus/pc_xporter.cpp * src/devices/bus/isa/isa.h * src/devices/bus/isa/isa.h * src/devices/bus/intellec4/intellec4.h
* Make MCFG_DEVICE_ADD and callable device types more flexible: Vas Crabb2018-05-041-9/+2
| | | | | | | | | | | | | | | | | | | | | * Allows defaulted clocks (see subtle example with vboy) * Allows additional constructors (see RS232 port in tranz330) * Allows use of device finder in place of tag in MCFG_DEVICE_ADD * Requires out-of-line destructor for devices using incomplete types * Requires XTAL or explicit u32 for clocks for devices with private types Devices must still define the standard constructor. When writing additional constructors, be aware that the constructor runs before device_add_mconfig in the context of the existing device, not the new device. See osborne1, zorba, tranz330, and vboy for examples of this in use. Compilation is a bit slower, but this is temporary while refactoring is in progress. Eliminated the need for MCFG_SOUND_ROUTE_EX. Removed macros from slot option configuration - they just obfuscated code and slowed it down with needless dynamic casts, but didn't actually simplify it.
* Allow devcb to be bound to a device/mixin or the target of a device Vas Crabb2018-05-021-112/+250
| | | | | | | | | | finder. This works outside machine configuration context so the workarounds in ATA HLE and MSX slots are no longer necessary. It also allows reduction in tag repetition in machine configuration (see converted osborne1.cpp, zorba.cpp or the more extreme tranz330.cpp). Allow reimagined device instantiation to take a device finder based on current device being configured to reduce repetition (see tranz330.cpp).
* Bind devcb relative to current device. This is probably going to break Vas Crabb2018-05-011-3/+7
| | | | | | | plenty of things with late bind errors. Sorry. Remaining things to switch over include sound routes and things with custom delegates.
* devcb updates (nw) AJR2018-04-291-2/+15
| | | | | - Write callbacks can now be configured as `OUTPUT("item_name")`. This behaves equivalently to a zero-dimensional `output_finder`, while eliminating the need to instantiate and resolve this in driver classes separately from the callback itself. - The width of a callback's default mask now properly depends on its type (as was half-implemented before), instead of always being reset to 0xffffffffffffffff when actually configured. This allows MCFG_DEVCB_INVERT to work with line write callbacks as one might logically expect.
* devcb: Fix validation problem with chained callbacks (nw) AJR2018-02-201-2/+2
|
* Register device callbacks and add some basic validation for them AJR2018-02-201-0/+6
|
* dimemory: Lift the cap on the number of address spaces per device [O. Galibert] Olivier Galibert2017-07-031-2/+2
|
* devcb: Add line hold capability [O. Galibert] Olivier Galibert2017-06-071-1/+13
| | | | | | Whoever feels like saying that "HOLD does not exist in hardware", I invite to admire the beautiful TTL circuit to the left of the 68000s in the Over Drive schematics.
* Overhaul of devcb (nw) AJR2016-12-211-33/+116
| | | | | | | | | | | | | | - Allow stringing multiple callbacks together recursively. Chained callbacks will be read or written in sequence, and each can be configured with its own type and mask/shift/XOR parameters. - Chained input callbacks cannot have overlapping masks (there's no such thing as a free multiplex). Chained output callbacks have no such restriction. - Remove the constant parameter for the LOGGER callback type: it makes no sense for output, was always zero in existing usage, and is now unnecessary with callback chaining. - Change LOGGER behavior for writes to log the user-defined message only if the output as masked is nonzero. With callback chaining, this can be used to monitor when individual bits become active. - Constant read callbacks can no longer have MCFG_DEVCB_XOR or MCFG_DEVCB_INVERT specified (makes no sense in this context). - Add a MEMBANK callback type to allow output bits to be used for bank-switching. - Add ASSERTLINE and CLEARLINE callback types that raise or lower an interrupt line if the selected bit of the written value is active. These are intended for where periodic or ready-pulse signals from devices are used to trigger IRQs that the CPU program will independently acknowledge. - Add MCFG_DEVCB_BIT as shorthand for masking and shifting out an individual bit for a callback. - Removed DEVCB_LINE_DISPATCH_<n>. Where we're going, we don't need line dispatcher devices. The incompatibility of compilers with regard to post-C90 printf string formats is shockingly bad. There seems to be no easy way to format a 64-bit value and please both gcc and clang, let alone MSVC.
* Introduce u8/u16/u32/u64/s8/s16/s32/s64 Vas Crabb2016-11-191-67/+67
| | | | | | | | | | | | * 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
* NOTICE (TYPE NAME CONSOLIDATION) Miodrag Milanovic2016-10-221-57/+57
| | | | | 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
* NULL->nullptr, instead of DEVCB_NULL use always DEVCB_NOOP to prevent ↵ Miodrag Milanovic2016-04-241-21/+20
| | | | confusion (nw)
* reverting: Miodrag Milanovic2016-01-201-16/+16
| | | | | | | 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-16/+16
| | | | fix start project for custom builds in Visual Studio (nw)
* can't change this one (nw) Miodrag Milanovic2016-01-111-10/+10
|
* Return std::string objects by value rather than pass by reference AJR2016-01-101-10/+10
| | | | | | - strprintf is unaltered, but strformat now takes one fewer argument - state_string_export still fills a buffer, but has been made const - get_default_card_software now takes no arguments but returns a string
* clang-modernize part 1 (nw) Miodrag Milanovic2015-12-031-10/+10
|
* devcv2 -> devcb (nw) Miodrag Milanovic2014-05-141-0/+406
|
* farewell devcb (nw) Miodrag Milanovic2014-05-131-770/+0
|
* removed lot of legacy code in memory system and removed corresponding macros ↵ Miodrag Milanovic2014-05-051-0/+16
| | | | (nw)
* no handler usage is possible in devcb so removing not used code (nw) Miodrag Milanovic2014-04-021-42/+14
|
* Removed line_cb_t. (nw) Curt Coder2014-03-181-3/+0
| | | (MESS) nextkbd: devcb2. (nw)
* Removed DEVCB_LINE. (nw) Curt Coder2014-03-161-3/+0
|
* Removed DEVCB_DEVICE_LINE. (nw) Curt Coder2014-03-161-1/+0
|
* Removed DEVCB_DEVICE_HANDLER. (nw) Curt Coder2014-03-161-1/+0
|
* refactored some legacy code from n64 (nw) Miodrag Milanovic2014-03-161-1/+1
|
* ups (nw) Miodrag Milanovic2014-03-161-1/+1
|
* moved legacy calls that left into one section, and commented not used devcb ↵ Miodrag Milanovic2014-03-161-13/+7
| | | | calls since we are moving towards devcb2 (nw)