1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
// license:GPL-2.0+
// copyright-holders:Dirk Best
/***************************************************************************
ACT Apricot Keyboard Interface
***************************************************************************/
#include "emu.h"
#include "keyboard.h"
#include "hle.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(APRICOT_KEYBOARD_INTERFACE, apricot_keyboard_bus_device, "apricot_kbd", "Apricot Keyboard Interface")
//**************************************************************************
// SLOT DEVICE
//**************************************************************************
//-------------------------------------------------
// apricot_keyboard_bus_device - constructor
//-------------------------------------------------
apricot_keyboard_bus_device::apricot_keyboard_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
device_t(mconfig, APRICOT_KEYBOARD_INTERFACE, tag, owner, clock),
device_single_card_slot_interface<device_apricot_keyboard_interface>(mconfig, *this),
m_kbd(nullptr),
m_in_handler(*this)
{
}
//-------------------------------------------------
// apricot_keyboard_bus_device - destructor
//-------------------------------------------------
apricot_keyboard_bus_device::~apricot_keyboard_bus_device()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void apricot_keyboard_bus_device::device_start()
{
// get connected keyboard
m_kbd = get_card_device();
// resolve callbacks
m_in_handler.resolve_safe();
}
//-------------------------------------------------
// host to module interface
//-------------------------------------------------
WRITE_LINE_MEMBER( apricot_keyboard_bus_device::out_w )
{
if (m_kbd)
m_kbd->out_w(state);
}
//**************************************************************************
// KEYBOARD INTERFACE
//**************************************************************************
//-------------------------------------------------
// device_apricot_keyboard_interface - constructor
//-------------------------------------------------
device_apricot_keyboard_interface::device_apricot_keyboard_interface(const machine_config &mconfig, device_t &device) :
device_interface(device, "apricotkbd")
{
m_host = dynamic_cast<apricot_keyboard_bus_device *>(device.owner());
}
//-------------------------------------------------
// ~device_apricot_keyboard_interface - destructor
//-------------------------------------------------
device_apricot_keyboard_interface::~device_apricot_keyboard_interface()
{
}
//**************************************************************************
// SLOT INTERFACE
//**************************************************************************
void apricot_keyboard_devices(device_slot_interface &device)
{
device.option_add("hle", APRICOT_KEYBOARD_HLE);
}
|