summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/rs232/loopback.cpp
blob: 6552bda2fda74938afd70eb4664d8460aa5e05ae (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
// license:BSD-3-Clause
// copyright-holders:smf

#include "emu.h"
#include "loopback.h"

DEFINE_DEVICE_TYPE(RS232_LOOPBACK, rs232_loopback_device, "rs232_loopback", "RS232 Loopback")

rs232_loopback_device::rs232_loopback_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock)
	: device_t(mconfig, RS232_LOOPBACK, tag, owner, clock)
	, device_rs232_port_interface(mconfig, *this)
{
}

void rs232_loopback_device::device_start()
{
}

WRITE_LINE_MEMBER( rs232_loopback_device::input_txd )
{
	if (started())
	{
		output_rxd(state);
	}
}

WRITE_LINE_MEMBER( rs232_loopback_device::input_rts )
{
	if (started())
	{
		output_ri(state);
		output_si(state);
		output_cts(state);
	}
}

WRITE_LINE_MEMBER( rs232_loopback_device::input_dtr )
{
	if (started())
	{
		output_dsr(state);
		output_dcd(state);
	}
}

DEFINE_DEVICE_TYPE(DEC_RS232_LOOPBACK, dec_rs232_loopback_device, "dec_rs232_loopback", "RS232 Loopback (DEC 12-15336-00)")

dec_rs232_loopback_device::dec_rs232_loopback_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock)
	: device_t(mconfig, DEC_RS232_LOOPBACK, tag, owner, clock)
	, device_rs232_port_interface(mconfig, *this)
{
}

void dec_rs232_loopback_device::device_start()
{
}

WRITE_LINE_MEMBER( dec_rs232_loopback_device::input_txd )
{
	// Pin 2 (Transmitted Data) connected to Pin 3 (Received Data) and Pin 15 (Transmission Clock)
	if (started())
	{
		output_rxd(state);
		output_txc(state);
	}
}

WRITE_LINE_MEMBER( dec_rs232_loopback_device::input_rts )
{
	// Pin 4 (Request to Send) connected to Pin 5 (Clear to Send) and Pin 8 (Carrier Detect)
	if (started())
	{
		output_cts(state);
		output_dcd(state);
	}
}

WRITE_LINE_MEMBER( dec_rs232_loopback_device::input_dtr )
{
	// Pin 20 (Data Terminal Ready) connected to Pin 6 (Data Set Ready) and 22 (Ring Indicator)
	if (started())
	{
		output_dsr(state);
		output_ri(state);
	}
}

WRITE_LINE_MEMBER( dec_rs232_loopback_device::input_spds )
{
	// Pin 19 (Speed Select) connected to Pin 12 (Speed Indicator) and 17 (Receive Clock)
	if (started())
	{
		output_si(state);
		output_rxc(state);
	}
}