diff options
Diffstat (limited to 'src/devices/machine/myb3k_kbd.h')
-rw-r--r-- | src/devices/machine/myb3k_kbd.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/devices/machine/myb3k_kbd.h b/src/devices/machine/myb3k_kbd.h index 34c2c5cc414..747289a53f1 100644 --- a/src/devices/machine/myb3k_kbd.h +++ b/src/devices/machine/myb3k_kbd.h @@ -14,6 +14,9 @@ is responsible for storing the byte into the serial/parallell converter (that can be read through IN from port 0x04) and then trigger an interrupt. + MCFG_DEVICE_ADD("myb3k_keyboard", MYB3K_KEYBOARD, 0) + MCFG_MYB3K_KEYBOARD_CB(PUT(myb3k_state, kbd_set_data_and_interrupt)) + **********************************************************************/ #ifndef MAME_MACHINE_MYB3K_KBD_H @@ -21,6 +24,11 @@ #pragma once +#define MYB3K_KBD_CB_PUT(cls, fnc) myb3k_keyboard_device::output_delegate((&cls::fnc), (#cls "::" #fnc), DEVICE_SELF, ((cls *)nullptr)) +#define MYB3K_KBD_CB_DEVPUT(tag, cls, fnc) myb3k_keyboard_device::output_delegate((&cls::fnc), (#cls "::" #fnc), (tag), ((cls *)nullptr)) + +#define MCFG_MYB3K_KEYBOARD_CB(cb) downcast<myb3k_keyboard_device &>(*device).set_keyboard_callback((MYB3K_KBD_CB_##cb)); + DECLARE_DEVICE_TYPE(MYB3K_KEYBOARD, myb3k_keyboard_device) DECLARE_DEVICE_TYPE(JB3000_KEYBOARD, jb3000_keyboard_device) DECLARE_DEVICE_TYPE(STEPONE_KEYBOARD, stepone_keyboard_device) @@ -43,18 +51,7 @@ public: TIMER_ID_SECOND_BYTE }; - template <class FunctionClass> - void set_keyboard_callback(void (FunctionClass::*callback)(u8 character), const char *name) - { - set_keyboard_callback(output_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr))); - } - // FIXME: this should be aware of current device for resolving the tag - template <class FunctionClass> - void set_keyboard_callback(const char *devname, void (FunctionClass::*callback)(u8 character), const char *name) - { - set_keyboard_callback(output_delegate(callback, name, devname, static_cast<FunctionClass *>(nullptr))); - } - void set_keyboard_callback(output_delegate callback) { m_keyboard_cb = callback; } + template <class Object> void set_keyboard_callback(Object &&cb) { m_keyboard_cb = std::forward<Object>(cb); } protected: myb3k_keyboard_device( |