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
|
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************
National Semiconductor DS75160A IEEE-488 GPIB Transceiver emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************/
#include "ds75160a.h"
//**************************************************************************
// DEVICE TYPE DEFINITIONS
//**************************************************************************
const device_type DS75160A = &device_creator<ds75160a_device>;
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// ds75160a_device - constructor
//-------------------------------------------------
ds75160a_device::ds75160a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, DS75160A, "DS75160A", tag, owner, clock, "ds75160a", __FILE__),
m_read(*this),
m_write(*this),
m_data(0xff),
m_te(0),
m_pe(0)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void ds75160a_device::device_start()
{
// resolve callbacks
m_read.resolve_safe(0);
m_write.resolve_safe();
// register for state saving
save_item(NAME(m_data));
save_item(NAME(m_te));
save_item(NAME(m_pe));
}
//-------------------------------------------------
// read - read data bus
//-------------------------------------------------
READ8_MEMBER( ds75160a_device::read )
{
UINT8 data = 0;
if (!m_te)
{
data = m_read(0);
}
return data;
}
//-------------------------------------------------
// write - write data bus
//-------------------------------------------------
WRITE8_MEMBER( ds75160a_device::write )
{
m_data = data;
if (m_te)
{
m_write((offs_t)0, m_data);
}
}
//-------------------------------------------------
// te_w - transmit enable
//-------------------------------------------------
WRITE_LINE_MEMBER( ds75160a_device::te_w )
{
if (m_te != state)
{
m_write((offs_t)0, m_te ? m_data : 0xff);
}
m_te = state;
}
//-------------------------------------------------
// pe_w - parallel enable
//-------------------------------------------------
WRITE_LINE_MEMBER( ds75160a_device::pe_w )
{
m_pe = state;
}
|