summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/abckb/abckb.cpp
blob: 78398af3d3ef2bb9ecb9446a4a8f5e62dd6cb060 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************

    Luxor ABC 800/802/806/1600 keyboard port emulation

**********************************************************************/

#include "abckb.h"



//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

// device type definition
const device_type ABC_KEYBOARD_PORT = &device_creator<abc_keyboard_port_device>;



//**************************************************************************
//  CARD INTERFACE
//**************************************************************************

//-------------------------------------------------
//  abc_keyboard_interface - constructor
//-------------------------------------------------

abc_keyboard_interface::abc_keyboard_interface(const machine_config &mconfig, device_t &device)
	: device_slot_card_interface(mconfig,device)
{
	m_slot = dynamic_cast<abc_keyboard_port_device *>(device.owner());
}


//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  abc_keyboard_port_device - constructor
//-------------------------------------------------

abc_keyboard_port_device::abc_keyboard_port_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock) :
	device_t(mconfig, ABC_KEYBOARD_PORT, "Luxor ABC keyboard port", tag, owner, clock, "abc_keyboard_port", __FILE__),
	device_slot_interface(mconfig, *this),
	m_out_rx_handler(*this),
	m_out_trxc_handler(*this),
	m_out_keydown_handler(*this), m_card(nullptr)
{
}


//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void abc_keyboard_port_device::device_start()
{
	m_card = dynamic_cast<abc_keyboard_interface *>(get_card_device());

	// resolve callbacks
	m_out_rx_handler.resolve_safe();
	m_out_trxc_handler.resolve_safe();
	m_out_keydown_handler.resolve_safe();
}


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

void abc_keyboard_port_device::device_reset()
{
	if (m_card != nullptr)
		get_card_device()->reset();
}


//-------------------------------------------------
//  write_rx -
//-------------------------------------------------

WRITE_LINE_MEMBER( abc_keyboard_port_device::write_rx )
{
	m_out_rx_handler(state);
}


//-------------------------------------------------
//  txd_w -
//-------------------------------------------------

WRITE_LINE_MEMBER( abc_keyboard_port_device::txd_w )
{
	if (m_card != nullptr)
		m_card->txd_w(state);
}


//-------------------------------------------------
//  trxc_w -
//-------------------------------------------------

WRITE_LINE_MEMBER( abc_keyboard_port_device::trxc_w )
{
	m_out_trxc_handler(state);
}


//-------------------------------------------------
//  keydown_w -
//-------------------------------------------------

WRITE_LINE_MEMBER( abc_keyboard_port_device::keydown_w )
{
	m_out_keydown_handler(state);
}



//**************************************************************************
//  SLOT INTERFACE
//**************************************************************************

#include "abc800kb.h"
#include "abc77.h"
#include "abc99.h"

SLOT_INTERFACE_START( abc_keyboard_devices )
	SLOT_INTERFACE("abc800", ABC800_KEYBOARD)
	SLOT_INTERFACE("abc55", ABC55)
	SLOT_INTERFACE("abc77", ABC77)
	SLOT_INTERFACE("abc99", ABC99)
SLOT_INTERFACE_END