summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/devcb.cpp
Commit message (Collapse)AuthorAgeFilesLines
* devcb: Remove the space for the handlers, it is not needed anyomre [Ivan ↵ Olivier Galibert2020-05-211-109/+0
| | | | Vangelista, O. Galibert]
* memory,devcb: Put capabilities at parity [O. Galibert] Olivier Galibert2018-08-101-0/+241
|
* devcb3 Vas Crabb2018-07-071-839/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* devcb: Despite the variable name, this string is not a tag here (nw) AJR2018-06-071-1/+1
|
* Bind devcb relative to current device. This is probably going to break Vas Crabb2018-05-011-70/+73
| | | | | | | 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-1/+36
| | | | | - 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.
* srcclean (nw) Vas Crabb2018-02-251-1/+1
|
* devcb: Really fix mistake (nw) AJR2018-02-201-1/+1
|
* devcb: Fix mistake (nw) AJR2018-02-201-1/+1
|
* devcb: Fix validation problem with chained callbacks (nw) AJR2018-02-201-6/+10
|
* Register device callbacks and add some basic validation for them AJR2018-02-201-139/+262
|
* 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-0/+17
| | | | | | 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-26/+162
| | | | | | | | | | | | | | - 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-24/+24
| | | | | | | | | | | | * 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
* removed another root_device/driver_device dependency (nw) smf-2016-11-101-2/+2
|
* NOTICE (TYPE NAME CONSOLIDATION) Miodrag Milanovic2016-10-221-23/+23
| | | | | 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
* reverting: Miodrag Milanovic2016-01-201-13/+13
| | | | | | | SHA-1: 1f90ceab075c4869298e963bf0a14a0aac2f1caa * tags are now strings (nw) fix start project for custom builds in Visual Studio (nw)
* Revert "Fix callbacks resolve (nw)" Miodrag Milanovic2016-01-201-3/+3
| | | | This reverts commit a0ca8148ebd8751947d6c8521a09b21150915d31.
* Fix callbacks resolve (nw) Miodrag Milanovic2016-01-171-3/+3
|
* tags are now strings (nw) Miodrag Milanovic2016-01-161-13/+13
| | | | fix start project for custom builds in Visual Studio (nw)
* clang-modernize part 1 (nw) Miodrag Milanovic2015-12-031-16/+16
|
* Cleanups and version bumpmame0168 Miodrag Milanovic2015-11-251-4/+4
|
* Some cleanups and init fixes with help of ReSharper C++ (nw) Miodrag Milanovic2015-11-111-2/+4
|
* Rename *.c -> *.cpp in our source (nw) Miodrag Milanovic2015-11-081-0/+555