summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/keyboard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/keyboard.cpp')
-rw-r--r--src/devices/machine/keyboard.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/devices/machine/keyboard.cpp b/src/devices/machine/keyboard.cpp
index 52502597227..444850af23f 100644
--- a/src/devices/machine/keyboard.cpp
+++ b/src/devices/machine/keyboard.cpp
@@ -16,12 +16,16 @@ In the machine config function:
In the code:
-WRITE8_MEMBER( xxx_state::kbd_put )
+void xxx_state::kbd_put(u8 data)
{
(code to capture the key as it is pressed)
(if your machine uses function keys, add your conversion code here)
}
+In a device, at the top of the device's .cpp file in the appropriate spot:
+
+#include "machine/keyboard.ipp"
+
***************************************************************************/
#include "emu.h"
@@ -158,7 +162,7 @@ INPUT_PORTS_START( generic_keyboard )
PORT_BIT( 0x0100U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('8') PORT_CHAR('(')
PORT_BIT( 0x0200U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('9') PORT_CHAR('(')
PORT_BIT( 0x0200U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('9') PORT_CHAR(')')
- PORT_BIT( 0x0400U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('0') PORT_CHAR('(')
+ PORT_BIT( 0x0400U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('0') PORT_CHAR(')')
PORT_BIT( 0x0400U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('0')
PORT_BIT( 0x0800U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('-') PORT_CHAR('_')
PORT_BIT( 0x0800U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('-') PORT_CHAR('=')
@@ -253,7 +257,11 @@ generic_keyboard_device::generic_keyboard_device(
, m_config(*this, "GENKBD_CFG")
, m_modifiers(*this, "GENKBD_MOD")
, m_last_modifiers(0U)
- , m_keyboard_cb()
+ , m_keyboard_cb(*this)
+{
+}
+
+generic_keyboard_device::~generic_keyboard_device()
{
}
@@ -272,7 +280,7 @@ ioport_constructor generic_keyboard_device::device_input_ports() const
void generic_keyboard_device::device_start()
{
- m_keyboard_cb.bind_relative_to(*owner());
+ m_keyboard_cb.resolve_safe();
save_item(NAME(m_last_modifiers));
}
@@ -303,7 +311,6 @@ void generic_keyboard_device::key_repeat(u8 row, u8 column)
void generic_keyboard_device::send_key(u8 code)
{
- assert(!m_keyboard_cb.isnull());
m_keyboard_cb(code);
}