summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/apricot/keyboard/keyboard.cpp
blob: 87c491b6693bd6a05531396b80761dffa11041f7 (plain) (blame)
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
100
101
102
103
104
105
106
// 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, uint32_t clock) :
	device_t(mconfig, APRICOT_KEYBOARD_INTERFACE, tag, owner, clock),
	device_slot_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 = dynamic_cast<device_apricot_keyboard_interface *>(get_card_device());

	// resolve callbacks
	m_in_handler.resolve_safe();
}

//-------------------------------------------------
//  device_reset - device-specific reset
//-------------------------------------------------

void apricot_keyboard_bus_device::device_reset()
{
}

//-------------------------------------------------
//  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_slot_card_interface(mconfig, device)
{
	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
//**************************************************************************

SLOT_INTERFACE_START( apricot_keyboard_devices )
	SLOT_INTERFACE("hle", APRICOT_KEYBOARD_HLE)
SLOT_INTERFACE_END