summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/vp620.c
blob: df2d6595bfff7427ad3b2a9b1e95ec15763a1d12 (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
/**********************************************************************

    RCA VIP ASCII Keyboard Interface VP-620 emulation

    Copyright MESS Team.
    Visit http://mamedev.org for licensing and usage restrictions.

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

#include "vp620.h"



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

const device_type VP620 = &device_creator<vp620_device>;


//-------------------------------------------------
//  ASCII_KEYBOARD_INTERFACE( kb_intf )
//-------------------------------------------------

WRITE8_MEMBER( vp620_device::kb_w )
{
	m_keydata = data;
	
	m_slot->inst_w(0);
	m_slot->inst_w(1);
	
	m_keystb = ASSERT_LINE;
}

static ASCII_KEYBOARD_INTERFACE( kb_intf )
{
	DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, vp620_device, kb_w)
};


//-------------------------------------------------
//  MACHINE_CONFIG_FRAGMENT( vp620 )
//-------------------------------------------------

static MACHINE_CONFIG_FRAGMENT( vp620 )
	MCFG_ASCII_KEYBOARD_ADD("keyboard", kb_intf)
MACHINE_CONFIG_END


//-------------------------------------------------
//  machine_config_additions - device-specific
//  machine configurations
//-------------------------------------------------

machine_config_constructor vp620_device::device_mconfig_additions() const
{
	return MACHINE_CONFIG_NAME( vp620 );
}



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

//-------------------------------------------------
//  vp620_device - constructor
//-------------------------------------------------

vp620_device::vp620_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
	device_t(mconfig, VP620, "VP620", tag, owner, clock),
	device_vip_byteio_port_interface(mconfig, *this),
	m_keydata(0),
	m_keystb(CLEAR_LINE)
{
}


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

void vp620_device::device_start()
{
}


//-------------------------------------------------
//  vip_in_r - byte input read
//-------------------------------------------------

UINT8 vp620_device::vip_in_r()
{
	return m_keydata;
}


//-------------------------------------------------
//  vip_ef3_r - EF3 flag read
//-------------------------------------------------

int vp620_device::vip_ef4_r()
{
	int state = m_keystb;

	m_keystb = CLEAR_LINE;

	return state;
}